use of org.apache.maven.plugins.dependency.testUtils.DependencyArtifactStubFactory in project maven-dependency-plugin by apache.
the class TestDestFileFilter method setUp.
protected void setUp() throws Exception {
super.setUp();
outputFolder = new File("target/markers/");
DependencyTestUtils.removeDirectory(outputFolder);
assertFalse(outputFolder.exists());
this.fact = new DependencyArtifactStubFactory(outputFolder, false);
artifacts = fact.getReleaseAndSnapshotArtifacts();
}
use of org.apache.maven.plugins.dependency.testUtils.DependencyArtifactStubFactory in project maven-dependency-plugin by apache.
the class TestResolveMarkerFileFilter method setUp.
protected void setUp() throws Exception {
super.setUp();
outputFolder = new File("target/markers/");
DependencyTestUtils.removeDirectory(outputFolder);
assertFalse(outputFolder.exists());
this.fact = new DependencyArtifactStubFactory(outputFolder, false);
artifacts = fact.getReleaseAndSnapshotArtifacts();
}
use of org.apache.maven.plugins.dependency.testUtils.DependencyArtifactStubFactory in project maven-plugins by apache.
the class TestMarkerFileFilter method testMarkerTimestamp.
public void testMarkerTimestamp() throws IOException, MojoExecutionException, ArtifactFilterException {
// filter includes release artifact because no marker present
// filter includes snapshot artifact becaues it is newer than marker
DependencyArtifactStubFactory fileFact = new DependencyArtifactStubFactory(outputFolder, true);
Artifact snap = fileFact.getSnapshotArtifact();
Artifact release = fileFact.getReleaseArtifact();
Set<Artifact> tempArtifacts = new HashSet<Artifact>();
tempArtifacts.add(snap);
tempArtifacts.add(release);
DefaultFileMarkerHandler handler = new DefaultFileMarkerHandler(snap, outputFolder);
handler.setMarker();
assertTrue(snap.getFile().setLastModified(snap.getFile().lastModified() + 1500));
MarkerFileFilter filter = new MarkerFileFilter(false, false, true, new DefaultFileMarkerHandler(outputFolder));
Set<Artifact> result = filter.filter(tempArtifacts);
assertEquals(2, result.size());
// update marker; filter won't include snapshot because timestamps equal
handler.setMarker();
result = filter.filter(tempArtifacts);
assertEquals(1, result.size());
// filter won't include snapshot because it is older than marker
assertTrue(snap.getFile().setLastModified(snap.getFile().lastModified() - 10000));
result = filter.filter(tempArtifacts);
assertEquals(1, result.size());
assertTrue(handler.clearMarker());
assertFalse(handler.isMarkerSet());
snap.getFile().delete();
release.getFile().delete();
DependencyTestUtils.removeDirectory(outputFolder);
assertFalse(outputFolder.exists());
}
use of org.apache.maven.plugins.dependency.testUtils.DependencyArtifactStubFactory in project maven-plugins by apache.
the class AbstractDependencyMojoTestCase method setUp.
protected void setUp(String testDirStr, boolean createFiles, boolean flattenedPath) throws Exception {
// required for mojo lookups to work
super.setUp();
testDir = new File(getBasedir(), "target" + File.separatorChar + "unit-tests" + File.separatorChar + testDirStr + File.separatorChar);
DependencyTestUtils.removeDirectory(testDir);
assertFalse(testDir.exists());
stubFactory = new DependencyArtifactStubFactory(this.testDir, createFiles, flattenedPath);
}
use of org.apache.maven.plugins.dependency.testUtils.DependencyArtifactStubFactory in project maven-plugins by apache.
the class TestUnpackMarkerFileHandler method setUp.
protected void setUp() throws Exception {
super.setUp();
testDir = new File(getBasedir(), "target" + File.separatorChar + "unit-tests" + File.separatorChar + "unpack-markers" + File.separatorChar);
DependencyTestUtils.removeDirectory(testDir);
assertFalse(testDir.exists());
stubFactory = new DependencyArtifactStubFactory(this.testDir, false);
Artifact artifact = stubFactory.createArtifact("test", "test", "1");
ArtifactItem artifactItem;
stubFactory.getArtifactItem(artifact);
artifactItems.add(stubFactory.getArtifactItem(stubFactory.createArtifact("test", "test", "1")));
artifact = stubFactory.createArtifact("test2", "test2", "2");
artifactItem = new ArtifactItem(artifact);
artifactItem.setIncludes("**/*.xml");
artifactItems.add(artifactItem);
artifact = stubFactory.createArtifact("test3", "test3", "3");
artifactItem = new ArtifactItem(artifact);
artifactItem.setExcludes("**/*.class");
artifactItems.add(artifactItem);
artifact = stubFactory.createArtifact("test4", "test4", "4");
artifactItem = new ArtifactItem(artifact);
artifactItem.setIncludes("**/*.xml");
artifactItem.setExcludes("**/*.class");
artifactItems.add(artifactItem);
outputFolder = new File("target/markers/");
DependencyTestUtils.removeDirectory(this.outputFolder);
assertFalse(outputFolder.exists());
}
Aggregations