use of org.apache.drill.exec.rpc.RpcException in project drill by axbaretto.
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"));
}
use of org.apache.drill.exec.rpc.RpcException in project drill by axbaretto.
the class TestUserBitKerberosEncryption method failureOldClientEncryptionEnabled.
/**
* Test to validate that older clients are not allowed to connect to secure cluster
* with encryption enabled.
*/
@Test
public void failureOldClientEncryptionEnabled() {
try {
final Properties connectionProps = new Properties();
connectionProps.setProperty(DrillProperties.SERVICE_PRINCIPAL, krbHelper.SERVER_PRINCIPAL);
connectionProps.setProperty(DrillProperties.USER, krbHelper.CLIENT_PRINCIPAL);
connectionProps.setProperty(DrillProperties.KEYTAB, krbHelper.clientKeytab.getAbsolutePath());
connectionProps.setProperty(DrillProperties.TEST_SASL_LEVEL, "1");
newConfig = new DrillConfig(DrillConfig.create(cloneDefaultTestConfigProperties()).withValue(ExecConstants.USER_AUTHENTICATION_ENABLED, ConfigValueFactory.fromAnyRef(true)).withValue(ExecConstants.USER_AUTHENTICATOR_IMPL, ConfigValueFactory.fromAnyRef(UserAuthenticatorTestImpl.TYPE)).withValue(ExecConstants.SERVICE_PRINCIPAL, ConfigValueFactory.fromAnyRef(krbHelper.SERVER_PRINCIPAL)).withValue(ExecConstants.SERVICE_KEYTAB_LOCATION, ConfigValueFactory.fromAnyRef(krbHelper.serverKeytab.toString())).withValue(ExecConstants.AUTHENTICATION_MECHANISMS, ConfigValueFactory.fromIterable(Lists.newArrayList("plain", "kerberos"))).withValue(ExecConstants.USER_ENCRYPTION_SASL_ENABLED, ConfigValueFactory.fromAnyRef(true)));
updateTestCluster(1, newConfig, connectionProps);
fail();
} catch (Exception ex) {
assert (ex.getCause() instanceof RpcException);
System.out.println("Caught exception: " + ex.getMessage());
logger.info("Caught exception: " + ex.getMessage());
}
}
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", getDefaultProperties());
fail();
} catch (SQLException ex) {
assertNull(connection);
assertTrue(ex.getCause() instanceof RpcException);
assertTrue(ex.getCause().getCause() instanceof ExecutionException);
}
}
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", getDefaultProperties());
fail();
} catch (SQLException ex) {
assertNull(connection);
assertTrue(ex.getCause() instanceof RpcException);
assertTrue(ex.getCause().getCause() instanceof ExecutionException);
}
}
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", getDefaultProperties());
fail();
} catch (SQLException ex) {
assertNull(connection);
assertTrue(ex.getCause() instanceof RpcException);
assertTrue(ex.getCause().getCause() instanceof ExecutionException);
}
}
Aggregations