Search in sources :

Example 6 with ResolveReport

use of org.apache.ivy.core.report.ResolveReport in project ant-ivy by apache.

the class IvyPostResolveTaskTest method testWithResolveIdAndPreviousResolveInSameBuildAndWildcard.

@Test
public void testWithResolveIdAndPreviousResolveInSameBuildAndWildcard() {
    IvyResolve resolve = new IvyResolve();
    resolve.setProject(project);
    resolve.setFile(new File("test/java/org/apache/ivy/ant/ivy-multiconf.xml"));
    resolve.setConf("*");
    resolve.setResolveId("testResolveId");
    resolve.execute();
    ResolveReport report1 = project.getReference("ivy.resolved.report.testResolveId");
    // perform another resolve
    resolve = new IvyResolve();
    resolve.setProject(project);
    resolve.setFile(new File("test/java/org/apache/ivy/ant/ivy-simple.xml"));
    resolve.setConf("*");
    resolve.execute();
    ResolveReport reportBefore = project.getReference("ivy.resolved.report");
    task.setConf("default");
    task.setResolveId("testResolveId");
    task.execute();
    ResolveReport reportAfter = project.getReference("ivy.resolved.report");
    ResolveReport report2 = project.getReference("ivy.resolved.report.testResolveId");
    assertSame("IvyPostResolveTask has performed a resolve where it shouldn't", reportBefore, reportAfter);
    assertSame("IvyPostResolveTask has performed a resolve where it shouldn't", report1, report2);
}
Also used : ResolveReport(org.apache.ivy.core.report.ResolveReport) File(java.io.File) Test(org.junit.Test)

Example 7 with ResolveReport

use of org.apache.ivy.core.report.ResolveReport in project ant-ivy by apache.

the class IvyPostResolveTaskTest method testWithPreviousResolveInSameBuildAndMoreConfs.

@Test
public void testWithPreviousResolveInSameBuildAndMoreConfs() {
    IvyResolve resolve = new IvyResolve();
    resolve.setProject(project);
    resolve.setFile(new File("test/java/org/apache/ivy/ant/ivy-multiconf.xml"));
    resolve.setConf("compile");
    resolve.execute();
    ResolveReport reportBefore = project.getReference("ivy.resolved.report");
    assertTrue(getArchiveFileInCache("org1", "mod1.1", "2.0", "mod1.1", "jar", "jar").exists());
    assertFalse(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar").exists());
    task.setConf("*");
    task.execute();
    ResolveReport reportAfter = project.getReference("ivy.resolved.report");
    assertNotSame("IvyPostResolveTask hasn't performed a resolve where it should have", reportBefore, reportAfter);
    assertTrue(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar").exists());
}
Also used : ResolveReport(org.apache.ivy.core.report.ResolveReport) File(java.io.File) Test(org.junit.Test)

Example 8 with ResolveReport

use of org.apache.ivy.core.report.ResolveReport in project ant-ivy by apache.

the class IvyPostResolveTaskTest method testWithPreviousResolveInSameBuildAndSameConfs.

@Test
public void testWithPreviousResolveInSameBuildAndSameConfs() {
    IvyResolve resolve = new IvyResolve();
    resolve.setProject(project);
    resolve.setFile(new File("test/java/org/apache/ivy/ant/ivy-multiconf.xml"));
    resolve.setConf("default");
    resolve.execute();
    ResolveReport reportBefore = project.getReference("ivy.resolved.report");
    task.setConf("default");
    task.execute();
    ResolveReport reportAfter = project.getReference("ivy.resolved.report");
    assertSame("IvyPostResolveTask has performed a resolve where it shouldn't", reportBefore, reportAfter);
}
Also used : ResolveReport(org.apache.ivy.core.report.ResolveReport) File(java.io.File) Test(org.junit.Test)

Example 9 with ResolveReport

use of org.apache.ivy.core.report.ResolveReport in project ant-ivy by apache.

the class IvyPostResolveTaskTest method testWithResolveIdAndPreviousResolveInSameBuildAndSameConfs.

@Test
public void testWithResolveIdAndPreviousResolveInSameBuildAndSameConfs() {
    IvyResolve resolve = new IvyResolve();
    resolve.setProject(project);
    resolve.setFile(new File("test/java/org/apache/ivy/ant/ivy-multiconf.xml"));
    resolve.setConf("default");
    resolve.setResolveId("testResolveId");
    resolve.execute();
    ResolveReport report1 = project.getReference("ivy.resolved.report.testResolveId");
    // perform another resolve
    resolve = new IvyResolve();
    resolve.setProject(project);
    resolve.setFile(new File("test/java/org/apache/ivy/ant/ivy-simple.xml"));
    resolve.setConf("*");
    resolve.execute();
    ResolveReport reportBefore = project.getReference("ivy.resolved.report");
    task.setConf("default");
    task.setResolveId("testResolveId");
    task.execute();
    ResolveReport reportAfter = project.getReference("ivy.resolved.report");
    ResolveReport report2 = project.getReference("ivy.resolved.report.testResolveId");
    assertSame("IvyPostResolveTask has performed a resolve where it shouldn't", reportBefore, reportAfter);
    assertSame("IvyPostResolveTask has performed a resolve where it shouldn't", report1, report2);
}
Also used : ResolveReport(org.apache.ivy.core.report.ResolveReport) File(java.io.File) Test(org.junit.Test)

Example 10 with ResolveReport

use of org.apache.ivy.core.report.ResolveReport in project ant-ivy by apache.

the class IvyPostResolveTaskTest method testWithPreviousResolveInSameBuildAndBothWildcard.

@Test
public void testWithPreviousResolveInSameBuildAndBothWildcard() {
    IvyResolve resolve = new IvyResolve();
    resolve.setProject(project);
    resolve.setFile(new File("test/java/org/apache/ivy/ant/ivy-multiconf.xml"));
    resolve.setConf("*");
    resolve.execute();
    ResolveReport reportBefore = project.getReference("ivy.resolved.report");
    task.setConf("*");
    task.execute();
    ResolveReport reportAfter = project.getReference("ivy.resolved.report");
    assertSame("IvyPostResolveTask has performed a resolve where it shouldn't", reportBefore, reportAfter);
}
Also used : ResolveReport(org.apache.ivy.core.report.ResolveReport) File(java.io.File) Test(org.junit.Test)

Aggregations

ResolveReport (org.apache.ivy.core.report.ResolveReport)278 Test (org.junit.Test)259 File (java.io.File)253 ConfigurationResolveReport (org.apache.ivy.core.report.ConfigurationResolveReport)218 JarFile (java.util.jar.JarFile)199 Ivy (org.apache.ivy.Ivy)102 ModuleRevisionId (org.apache.ivy.core.module.id.ModuleRevisionId)101 ModuleDescriptor (org.apache.ivy.core.module.descriptor.ModuleDescriptor)94 ArtifactDownloadReport (org.apache.ivy.core.report.ArtifactDownloadReport)15 ResolveOptions (org.apache.ivy.core.resolve.ResolveOptions)13 BuildException (org.apache.tools.ant.BuildException)9 URL (java.net.URL)8 HashMap (java.util.HashMap)8 DefaultModuleDescriptor (org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor)8 DefaultRepositoryCacheManager (org.apache.ivy.core.cache.DefaultRepositoryCacheManager)7 Artifact (org.apache.ivy.core.module.descriptor.Artifact)7 DefaultArtifact (org.apache.ivy.core.module.descriptor.DefaultArtifact)7 IOException (java.io.IOException)6 ArrayList (java.util.ArrayList)6 DependencyDescriptor (org.apache.ivy.core.module.descriptor.DependencyDescriptor)6