Example usage for org.apache.hadoop.hdfs.server.namenode INode isFile

List of usage examples for org.apache.hadoop.hdfs.server.namenode INode isFile

Introduction

In this page you can find the example usage for org.apache.hadoop.hdfs.server.namenode INode isFile.

Prototype

public boolean isFile() 

Source Link

Document

Check whether it's a file.

Usage

From source file:org.apache.ranger.services.hdfs.RangerHdfsAuthorizerTest.java

License:Apache License

private static INode createNode(String[] pathSegments, int i, String owner, String group, boolean file) {
    String fullPath = StringUtils.join(pathSegments, '/', 0, i + 1);
    String name = pathSegments[i];
    INode mock = Mockito.mock(INode.class);
    try {/*  ww w.  ja va  2  s . com*/
        when(mock.getLocalNameBytes()).thenReturn(name.getBytes("UTF-8"));
    } catch (UnsupportedEncodingException e) {
        throw new RuntimeException(e);
    }
    when(mock.getUserName()).thenReturn(owner);
    when(mock.getGroupName()).thenReturn(group);
    when(mock.getFullPathName()).thenReturn(fullPath);
    when(mock.isFile()).thenReturn(file);
    when(mock.isDirectory()).thenReturn(!file);
    when(mock.toString()).thenReturn(name);
    return mock;
}