Search in sources :

Example 21 with RpcException

use of org.apache.drill.exec.rpc.RpcException in project drill by apache.

the class TestCustomUserAuthenticator method negativeAuthHelper.

private static void negativeAuthHelper(final String user, final String password) throws Exception {
    RpcException negativeAuthEx = null;
    try {
        runTest(user, password);
    } catch (RpcException e) {
        negativeAuthEx = e;
    }
    assertNotNull("Expected RpcException.", negativeAuthEx);
    final String exMsg = negativeAuthEx.getMessage();
    assertThat(exMsg, containsString("Authentication failed"));
    assertThat(exMsg, containsString("Incorrect credentials"));
}
Also used : RpcException(org.apache.drill.exec.rpc.RpcException) StringContains.containsString(org.hamcrest.core.StringContains.containsString)

Example 22 with RpcException

use of org.apache.drill.exec.rpc.RpcException in project drill by apache.

the class JdbcConnectTriesTestEmbeddedBits method testDirectConnectionConnectTriesLessThanDrillbitCount.

@Test
public void testDirectConnectionConnectTriesLessThanDrillbitCount() throws SQLException {
    Connection connection = null;
    try {
        connection = testDrillDriver.connect("jdbc:drill:drillbit=127.0.0.1:5000,127.0.0.1:5001;tries=1", JdbcAssert.getDefaultProperties());
        fail();
    } catch (SQLException ex) {
        assertNull(connection);
        assertTrue(ex.getCause() instanceof RpcException);
        assertTrue(ex.getCause().getCause() instanceof ExecutionException);
    }
}
Also used : SQLException(java.sql.SQLException) RpcException(org.apache.drill.exec.rpc.RpcException) Connection(java.sql.Connection) ExecutionException(java.util.concurrent.ExecutionException) Test(org.junit.Test)

Example 23 with RpcException

use of org.apache.drill.exec.rpc.RpcException in project drill by apache.

the class JdbcConnectTriesTestEmbeddedBits method testDirectConnectionConnectTriesGreaterThanDrillbitCount.

@Test
public void testDirectConnectionConnectTriesGreaterThanDrillbitCount() throws SQLException {
    Connection connection = null;
    try {
        connection = testDrillDriver.connect("jdbc:drill:drillbit=127.0.0.1:5000,127.0.0.1:5001;tries=5", JdbcAssert.getDefaultProperties());
        fail();
    } catch (SQLException ex) {
        assertNull(connection);
        assertTrue(ex.getCause() instanceof RpcException);
        assertTrue(ex.getCause().getCause() instanceof ExecutionException);
    }
}
Also used : SQLException(java.sql.SQLException) RpcException(org.apache.drill.exec.rpc.RpcException) Connection(java.sql.Connection) ExecutionException(java.util.concurrent.ExecutionException) Test(org.junit.Test)

Example 24 with RpcException

use of org.apache.drill.exec.rpc.RpcException in project drill by apache.

the class JdbcConnectTriesTestEmbeddedBits method testDirectConnectionZeroConnectTries.

@Test
public void testDirectConnectionZeroConnectTries() throws SQLException {
    Connection connection = null;
    try {
        connection = testDrillDriver.connect("jdbc:drill:drillbit=127.0.0.1:5000,127.0.0.1:5001;tries=0", JdbcAssert.getDefaultProperties());
        fail();
    } catch (SQLException ex) {
        assertNull(connection);
        assertTrue(ex.getCause() instanceof RpcException);
        assertTrue(ex.getCause().getCause() instanceof ExecutionException);
    }
}
Also used : SQLException(java.sql.SQLException) RpcException(org.apache.drill.exec.rpc.RpcException) Connection(java.sql.Connection) ExecutionException(java.util.concurrent.ExecutionException) Test(org.junit.Test)

Example 25 with RpcException

use of org.apache.drill.exec.rpc.RpcException in project drill by apache.

the class JdbcConnectTriesTestEmbeddedBits method testDirectConnectionNegativeConnectTries.

@Test
public void testDirectConnectionNegativeConnectTries() throws SQLException {
    Connection connection = null;
    try {
        connection = testDrillDriver.connect("jdbc:drill:drillbit=127.0.0.1:5000,127.0.0.1:5001;tries=-5", JdbcAssert.getDefaultProperties());
        fail();
    } catch (SQLException ex) {
        assertNull(connection);
        assertTrue(ex.getCause() instanceof RpcException);
        assertTrue(ex.getCause().getCause() instanceof ExecutionException);
    }
}
Also used : SQLException(java.sql.SQLException) RpcException(org.apache.drill.exec.rpc.RpcException) Connection(java.sql.Connection) ExecutionException(java.util.concurrent.ExecutionException) Test(org.junit.Test)

Aggregations

RpcException (org.apache.drill.exec.rpc.RpcException)26 Test (org.junit.Test)10 ExecutionException (java.util.concurrent.ExecutionException)9 IOException (java.io.IOException)8 NonTransientRpcException (org.apache.drill.exec.rpc.NonTransientRpcException)6 Connection (java.sql.Connection)5 SQLException (java.sql.SQLException)5 Properties (java.util.Properties)4 SaslException (javax.security.sasl.SaslException)4 QueryId (org.apache.drill.exec.proto.UserBitShared.QueryId)4 Response (org.apache.drill.exec.rpc.Response)4 SaslClient (javax.security.sasl.SaslClient)3 UserException (org.apache.drill.common.exceptions.UserException)3 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)2 AbstractCheckedFuture (com.google.common.util.concurrent.AbstractCheckedFuture)2 ByteString (com.google.protobuf.ByteString)2 InvalidProtocolBufferException (com.google.protobuf.InvalidProtocolBufferException)2 ByteBufInputStream (io.netty.buffer.ByteBufInputStream)2 UserRemoteException (org.apache.drill.common.exceptions.UserRemoteException)2 DrillbitEndpoint (org.apache.drill.exec.proto.CoordinationProtos.DrillbitEndpoint)2