@@ -0,0 +1,2604 @@
+/*-%0A * Copyright (c) 2014 Red Hat, Inc.%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * 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 org.fedoraproject.xmvn.tools.install.impl;%0A%0Aimport java.io.IOException;%0Aimport java.nio.file.Paths;%0A%0Aimport org.junit.Test;%0A%0A/**%0A * @author Mikolaj Izdebski%0A */%0Apublic class DirectoryTest%0A    extends AbstractFileTest%0A%7B%0A    /**%0A     * Basic test for directory installation%0A     * %0A     * @throws Exception%0A     */%0A    @Test%0A    public void testSingleDirectoryInstallation()%0A        throws Exception%0A    %7B%0A        add( new Directory( Paths.get( %22usr/src/sys/kern%22 ) ) );%0A        performInstallation();%0A%0A        assertDirectoryStructure( %22D /usr%22, %22D /usr/src%22, %22D /usr/src/sys%22, %22D /usr/src/sys/kern%22 );%0A    %7D%0A%0A    /**%0A     * Test if installing directory which already exists doesn't cause I/O (or other) errors%0A     * %0A     * @throws Exception%0A     */%0A    @Test%0A    public void testExistentDirectoryInstallation()%0A        throws Exception%0A    %7B%0A        add( new Directory( Paths.get( %22etc/sysconfig/java%22 ) ) );%0A        add( new Directory( Paths.get( %22etc/xmvn%22 ) ) );%0A        add( new Directory( Paths.get( %22etc%22 ) ) );%0A        performInstallation();%0A%0A        assertDirectoryStructure( %22D /etc%22, %22D /etc/sysconfig%22, %22D /etc/sysconfig/java%22, %22D /etc/xmvn%22 );%0A    %7D%0A%0A    /**%0A     * Test if directory installation fails if target already exists and is not a directory.%0A     */%0A    @Test( expected = IOException.class )%0A    public void testExistentTargetFile()%0A        throws Exception%0A    %7B%0A        add( new RegularFile( Paths.get( %22foo/bar%22 ), new byte%5B0%5D ) );%0A        add( new Directory( Paths.get( %22foo/bar%22 ) ) );%0A        performInstallation();%0A    %7D%0A%0A    /**%0A     * Test if directory installation fails if component of target directory target already exists and is not a%0A     * directory.%0A     */%0A    @Test( expected = IOException.class )%0A    public void testDirectoryCOmponentIsAFile()%0A        throws Exception%0A    %7B%0A        add( new RegularFile( Paths.get( %22a/b/c/d%22 ), new byte%5B0%5D ) );%0A        add( new Directory( Paths.get( %22a/b/c/d/e/f/g/h%22 ) ) );%0A        performInstallation();%0A    %7D%0A%7D%0A

Implement DirectoryTest