org.apache.hadoop.fs.FileSystemTestHelper.MockFileSystem

Here are the examples of the java api class org.apache.hadoop.fs.FileSystemTestHelper.MockFileSystem taken from open source projects.

1. TestTokenCache#createFileSystemForServiceName()

Project: incubator-tez
Source File: TestTokenCache.java
View license
private MockFileSystem createFileSystemForServiceName(final String service) throws IOException {
    MockFileSystem mockFs = new MockFileSystem();
    when(mockFs.getCanonicalServiceName()).thenReturn(service);
    when(mockFs.getDelegationToken(any(String.class))).thenAnswer(new Answer<Token<?>>() {

        int unique = 0;

        @Override
        public Token<?> answer(InvocationOnMock invocation) throws Throwable {
            Token<?> token = new Token<TokenIdentifier>();
            token.setService(new Text(service));
            // use unique value so when we restore from token storage, we can
            // tell if it's really the same token
            token.setKind(new Text("token" + unique++));
            return token;
        }
    });
    return mockFs;
}

2. TestTokenCache#createFileSystemForServiceName()

Project: tez
Source File: TestTokenCache.java
View license
private MockFileSystem createFileSystemForServiceName(final String service) throws IOException {
    MockFileSystem mockFs = new MockFileSystem();
    when(mockFs.getCanonicalServiceName()).thenReturn(service);
    when(mockFs.getDelegationToken(any(String.class))).thenAnswer(new Answer<Token<?>>() {

        int unique = 0;

        @Override
        public Token<?> answer(InvocationOnMock invocation) throws Throwable {
            Token<?> token = new Token<TokenIdentifier>();
            token.setService(new Text(service));
            // use unique value so when we restore from token storage, we can
            // tell if it's really the same token
            token.setKind(new Text("token" + unique++));
            return token;
        }
    });
    return mockFs;
}