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

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

Introduction

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

Prototype

@Override
    public String toString() 

Source Link

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 {/*from   w  w  w . j  a  va2s  .co  m*/
        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;
}