/*
 * Copyright 2014 Red Hat, Inc..
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.fedoraproject.xmvn.tools.install.impl;

import static org.junit.Assert.assertEquals;

import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.Files;
import org.junit.Test;

/**
 *
 * @author Michael Simacek
 */
public class SymbolicLinkTest extends AbstractFileTest {
    @Test
    public void testSymlink() throws Exception {
        Path jar = getResource( "example.jar" );
        add( new Directory( Paths.get( "usr/share/java" )));
        add( new RegularFile( Paths.get( "usr/share/java/foobar.jar" ), jar ) );
        add( new SymbolicLink( Paths.get( "usr/share/java/link.jar" ), Paths.get( "foobar.jar" ) ) );
        Path root = performInstallation();
        assertDirectoryStructure( "D /usr", "D /usr/share", "D /usr/share/java",
                "F /usr/share/java/foobar.jar", "L /usr/share/java/link.jar" );
        Path link = root.resolve( Paths.get( "usr/share/java/link.jar" ) );
        assertEquals( Files.readSymbolicLink(link), Paths.get( "foobar.jar" ) );
    }
}

@@ -1600,21 +1600,268 @@
 ar.jar%22 ) );
+%0A%0A        assertDescriptorEquals( %22%25attr(0755,root,root) %25dir /usr/share/java%22,%0A                                %22%25attr(0644,root,root) /usr/share/java/foobar.jar%22,%0A                                %22%25attr(0644,root,root) /usr/share/java/link.jar%22 );
 %0A    %7D%0A%7D%0A

Add descriptor assertions to SymbolicLinkTest