Search in sources :

Example 1 with TrackingArchiver

use of org.codehaus.plexus.archiver.diags.TrackingArchiver in project maven-plugins by apache.

the class AssemblyProxyArchiverTest method addFileSet_SkipWhenSourceIsAssemblyWorkDir.

@Test(timeout = 5000)
public void addFileSet_SkipWhenSourceIsAssemblyWorkDir() throws IOException, ArchiverException {
    final File sources = fileManager.createTempDir();
    final File workdir = new File(sources, "workdir");
    final TrackingArchiver tracker = new TrackingArchiver();
    final AssemblyProxyArchiver archiver = new AssemblyProxyArchiver("", tracker, null, null, null, workdir, logger);
    archiver.setForced(true);
    final DefaultFileSet fs = new DefaultFileSet();
    fs.setDirectory(workdir);
    archiver.addFileSet(fs);
    assertTrue(tracker.added.isEmpty());
}
Also used : DefaultFileSet(org.codehaus.plexus.archiver.util.DefaultFileSet) File(java.io.File) TrackingArchiver(org.codehaus.plexus.archiver.diags.TrackingArchiver) Test(org.junit.Test)

Example 2 with TrackingArchiver

use of org.codehaus.plexus.archiver.diags.TrackingArchiver in project maven-plugins by apache.

the class AssemblyProxyArchiverTest method addFileSet_addExcludeWhenSourceContainsAssemblyWorkDir.

@Test(timeout = 5000)
public void addFileSet_addExcludeWhenSourceContainsAssemblyWorkDir() throws IOException, ArchiverException {
    final File sources = fileManager.createTempDir();
    final File workdir = new File(sources, "workdir");
    workdir.mkdir();
    fileManager.createFile(sources, "test-included.txt", "This is included");
    fileManager.createFile(workdir, "test-excluded.txt", "This is excluded");
    final TrackingArchiver tracker = new TrackingArchiver();
    final AssemblyProxyArchiver archiver = new AssemblyProxyArchiver("", tracker, null, null, null, workdir, logger);
    archiver.setForced(true);
    final DefaultFileSet fs = new DefaultFileSet();
    fs.setDirectory(sources);
    archiver.addFileSet(fs);
    assertEquals(1, tracker.added.size());
    final TrackingArchiver.Addition addition = tracker.added.get(0);
    assertNotNull(addition.excludes);
    assertEquals(1, addition.excludes.length);
    assertEquals(workdir.getName(), addition.excludes[0]);
}
Also used : DefaultFileSet(org.codehaus.plexus.archiver.util.DefaultFileSet) File(java.io.File) TrackingArchiver(org.codehaus.plexus.archiver.diags.TrackingArchiver) Test(org.junit.Test)

Aggregations

File (java.io.File)2 TrackingArchiver (org.codehaus.plexus.archiver.diags.TrackingArchiver)2 DefaultFileSet (org.codehaus.plexus.archiver.util.DefaultFileSet)2 Test (org.junit.Test)2