use of org.apache.drill.exec.store.phoenix.PhoenixStoragePluginConfig in project drill by apache.
the class SecuredPhoenixBaseTest method startSecuredDrillCluster.
private static void startSecuredDrillCluster() throws Exception {
logFixture = LogFixture.builder().toConsole().logger(QueryServerEnvironment.class, CURRENT_LOG_LEVEL).logger(SecuredPhoenixBaseTest.class, CURRENT_LOG_LEVEL).logger(KerberosFactory.class, CURRENT_LOG_LEVEL).logger(Krb5LoginModule.class, CURRENT_LOG_LEVEL).logger(QueryServer.class, CURRENT_LOG_LEVEL).logger(ServerAuthenticationHandler.class, CURRENT_LOG_LEVEL).build();
Map.Entry<String, File> user1 = environment.getUser(1);
Map.Entry<String, File> user2 = environment.getUser(2);
Map.Entry<String, File> user3 = environment.getUser(3);
// until DirTestWatcher ClassRule is implemented for JUnit5
dirTestWatcher.start(SecuredPhoenixTestSuite.class);
ClusterFixtureBuilder builder = ClusterFixture.builder(dirTestWatcher).configProperty(ExecConstants.USER_AUTHENTICATION_ENABLED, true).configProperty(ExecConstants.USER_AUTHENTICATOR_IMPL, UserAuthenticatorTestImpl.TYPE).configNonStringProperty(ExecConstants.AUTHENTICATION_MECHANISMS, Lists.newArrayList("kerberos")).configProperty(ExecConstants.IMPERSONATION_ENABLED, true).configProperty(ExecConstants.BIT_AUTHENTICATION_ENABLED, true).configProperty(ExecConstants.BIT_AUTHENTICATION_MECHANISM, "kerberos").configProperty(ExecConstants.SERVICE_PRINCIPAL, HBaseKerberosUtils.getPrincipalForTesting()).configProperty(ExecConstants.SERVICE_KEYTAB_LOCATION, environment.getServiceKeytab().getAbsolutePath()).configClientProperty(DrillProperties.SERVICE_PRINCIPAL, HBaseKerberosUtils.getPrincipalForTesting()).configClientProperty(DrillProperties.USER, user1.getKey()).configClientProperty(DrillProperties.KEYTAB, user1.getValue().getAbsolutePath());
startCluster(builder);
Properties user2ClientProperties = new Properties();
user2ClientProperties.setProperty(DrillProperties.SERVICE_PRINCIPAL, HBaseKerberosUtils.getPrincipalForTesting());
user2ClientProperties.setProperty(DrillProperties.USER, user2.getKey());
user2ClientProperties.setProperty(DrillProperties.KEYTAB, user2.getValue().getAbsolutePath());
cluster.addClientFixture(user2ClientProperties);
Properties user3ClientProperties = new Properties();
user3ClientProperties.setProperty(DrillProperties.SERVICE_PRINCIPAL, HBaseKerberosUtils.getPrincipalForTesting());
user3ClientProperties.setProperty(DrillProperties.USER, user3.getKey());
user3ClientProperties.setProperty(DrillProperties.KEYTAB, user3.getValue().getAbsolutePath());
cluster.addClientFixture(user3ClientProperties);
Map<String, Object> phoenixProps = new HashMap<>();
phoenixProps.put("phoenix.query.timeoutMs", 90000);
phoenixProps.put("phoenix.query.keepAliveMs", "30000");
phoenixProps.put("phoenix.queryserver.withRemoteUserExtractor", true);
StoragePluginRegistry registry = cluster.drillbit().getContext().getStorage();
final String doAsUrl = String.format(getUrlTemplate(), "$user");
logger.debug("Phoenix Query Server URL: {}", environment.getPqsUrl());
PhoenixStoragePluginConfig config = new PhoenixStoragePluginConfig(null, 0, null, null, doAsUrl, null, phoenixProps);
config.setEnabled(true);
registry.put(PhoenixStoragePluginConfig.NAME + "123", config);
}
Aggregations