@Test public void testSetup() throws Exception { configure(processor, 0); runner.assertNotValid(); runner.setProperty(PutHive3Streaming.METASTORE_URI, "thrift: runner.setProperty(PutHive3Streaming.DB_NAME, "default"); runner.assertNotValid(); runner.setProperty(PutHive3Streaming.TABLE_NAME, "users"); runner.assertValid(); runner.run(); }
@OnScheduled public void setup(final ProcessContext context) { ComponentLog log = getLogger(); rollbackOnFailure = context.getProperty(ROLLBACK_ON_FAILURE).asBoolean(); final String configFiles = context.getProperty(HIVE_CONFIGURATION_RESOURCES).getValue(); hiveConfig = hiveConfigurator.getConfigurationFromFiles(configFiles); if (context.getMaxConcurrentTasks() > 1) { hiveConfig.setBoolean(CLIENT_CACHE_DISABLED_PROPERTY, true); } for (final Map.Entry<PropertyDescriptor, String> entry : context.getProperties().entrySet()) { final PropertyDescriptor descriptor = entry.getKey(); if (descriptor.isDynamic()) { hiveConfig.set(descriptor.getName(), entry.getValue()); } } hiveConfigurator.preload(hiveConfig); if (SecurityUtil.isSecurityEnabled(hiveConfig)) { final KerberosCredentialsService credentialsService = context.getProperty(KERBEROS_CREDENTIALS_SERVICE).asControllerService(KerberosCredentialsService.class); final String resolvedPrincipal = credentialsService.getPrincipal(); final String resolvedKeytab = credentialsService.getKeytab(); log.info("Hive Security Enabled, logging in as principal {} with keytab {}", new Object[]{resolvedPrincipal, resolvedKeytab}); try { ugi = hiveConfigurator.authenticate(hiveConfig, resolvedPrincipal, resolvedKeytab); } catch (AuthenticationFailedException ae) { throw new ProcessException("Kerberos authentication failed for Hive Streaming", ae); } log.info("Successfully logged in as principal {} with keytab {}", new Object[]{resolvedPrincipal, resolvedKeytab}); } else { ugi = null; } callTimeout = context.getProperty(CALL_TIMEOUT).evaluateAttributeExpressions().asInteger() * 1000; String timeoutName = "put-hive3-streaming-%d"; this.callTimeoutPool = Executors.newFixedThreadPool(1, new ThreadFactoryBuilder().setNameFormat(timeoutName).build()); }
PutHive3Streaming extends AbstractProcessor { @OnScheduled public void setup(final ProcessContext context) { ComponentLog log = getLogger(); rollbackOnFailure = context.getProperty(ROLLBACK_ON_FAILURE).asBoolean(); final String configFiles = context.getProperty(HIVE_CONFIGURATION_RESOURCES).getValue(); hiveConfig = hiveConfigurator.getConfigurationFromFiles(configFiles); if (context.getMaxConcurrentTasks() > 1) { hiveConfig.setBoolean(CLIENT_CACHE_DISABLED_PROPERTY, true); } for (final Map.Entry<PropertyDescriptor, String> entry : context.getProperties().entrySet()) { final PropertyDescriptor descriptor = entry.getKey(); if (descriptor.isDynamic()) { hiveConfig.set(descriptor.getName(), entry.getValue()); } } hiveConfigurator.preload(hiveConfig); if (SecurityUtil.isSecurityEnabled(hiveConfig)) { final KerberosCredentialsService credentialsService = context.getProperty(KERBEROS_CREDENTIALS_SERVICE).asControllerService(KerberosCredentialsService.class); final String resolvedPrincipal = credentialsService.getPrincipal(); final String resolvedKeytab = credentialsService.getKeytab(); log.info("Hive Security Enabled, logging in as principal {} with keytab {}", new Object[]{resolvedPrincipal, resolvedKeytab}); try { ugi = hiveConfigurator.authenticate(hiveConfig, resolvedPrincipal, resolvedKeytab); } catch (AuthenticationFailedException ae) { throw new ProcessException("Kerberos authentication failed for Hive Streaming", ae); } log.info("Successfully logged in as principal {} with keytab {}", new Object[]{resolvedPrincipal, resolvedKeytab}); } else { ugi = null; } callTimeout = context.getProperty(CALL_TIMEOUT).evaluateAttributeExpressions().asInteger() * 1000; String timeoutName = "put-hive3-streaming-%d"; this.callTimeoutPool = Executors.newFixedThreadPool(1, new ThreadFactoryBuilder().setNameFormat(timeoutName).build()); } }
PutHive3Streaming extends AbstractProcessor { @OnScheduled public void setup(final ProcessContext context) { ComponentLog log = getLogger(); rollbackOnFailure = context.getProperty(ROLLBACK_ON_FAILURE).asBoolean(); final String configFiles = context.getProperty(HIVE_CONFIGURATION_RESOURCES).getValue(); hiveConfig = hiveConfigurator.getConfigurationFromFiles(configFiles); if (context.getMaxConcurrentTasks() > 1) { hiveConfig.setBoolean(CLIENT_CACHE_DISABLED_PROPERTY, true); } for (final Map.Entry<PropertyDescriptor, String> entry : context.getProperties().entrySet()) { final PropertyDescriptor descriptor = entry.getKey(); if (descriptor.isDynamic()) { hiveConfig.set(descriptor.getName(), entry.getValue()); } } hiveConfigurator.preload(hiveConfig); if (SecurityUtil.isSecurityEnabled(hiveConfig)) { final KerberosCredentialsService credentialsService = context.getProperty(KERBEROS_CREDENTIALS_SERVICE).asControllerService(KerberosCredentialsService.class); final String resolvedPrincipal = credentialsService.getPrincipal(); final String resolvedKeytab = credentialsService.getKeytab(); log.info("Hive Security Enabled, logging in as principal {} with keytab {}", new Object[]{resolvedPrincipal, resolvedKeytab}); try { ugi = hiveConfigurator.authenticate(hiveConfig, resolvedPrincipal, resolvedKeytab); } catch (AuthenticationFailedException ae) { throw new ProcessException("Kerberos authentication failed for Hive Streaming", ae); } log.info("Successfully logged in as principal {} with keytab {}", new Object[]{resolvedPrincipal, resolvedKeytab}); } else { ugi = null; } callTimeout = context.getProperty(CALL_TIMEOUT).evaluateAttributeExpressions().asInteger() * 1000; String timeoutName = "put-hive3-streaming-%d"; this.callTimeoutPool = Executors.newFixedThreadPool(1, new ThreadFactoryBuilder().setNameFormat(timeoutName).build()); }  }
PutHive3Streaming extends AbstractProcessor { @OnScheduled public void setup(final ProcessContext context) { ComponentLog log = getLogger(); rollbackOnFailure = context.getProperty(ROLLBACK_ON_FAILURE).asBoolean(); final String configFiles = context.getProperty(HIVE_CONFIGURATION_RESOURCES).getValue(); hiveConfig = hiveConfigurator.getConfigurationFromFiles(configFiles); if (context.getMaxConcurrentTasks() > 1) { hiveConfig.setBoolean(CLIENT_CACHE_DISABLED_PROPERTY, true); } for (final Map.Entry<PropertyDescriptor, String> entry : context.getProperties().entrySet()) { final PropertyDescriptor descriptor = entry.getKey(); if (descriptor.isDynamic()) { hiveConfig.set(descriptor.getName(), entry.getValue()); } } hiveConfigurator.preload(hiveConfig); if (SecurityUtil.isSecurityEnabled(hiveConfig)) { final KerberosCredentialsService credentialsService = context.getProperty(KERBEROS_CREDENTIALS_SERVICE).asControllerService(KerberosCredentialsService.class); final String resolvedPrincipal = credentialsService.getPrincipal(); final String resolvedKeytab = credentialsService.getKeytab(); log.info("Hive Security Enabled, logging in as principal {} with keytab {}", new Object[]{resolvedPrincipal, resolvedKeytab}); try { ugi = hiveConfigurator.authenticate(hiveConfig, resolvedPrincipal, resolvedKeytab); } catch (AuthenticationFailedException ae) { throw new ProcessException("Kerberos authentication failed for Hive Streaming", ae); } log.info("Successfully logged in as principal {} with keytab {}", new Object[]{resolvedPrincipal, resolvedKeytab}); } else { ugi = null; } callTimeout = context.getProperty(CALL_TIMEOUT).evaluateAttributeExpressions().asInteger() * 1000; String timeoutName = "put-hive3-streaming-%d"; this.callTimeoutPool = Executors.newFixedThreadPool(1, new ThreadFactoryBuilder().setNameFormat(timeoutName).build()); }  @Override Set<Relationship> getRelationships(); @OnScheduled void setup(final ProcessContext context); void onTrigger(ProcessContext context, ProcessSession session); @OnStopped void cleanup(); }
PutHive3Streaming extends AbstractProcessor { @OnScheduled public void setup(final ProcessContext context) { ComponentLog log = getLogger(); rollbackOnFailure = context.getProperty(ROLLBACK_ON_FAILURE).asBoolean(); final String configFiles = context.getProperty(HIVE_CONFIGURATION_RESOURCES).getValue(); hiveConfig = hiveConfigurator.getConfigurationFromFiles(configFiles); if (context.getMaxConcurrentTasks() > 1) { hiveConfig.setBoolean(CLIENT_CACHE_DISABLED_PROPERTY, true); } for (final Map.Entry<PropertyDescriptor, String> entry : context.getProperties().entrySet()) { final PropertyDescriptor descriptor = entry.getKey(); if (descriptor.isDynamic()) { hiveConfig.set(descriptor.getName(), entry.getValue()); } } hiveConfigurator.preload(hiveConfig); if (SecurityUtil.isSecurityEnabled(hiveConfig)) { final KerberosCredentialsService credentialsService = context.getProperty(KERBEROS_CREDENTIALS_SERVICE).asControllerService(KerberosCredentialsService.class); final String resolvedPrincipal = credentialsService.getPrincipal(); final String resolvedKeytab = credentialsService.getKeytab(); log.info("Hive Security Enabled, logging in as principal {} with keytab {}", new Object[]{resolvedPrincipal, resolvedKeytab}); try { ugi = hiveConfigurator.authenticate(hiveConfig, resolvedPrincipal, resolvedKeytab); } catch (AuthenticationFailedException ae) { throw new ProcessException("Kerberos authentication failed for Hive Streaming", ae); } log.info("Successfully logged in as principal {} with keytab {}", new Object[]{resolvedPrincipal, resolvedKeytab}); } else { ugi = null; } callTimeout = context.getProperty(CALL_TIMEOUT).evaluateAttributeExpressions().asInteger() * 1000; String timeoutName = "put-hive3-streaming-%d"; this.callTimeoutPool = Executors.newFixedThreadPool(1, new ThreadFactoryBuilder().setNameFormat(timeoutName).build()); }  @Override Set<Relationship> getRelationships(); @OnScheduled void setup(final ProcessContext context); void onTrigger(ProcessContext context, ProcessSession session); @OnStopped void cleanup(); static final String HIVE_STREAMING_RECORD_COUNT_ATTR; static final Relationship REL_SUCCESS; static final Relationship REL_FAILURE; static final Relationship REL_RETRY; }