@@ -0,0 +1,2667 @@
+/**%0A * Licensed to the Apache Software Foundation (ASF) under one%0A * or more contributor license agreements. See the NOTICE file%0A * distributed with this work for additional information%0A * regarding copyright ownership. The ASF licenses this file%0A * to you under the Apache License, Version 2.0 (the%0A * %22License%22); you may not use this file except in compliance%0A * with the License. You may obtain a copy of the License at%0A *%0A * http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage hdfs.jsr203;%0A%0Aimport static org.junit.Assert.assertNotNull;%0A%0Aimport java.io.File;%0Aimport java.io.IOException;%0Aimport java.net.URI;%0Aimport java.nio.file.Path;%0Aimport java.nio.file.Paths;%0Aimport java.nio.file.attribute.UserPrincipalLookupService;%0A%0Aimport org.apache.hadoop.conf.Configuration;%0Aimport org.apache.hadoop.fs.FileUtil;%0Aimport org.apache.hadoop.hdfs.MiniDFSCluster;%0Aimport org.junit.AfterClass;%0Aimport org.junit.BeforeClass;%0Aimport org.junit.Test;%0A%0Apublic class TestUserPrincipalLookupService %7B%0A%0A%09private static MiniDFSCluster cluster;%0A    private static URI clusterUri;%0A%0A    @BeforeClass%0A    public static void setUpBeforeClass() throws Exception %7B%0A        cluster = startMini(TestFileSystem.class.getName());%0A        clusterUri = cluster.getFileSystem().getUri();%0A    %7D%0A%0A    @AfterClass%0A    public static void teardownClass() throws Exception %7B%0A        if (cluster != null)%0A        %7B%0A            cluster.shutdown();%0A        %7D%0A    %7D%0A%0A    private static MiniDFSCluster startMini(String testName) throws IOException %7B%0A        File baseDir = new File(%22./target/hdfs/%22 + testName).getAbsoluteFile();%0A        FileUtil.fullyDelete(baseDir);%0A        Configuration conf = new Configuration();%0A        conf.set(MiniDFSCluster.HDFS_MINIDFS_BASEDIR, baseDir.getAbsolutePath());%0A        MiniDFSCluster.Builder builder = new MiniDFSCluster.Builder(conf);%0A        MiniDFSCluster hdfsCluster = builder.clusterId(testName).build();%0A        hdfsCluster.waitActive();%0A        return hdfsCluster;%0A    %7D%0A%0A    /**%0A     * Test UserPrincipalLookupService support.%0A     * %0A     * @throws IOException%0A     */%0A    @Test%0A    public void testGetPosixViewSetOwner() throws IOException %7B%0A        Path rootPath = Paths.get(clusterUri);%0A        %0A        UserPrincipalLookupService lus = rootPath.getFileSystem().getUserPrincipalLookupService();%0A        assertNotNull(lus);%0A    %7D%0A%7D%0A

Add unit test for UserPrincipalLookupService