Search in sources :

Example 1 with KerberosProperties

use of org.apache.nifi.hadoop.KerberosProperties in project nifi by apache.

the class TestHBase_1_1_2_ClientService method setup.

@Before
public void setup() {
    // needed for calls to UserGroupInformation.setConfiguration() to work when passing in
    // config with Kerberos authentication enabled
    System.setProperty("java.security.krb5.realm", "nifi.com");
    System.setProperty("java.security.krb5.kdc", "nifi.kdc");
    kerberosPropsWithFile = new KerberosProperties(new File("src/test/resources/krb5.conf"));
    kerberosPropsWithoutFile = new KerberosProperties(null);
}
Also used : PutFlowFile(org.apache.nifi.hbase.put.PutFlowFile) File(java.io.File) KerberosProperties(org.apache.nifi.hadoop.KerberosProperties) Before(org.junit.Before)

Example 2 with KerberosProperties

use of org.apache.nifi.hadoop.KerberosProperties in project nifi by apache.

the class TestPutHiveStreaming method setUp.

@Before
public void setUp() throws Exception {
    // needed for calls to UserGroupInformation.setConfiguration() to work when passing in
    // config with Kerberos authentication enabled
    System.setProperty("java.security.krb5.realm", "nifi.com");
    System.setProperty("java.security.krb5.kdc", "nifi.kdc");
    ugi = null;
    kerberosPropsWithFile = new KerberosProperties(new File("src/test/resources/krb5.conf"));
    processor = new MockPutHiveStreaming();
    hiveConfigurator = mock(HiveConfigurator.class);
    hiveConf = mock(HiveConf.class);
    when(hiveConfigurator.getConfigurationFromFiles(anyString())).thenReturn(hiveConf);
    processor.hiveConfigurator = hiveConfigurator;
    processor.setKerberosProperties(kerberosPropsWithFile);
    runner = TestRunners.newTestRunner(processor);
}
Also used : HiveConfigurator(org.apache.nifi.util.hive.HiveConfigurator) HiveConf(org.apache.hadoop.hive.conf.HiveConf) MockFlowFile(org.apache.nifi.util.MockFlowFile) File(java.io.File) KerberosProperties(org.apache.nifi.hadoop.KerberosProperties) Before(org.junit.Before)

Example 3 with KerberosProperties

use of org.apache.nifi.hadoop.KerberosProperties in project nifi by apache.

the class HiveConnectionPool method init.

@Override
protected void init(final ControllerServiceInitializationContext context) {
    List<PropertyDescriptor> props = new ArrayList<>();
    props.add(DATABASE_URL);
    props.add(HIVE_CONFIGURATION_RESOURCES);
    props.add(DB_USER);
    props.add(DB_PASSWORD);
    props.add(MAX_WAIT_TIME);
    props.add(MAX_TOTAL_CONNECTIONS);
    props.add(VALIDATION_QUERY);
    props.add(KERBEROS_CREDENTIALS_SERVICE);
    kerberosConfigFile = context.getKerberosConfigurationFile();
    kerberosProperties = new KerberosProperties(kerberosConfigFile);
    props.add(kerberosProperties.getKerberosPrincipal());
    props.add(kerberosProperties.getKerberosKeytab());
    properties = props;
}
Also used : PropertyDescriptor(org.apache.nifi.components.PropertyDescriptor) ArrayList(java.util.ArrayList) KerberosProperties(org.apache.nifi.hadoop.KerberosProperties)

Example 4 with KerberosProperties

use of org.apache.nifi.hadoop.KerberosProperties in project nifi by apache.

the class AbstractHadoopTest method setup.

@Before
public void setup() throws IOException {
    // needed for calls to UserGroupInformation.setConfiguration() to work when passing in
    // config with Kerberos authentication enabled
    System.setProperty("java.security.krb5.realm", "nifi.com");
    System.setProperty("java.security.krb5.kdc", "nifi.kdc");
    temporaryFile = File.createTempFile("hadoop-test", ".properties");
    // mock properties and return a temporary file for the kerberos configuration
    mockedProperties = mock(NiFiProperties.class);
    when(mockedProperties.getKerberosConfigurationFile()).thenReturn(temporaryFile);
    kerberosProperties = new KerberosProperties(temporaryFile);
}
Also used : NiFiProperties(org.apache.nifi.util.NiFiProperties) KerberosProperties(org.apache.nifi.hadoop.KerberosProperties) Before(org.junit.Before)

Example 5 with KerberosProperties

use of org.apache.nifi.hadoop.KerberosProperties in project nifi by apache.

the class MoveHDFSTest method setup.

@Before
public void setup() {
    mockNiFiProperties = mock(NiFiProperties.class);
    when(mockNiFiProperties.getKerberosConfigurationFile()).thenReturn(null);
    kerberosProperties = new KerberosProperties(null);
}
Also used : NiFiProperties(org.apache.nifi.util.NiFiProperties) KerberosProperties(org.apache.nifi.hadoop.KerberosProperties) Before(org.junit.Before)

Aggregations

KerberosProperties (org.apache.nifi.hadoop.KerberosProperties)17 Before (org.junit.Before)13 NiFiProperties (org.apache.nifi.util.NiFiProperties)9 File (java.io.File)6 ArrayList (java.util.ArrayList)2 FileSystem (org.apache.hadoop.fs.FileSystem)2 PropertyDescriptor (org.apache.nifi.components.PropertyDescriptor)2 Relationship (org.apache.nifi.processor.Relationship)2 MockFlowFile (org.apache.nifi.util.MockFlowFile)2 TestRunner (org.apache.nifi.util.TestRunner)2 Test (org.junit.Test)2 FileInputStream (java.io.FileInputStream)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Configuration (org.apache.hadoop.conf.Configuration)1 Path (org.apache.hadoop.fs.Path)1 Table (org.apache.hadoop.hbase.client.Table)1 DFSInotifyEventInputStream (org.apache.hadoop.hdfs.DFSInotifyEventInputStream)1 HdfsAdmin (org.apache.hadoop.hdfs.client.HdfsAdmin)1 HiveConf (org.apache.hadoop.hive.conf.HiveConf)1