Search in sources :

Example 1 with DefaultMessageLogger

use of org.apache.ivy.util.DefaultMessageLogger in project ant-ivy by apache.

the class XmlModuleDescriptorParserTest method testExtendsAll.

@Test
public void testExtendsAll() throws Exception {
    Message.setDefaultLogger(new DefaultMessageLogger(99));
    // default extends type is 'all' when no extendsType attribute is specified.
    ModuleDescriptor md = XmlModuleDescriptorParser.getInstance().parseDescriptor(settings, getClass().getResource("test-extends-all.xml"), true);
    assertNotNull(md);
    assertEquals("myorg", md.getModuleRevisionId().getOrganisation());
    assertEquals("mymodule", md.getModuleRevisionId().getName());
    assertEquals("myrev", md.getModuleRevisionId().getRevision());
    assertEquals("integration", md.getStatus());
    // verify that the parent description was merged.
    assertEquals("Parent module description.", md.getDescription());
    // verify that the parent and child configurations were merged together.
    final Configuration[] expectedConfs = { new Configuration("default"), new Configuration("conf1"), new Configuration("conf2") };
    assertNotNull(md.getConfigurations());
    assertEquals(Arrays.asList(expectedConfs), Arrays.asList(md.getConfigurations()));
    // verify parent and child dependencies were merged together.
    DependencyDescriptor[] deps = md.getDependencies();
    assertNotNull(deps);
    assertEquals(2, deps.length);
    assertEquals(Collections.singletonList("default"), Arrays.asList(deps[0].getModuleConfigurations()));
    ModuleRevisionId dep = deps[0].getDependencyRevisionId();
    assertEquals("myorg", dep.getModuleId().getOrganisation());
    assertEquals("mymodule1", dep.getModuleId().getName());
    assertEquals("1.0", dep.getRevision());
    assertEquals(Arrays.asList("conf1", "conf2"), Arrays.asList(deps[1].getModuleConfigurations()));
    dep = deps[1].getDependencyRevisionId();
    assertEquals("myorg", dep.getModuleId().getOrganisation());
    assertEquals("mymodule2", dep.getModuleId().getName());
    assertEquals("2.0", dep.getRevision());
    // verify only child publications are present
    Artifact[] artifacts = md.getAllArtifacts();
    assertNotNull(artifacts);
    assertEquals(1, artifacts.length);
    assertEquals("mymodule", artifacts[0].getName());
    assertEquals("jar", artifacts[0].getType());
}
Also used : ModuleDescriptor(org.apache.ivy.core.module.descriptor.ModuleDescriptor) Configuration(org.apache.ivy.core.module.descriptor.Configuration) DependencyDescriptor(org.apache.ivy.core.module.descriptor.DependencyDescriptor) DefaultDependencyDescriptor(org.apache.ivy.core.module.descriptor.DefaultDependencyDescriptor) DefaultMessageLogger(org.apache.ivy.util.DefaultMessageLogger) ModuleRevisionId(org.apache.ivy.core.module.id.ModuleRevisionId) Artifact(org.apache.ivy.core.module.descriptor.Artifact) Test(org.junit.Test)

Example 2 with DefaultMessageLogger

use of org.apache.ivy.util.DefaultMessageLogger in project ant-ivy by apache.

the class XmlModuleDescriptorParserTest method setUp.

@Before
public void setUp() {
    Message.setDefaultLogger(new DefaultMessageLogger(Message.MSG_WARN));
    this.settings = new IvySettings();
    // prevent test from polluting local cache
    settings.setDefaultCache(new File("build/cache"));
}
Also used : DefaultMessageLogger(org.apache.ivy.util.DefaultMessageLogger) IvySettings(org.apache.ivy.core.settings.IvySettings) File(java.io.File) Before(org.junit.Before)

Example 3 with DefaultMessageLogger

use of org.apache.ivy.util.DefaultMessageLogger in project ant-ivy by apache.

the class DefaultRepositoryCacheManagerTest method setUp.

@Before
public void setUp() throws Exception {
    File f = File.createTempFile("ivycache", ".dir");
    ivy = new Ivy();
    ivy.configureDefault();
    ivy.getLoggerEngine().setDefaultLogger(new DefaultMessageLogger(Message.MSG_DEBUG));
    IvyContext.pushNewContext().setIvy(ivy);
    IvySettings settings = ivy.getSettings();
    // we want to use the file as a directory, so we delete the file itself
    f.delete();
    cacheManager = new DefaultRepositoryCacheManager();
    cacheManager.setSettings(settings);
    cacheManager.setBasedir(f);
    artifact = createArtifact("org", "module", "rev", "name", "type", "ext");
    Artifact originArtifact = createArtifact("org", "module", "rev", "name", "pom.original", "pom");
    origin = new ArtifactOrigin(originArtifact, true, "file:/some/where.pom");
    cacheManager.saveArtifactOrigin(originArtifact, origin);
    cacheManager.saveArtifactOrigin(artifact, origin);
}
Also used : DefaultMessageLogger(org.apache.ivy.util.DefaultMessageLogger) IvySettings(org.apache.ivy.core.settings.IvySettings) File(java.io.File) Ivy(org.apache.ivy.Ivy) Artifact(org.apache.ivy.core.module.descriptor.Artifact) DefaultArtifact(org.apache.ivy.core.module.descriptor.DefaultArtifact) Before(org.junit.Before)

Example 4 with DefaultMessageLogger

use of org.apache.ivy.util.DefaultMessageLogger in project ant-ivy by apache.

the class RetrieveTest method setUp.

@Before
public void setUp() throws Exception {
    ivy = Ivy.newInstance();
    ivy.configure(new File("test/repositories/ivysettings.xml"));
    TestHelper.createCache();
    Message.setDefaultLogger(new DefaultMessageLogger(Message.MSG_INFO));
}
Also used : DefaultMessageLogger(org.apache.ivy.util.DefaultMessageLogger) File(java.io.File) Before(org.junit.Before)

Example 5 with DefaultMessageLogger

use of org.apache.ivy.util.DefaultMessageLogger in project ant-ivy by apache.

the class OSGiManifestParserTest method setUp.

@Before
public void setUp() {
    Message.setDefaultLogger(new DefaultMessageLogger(Message.MSG_WARN));
    settings = new IvySettings();
    // prevent test from polluting local cache
    settings.setDefaultCache(new File("build/cache"));
}
Also used : DefaultMessageLogger(org.apache.ivy.util.DefaultMessageLogger) IvySettings(org.apache.ivy.core.settings.IvySettings) File(java.io.File) Before(org.junit.Before)

Aggregations

DefaultMessageLogger (org.apache.ivy.util.DefaultMessageLogger)7 Before (org.junit.Before)6 File (java.io.File)5 IvySettings (org.apache.ivy.core.settings.IvySettings)4 Artifact (org.apache.ivy.core.module.descriptor.Artifact)2 Ivy (org.apache.ivy.Ivy)1 EventManager (org.apache.ivy.core.event.EventManager)1 Configuration (org.apache.ivy.core.module.descriptor.Configuration)1 DefaultArtifact (org.apache.ivy.core.module.descriptor.DefaultArtifact)1 DefaultDependencyDescriptor (org.apache.ivy.core.module.descriptor.DefaultDependencyDescriptor)1 DependencyDescriptor (org.apache.ivy.core.module.descriptor.DependencyDescriptor)1 ModuleDescriptor (org.apache.ivy.core.module.descriptor.ModuleDescriptor)1 ModuleRevisionId (org.apache.ivy.core.module.id.ModuleRevisionId)1 ResolveData (org.apache.ivy.core.resolve.ResolveData)1 ResolveEngine (org.apache.ivy.core.resolve.ResolveEngine)1 ResolveOptions (org.apache.ivy.core.resolve.ResolveOptions)1 SortEngine (org.apache.ivy.core.sort.SortEngine)1 Test (org.junit.Test)1