Search in sources :

Example 31 with AssemblyFileSet

use of org.eclipse.jkube.kit.common.AssemblyFileSet in project jkube by eclipse.

the class AssemblyFileSetUtilsTest method calculateFilePermissionsFileWithFileMode.

@Test
public void calculateFilePermissionsFileWithFileMode() throws Exception {
    // Given
    final AssemblyFileSet afs = AssemblyFileSet.builder().fileMode("0777").build();
    final File sourceFile = temp.newFile("source-file.txt");
    final File aFile = temp.newFile("just-a-file.txt");
    // When
    final List<AssemblyFileEntry> result = calculateFilePermissions(sourceFile, aFile, afs);
    // Then
    assertThat(result).hasSize(1).contains(new AssemblyFileEntry(sourceFile, aFile, "0777"));
}
Also used : AssemblyFileEntry(org.eclipse.jkube.kit.common.AssemblyFileEntry) AssemblyFileSet(org.eclipse.jkube.kit.common.AssemblyFileSet) File(java.io.File) Test(org.junit.Test)

Example 32 with AssemblyFileSet

use of org.eclipse.jkube.kit.common.AssemblyFileSet in project jkube by eclipse.

the class AssemblyFileSetUtilsTest method calculateFilePermissionsDirectoryAndNestedDirectoryWithDirectoryAndFileMode.

@Test
public void calculateFilePermissionsDirectoryAndNestedDirectoryWithDirectoryAndFileMode() throws Exception {
    // Given
    final AssemblyFileSet afs = AssemblyFileSet.builder().directoryMode("040775").fileMode("0755").build();
    final File sourceDirectory = temp.newFolder("source-directory");
    final File sourceSubdirectory = new File(sourceDirectory, "subdirectory");
    FileUtils.forceMkdir(sourceSubdirectory);
    final File aDirectory = temp.newFolder("just-a-directory");
    final File aSubdirectory = new File(aDirectory, "subdirectory");
    FileUtils.forceMkdir(aSubdirectory);
    // When
    final List<AssemblyFileEntry> result = calculateFilePermissions(sourceDirectory, aDirectory, afs);
    // Then
    assertThat(result).hasSize(2).containsExactlyInAnyOrder(new AssemblyFileEntry(sourceDirectory, aDirectory, "040775"), new AssemblyFileEntry(sourceSubdirectory, aSubdirectory, "040775"));
}
Also used : AssemblyFileEntry(org.eclipse.jkube.kit.common.AssemblyFileEntry) AssemblyFileSet(org.eclipse.jkube.kit.common.AssemblyFileSet) File(java.io.File) Test(org.junit.Test)

Example 33 with AssemblyFileSet

use of org.eclipse.jkube.kit.common.AssemblyFileSet in project jkube by eclipse.

the class AssemblyFileSetUtilsTest method calculateFilePermissionsDirectoryWithNoDirectoryMode.

@Test
public void calculateFilePermissionsDirectoryWithNoDirectoryMode() throws Exception {
    // Given
    final AssemblyFileSet afs = AssemblyFileSet.builder().build();
    final File sourceDirectory = temp.newFile("source-directory");
    final File aDirectory = temp.newFolder("just-a-directory");
    // When
    final List<AssemblyFileEntry> result = calculateFilePermissions(sourceDirectory, aDirectory, afs);
    // Then
    assertThat(result).hasSize(1).contains(new AssemblyFileEntry(sourceDirectory, aDirectory, "040755"));
}
Also used : AssemblyFileEntry(org.eclipse.jkube.kit.common.AssemblyFileEntry) AssemblyFileSet(org.eclipse.jkube.kit.common.AssemblyFileSet) File(java.io.File) Test(org.junit.Test)

Aggregations

AssemblyFileSet (org.eclipse.jkube.kit.common.AssemblyFileSet)33 Test (org.junit.Test)30 File (java.io.File)26 AssemblyFileEntry (org.eclipse.jkube.kit.common.AssemblyFileEntry)21 AssemblyFileSetUtils.processAssemblyFileSet (org.eclipse.jkube.kit.common.archive.AssemblyFileSetUtils.processAssemblyFileSet)19 Assembly (org.eclipse.jkube.kit.common.Assembly)18 AssemblyConfiguration (org.eclipse.jkube.kit.common.AssemblyConfiguration)18 Path (java.nio.file.Path)6 HashMap (java.util.HashMap)2 Nonnull (javax.annotation.Nonnull)2 GeneratorContext (org.eclipse.jkube.generator.api.GeneratorContext)2 IOException (java.io.IOException)1 FileSystems (java.nio.file.FileSystems)1 Files (java.nio.file.Files)1 PathMatcher (java.nio.file.PathMatcher)1 ArrayList (java.util.ArrayList)1 Collections (java.util.Collections)1 LinkedHashSet (java.util.LinkedHashSet)1 List (java.util.List)1 Objects (java.util.Objects)1