Search in sources :

Example 71 with ResolveReport

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

the class ResolveTest method testResolveForceAfterDependencyExist.

/**
 * Test case for IVY-193.
 *
 * @throws Exception if something goes wrong
 * @see <a href="https://issues.apache.org/jira/browse/IVY-193">IVY-193</a>
 */
@Test
public void testResolveForceAfterDependencyExist() throws Exception {
    // mod4.1 v 4.10 depends on
    // - mod3.1 v 1.0.1 which depends on mod1.2 v 2.0 and forces it
    // - mod3.2 v 1.2 which depends on mod1.2 v 2.1 and on mod3.1 v1.0.1
    ResolveReport report = ivy.resolve(new File("test/repositories/2/mod4.1/ivy-4.10.xml"), getResolveOptions(new String[] { "*" }));
    assertNotNull(report);
    // dependencies
    assertFalse(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar").exists());
    assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.2", "2.1")).exists());
    assertTrue(getArchiveFileInCache("org1", "mod1.2", "2.1", "mod1.2", "jar", "jar").exists());
}
Also used : ConfigurationResolveReport(org.apache.ivy.core.report.ConfigurationResolveReport) ResolveReport(org.apache.ivy.core.report.ResolveReport) JarFile(java.util.jar.JarFile) File(java.io.File) Test(org.junit.Test)

Example 72 with ResolveReport

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

the class ResolveTest method testDisableTransitivityPerConfiguration4.

@Test
public void testDisableTransitivityPerConfiguration4() throws Exception {
    // mod2.2 (A,B,compile) depends on mod 2.1 (A->runtime;B->compile)
    // compile is not transitive and extends A and B
    // 
    // mod2.1 (compile, runtime) depends on mod1.1 which depends on mod1.2
    // compile conf is not transitive and extends runtime
    ResolveReport r = ivy.resolve(new File("test/repositories/1/org2/mod2.2/ivys/ivy-0.6.xml"), getResolveOptions(new String[] { "*" }));
    assertFalse(r.hasError());
    // here we should get all three recursive dependencies
    assertEquals(new HashSet<>(Arrays.asList(ModuleRevisionId.newInstance("org2", "mod2.1", "0.3.2"), ModuleRevisionId.newInstance("org1", "mod1.1", "1.0"), ModuleRevisionId.newInstance("org1", "mod1.2", "2.0"))), r.getConfigurationReport("A").getModuleRevisionIds());
    // here we should get only mod2.1 and mod1.1 cause compile is not transitive in mod2.1
    assertEquals(new HashSet<>(Arrays.asList(ModuleRevisionId.newInstance("org2", "mod2.1", "0.3.2"), ModuleRevisionId.newInstance("org1", "mod1.1", "1.0"))), r.getConfigurationReport("B").getModuleRevisionIds());
    // here we should get only mod2.1 cause compile is not transitive
    assertEquals(Collections.singleton(ModuleRevisionId.newInstance("org2", "mod2.1", "0.3.2")), r.getConfigurationReport("compile").getModuleRevisionIds());
}
Also used : ConfigurationResolveReport(org.apache.ivy.core.report.ConfigurationResolveReport) ResolveReport(org.apache.ivy.core.report.ResolveReport) JarFile(java.util.jar.JarFile) File(java.io.File) Test(org.junit.Test)

Example 73 with ResolveReport

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

the class ResolveTest method testBranches1.

@Test
public void testBranches1() throws Exception {
    Ivy ivy = new Ivy();
    ivy.configure(new File("test/repositories/branches/ivysettings.xml"));
    ResolveReport report = ivy.resolve(new File("test/repositories/branches/bar/bar1/trunk/1/ivy.xml"), getResolveOptions(new String[] { "*" }).setValidate(false));
    assertFalse(report.hasError());
    assertTrue(getArchiveFileInCache(ivy, "foo#foo1#trunk;3", "foo1", "jar", "jar").exists());
}
Also used : ConfigurationResolveReport(org.apache.ivy.core.report.ConfigurationResolveReport) ResolveReport(org.apache.ivy.core.report.ResolveReport) Ivy(org.apache.ivy.Ivy) JarFile(java.util.jar.JarFile) File(java.io.File) Test(org.junit.Test)

Example 74 with ResolveReport

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

the class ResolveTest method testEvictWithConf3.

/**
 * Test case for IVY-681.
 *
 * @throws Exception if something goes wrong
 * @see <a href="https://issues.apache.org/jira/browse/IVY-681">IVY-681</a>
 */
@Test
public void testEvictWithConf3() throws Exception {
    // same as first one but the conf requested in evicted module is no longer present in
    // selected revision
    // mod6.1 r1.4 depends on
    // mod5.1 r4.3 conf A
    // mod5.2 r1.0 which depends on mod5.1 r4.0 conf B
    // 
    // mod5.1 r4.3 has only conf A, not B
    ResolveReport report = ivy.resolve(new File("test/repositories/2/mod6.1/ivy-1.4.xml"), getResolveOptions(new String[] { "*" }));
    assertFalse(report.hasError());
    // dependencies
    assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("org5", "mod5.1", "4.3")).exists());
    assertTrue(getArchiveFileInCache("org5", "mod5.1", "4.3", "art51A", "jar", "jar").exists());
    assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("org5", "mod5.2", "1.0")).exists());
    assertTrue(getArchiveFileInCache("org5", "mod5.2", "1.0", "mod5.2", "jar", "jar").exists());
    assertFalse(getArchiveFileInCache("org5", "mod5.1", "4.0", "art51A", "jar", "jar").exists());
    assertFalse(getArchiveFileInCache("org5", "mod5.1", "4.0", "art51B", "jar", "jar").exists());
}
Also used : ConfigurationResolveReport(org.apache.ivy.core.report.ConfigurationResolveReport) ResolveReport(org.apache.ivy.core.report.ResolveReport) JarFile(java.util.jar.JarFile) File(java.io.File) Test(org.junit.Test)

Example 75 with ResolveReport

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

the class ResolveTest method testResolveMaven2WithConflict.

@Test
public void testResolveMaven2WithConflict() throws Exception {
    Ivy ivy = new Ivy();
    ivy.configure(new File("test/repositories/m2/ivysettings.xml"));
    ResolveReport report = ivy.resolve(new File("test/repositories/m2/org/apache/test3/1.1/test3-1.1.pom"), getResolveOptions(new String[] { "default" }));
    assertFalse(report.hasError());
    assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("org.apache", "test2", "1.1")).exists());
    assertTrue(getArchiveFileInCache(ivy, "org.apache", "test2", "1.1", "test2", "jar", "jar").exists());
    assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("org.apache", "test", "1.1")).exists());
    assertTrue(getArchiveFileInCache(ivy, "org.apache", "test", "1.1", "test", "jar", "jar").exists());
    assertContainsArtifact(report.getConfigurationReport("default"), getArtifact("org.apache", "test2", "1.1", "test2", "jar", "jar"));
    assertContainsArtifact(report.getConfigurationReport("default"), getArtifact("org.apache", "test", "1.1", "test", "jar", "jar"));
}
Also used : ConfigurationResolveReport(org.apache.ivy.core.report.ConfigurationResolveReport) ResolveReport(org.apache.ivy.core.report.ResolveReport) Ivy(org.apache.ivy.Ivy) JarFile(java.util.jar.JarFile) 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