Search in sources :

Example 1 with SequenceFileReader

use of org.apache.nifi.processors.hadoop.util.SequenceFileReader in project nifi by apache.

the class GetHDFSSequenceFileTest method testGetFlowFilesNoUgiShouldntCallDoAs.

@Test
public void testGetFlowFilesNoUgiShouldntCallDoAs() throws Exception {
    hdfsResources = new AbstractHadoopProcessor.HdfsResources(configuration, fileSystem, null);
    init();
    SequenceFileReader reader = mock(SequenceFileReader.class);
    Path file = mock(Path.class);
    getHDFSSequenceFile.getFlowFiles(configuration, fileSystem, reader, file);
    verify(reader).readSequenceFile(file, configuration, fileSystem);
}
Also used : Path(org.apache.hadoop.fs.Path) SequenceFileReader(org.apache.nifi.processors.hadoop.util.SequenceFileReader) Test(org.junit.Test)

Example 2 with SequenceFileReader

use of org.apache.nifi.processors.hadoop.util.SequenceFileReader in project nifi by apache.

the class GetHDFSSequenceFileTest method getFlowFilesWithUgiAndNewTicketShouldCallDoAsAndNotRelogin.

@Test
public void getFlowFilesWithUgiAndNewTicketShouldCallDoAsAndNotRelogin() throws Exception {
    SequenceFileReader reader = mock(SequenceFileReader.class);
    Path file = mock(Path.class);
    getHDFSSequenceFile.getFlowFiles(configuration, fileSystem, reader, file);
    ArgumentCaptor<PrivilegedExceptionAction> privilegedExceptionActionArgumentCaptor = ArgumentCaptor.forClass(PrivilegedExceptionAction.class);
    verifyNoMoreInteractions(reader);
    verify(userGroupInformation).doAs(privilegedExceptionActionArgumentCaptor.capture());
    privilegedExceptionActionArgumentCaptor.getValue().run();
    verify(reader).readSequenceFile(file, configuration, fileSystem);
    assertFalse(reloginTried);
}
Also used : Path(org.apache.hadoop.fs.Path) SequenceFileReader(org.apache.nifi.processors.hadoop.util.SequenceFileReader) PrivilegedExceptionAction(java.security.PrivilegedExceptionAction) Test(org.junit.Test)

Aggregations

Path (org.apache.hadoop.fs.Path)2 SequenceFileReader (org.apache.nifi.processors.hadoop.util.SequenceFileReader)2 Test (org.junit.Test)2 PrivilegedExceptionAction (java.security.PrivilegedExceptionAction)1