Search in sources :

Example 11 with KerberosProperties

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

the class TestHBase_1_1_2_ClientMapCacheService 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 : File(java.io.File) KerberosProperties(org.apache.nifi.hadoop.KerberosProperties) Before(org.junit.Before)

Example 12 with KerberosProperties

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

the class TestHBase_1_1_2_RecordLookupService method before.

@Before
public void before() throws Exception {
    testLookupProcessor = new TestRecordLookupProcessor();
    runner = TestRunners.newTestRunner(testLookupProcessor);
    // setup mock HBaseClientService
    final Table table = Mockito.mock(Table.class);
    when(table.getName()).thenReturn(TableName.valueOf(TABLE_NAME));
    final KerberosProperties kerberosProperties = new KerberosProperties(new File("src/test/resources/krb5.conf"));
    clientService = new MockHBaseClientService(table, "family", kerberosProperties);
    runner.addControllerService("clientService", clientService);
    runner.setProperty(clientService, HBase_1_1_2_ClientService.HADOOP_CONF_FILES, "src/test/resources/hbase-site.xml");
    runner.enableControllerService(clientService);
    // setup HBase LookupService
    lookupService = new HBase_1_1_2_RecordLookupService();
    runner.addControllerService("lookupService", lookupService);
    runner.setProperty(lookupService, HBase_1_1_2_RecordLookupService.HBASE_CLIENT_SERVICE, "clientService");
    runner.setProperty(lookupService, HBase_1_1_2_RecordLookupService.TABLE_NAME, TABLE_NAME);
    runner.enableControllerService(lookupService);
    // setup test processor
    runner.setProperty(TestRecordLookupProcessor.HBASE_LOOKUP_SERVICE, "lookupService");
    runner.setProperty(TestRecordLookupProcessor.HBASE_ROW, ROW);
}
Also used : Table(org.apache.hadoop.hbase.client.Table) File(java.io.File) KerberosProperties(org.apache.nifi.hadoop.KerberosProperties) Before(org.junit.Before)

Example 13 with KerberosProperties

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

the class AbstractHadoopTest method testKerberosOptionsWithBadKerberosConfigFile.

@Test
public void testKerberosOptionsWithBadKerberosConfigFile() throws Exception {
    // invalid since the kerberos configuration was changed to a non-existent file
    kerberosProperties = new KerberosProperties(new File("BAD_KERBEROS_PATH"));
    SimpleHadoopProcessor processor = new SimpleHadoopProcessor(kerberosProperties);
    TestRunner runner = TestRunners.newTestRunner(processor);
    runner.assertValid();
    runner.setProperty(AbstractHadoopProcessor.HADOOP_CONFIGURATION_RESOURCES, "src/test/resources/core-site-security.xml");
    runner.setProperty(kerberosProperties.getKerberosPrincipal(), "principal");
    runner.setProperty(kerberosProperties.getKerberosKeytab(), temporaryFile.getAbsolutePath());
    runner.assertNotValid();
}
Also used : TestRunner(org.apache.nifi.util.TestRunner) File(java.io.File) KerberosProperties(org.apache.nifi.hadoop.KerberosProperties) Test(org.junit.Test)

Example 14 with KerberosProperties

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

the class GetHDFSTest 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)

Example 15 with KerberosProperties

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

the class TestCreateHadoopSequenceFile method setUp.

@Before
public void setUp() {
    mockNiFiProperties = mock(NiFiProperties.class);
    when(mockNiFiProperties.getKerberosConfigurationFile()).thenReturn(null);
    kerberosProperties = new KerberosProperties(null);
    CreateHadoopSequenceFile proc = new TestableCreateHadoopSequenceFile(kerberosProperties);
    controller = TestRunners.newTestRunner(proc);
}
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