Search in sources :

Example 1 with RepoDescriptor

use of org.apache.ivy.osgi.repo.RepoDescriptor in project ant-ivy by apache.

the class UpdateSiteLoader method load.

public RepoDescriptor load(URI repoUri) throws IOException, ParseException, SAXException {
    if (!repoUri.toString().endsWith("/")) {
        try {
            repoUri = new URI(repoUri.toString() + "/");
        } catch (URISyntaxException e) {
            throw new RuntimeException("Cannot make an uri for the repo");
        }
    }
    Message.info("Loading the update site " + repoUri);
    // first look for a p2 repository
    RepoDescriptor repo = loadP2(repoUri);
    if (repo != null) {
        return repo;
    }
    Message.verbose("\tNo P2 artifacts, falling back on the old fashioned updatesite");
    // then try the old update site
    UpdateSite site = loadSite(repoUri);
    if (site == null) {
        return null;
    }
    repo = loadFromDigest(site);
    if (repo != null) {
        return repo;
    }
    return loadFromSite(site);
}
Also used : RepoDescriptor(org.apache.ivy.osgi.repo.RepoDescriptor) URISyntaxException(java.net.URISyntaxException) URI(java.net.URI) UpdateSite(org.apache.ivy.osgi.updatesite.xml.UpdateSite)

Example 2 with RepoDescriptor

use of org.apache.ivy.osgi.repo.RepoDescriptor in project ant-ivy by apache.

the class UpdateSiteLoaderTest method testComposite.

@Test
public void testComposite() throws Exception {
    RepoDescriptor site = loader.load(new File("test/test-p2/composite/").toURI());
    assertEquals(8, CollectionUtils.toList(site.getModules()).size());
    // check that the url of the artifact is correctly resolved
    String path = new File("test/test-p2/ivyde-repo/").toURI().toURL().toExternalForm();
    ModuleDescriptor md = site.getModules().next().getModuleDescriptor();
    assertTrue(md.getAllArtifacts()[0].getUrl().toExternalForm().startsWith(path));
}
Also used : ModuleDescriptor(org.apache.ivy.core.module.descriptor.ModuleDescriptor) RepoDescriptor(org.apache.ivy.osgi.repo.RepoDescriptor) File(java.io.File) Test(org.junit.Test)

Example 3 with RepoDescriptor

use of org.apache.ivy.osgi.repo.RepoDescriptor in project ant-ivy by apache.

the class UpdateSiteLoaderTest method testM2Eclipse.

@Test
public void testM2Eclipse() throws IOException, ParseException, SAXException, URISyntaxException {
    RepoDescriptor site = loader.load(new URI("http://download.eclipse.org/technology/m2e/releases/"));
    assertTrue(CollectionUtils.toList(site.getModules()).size() > 20);
}
Also used : RepoDescriptor(org.apache.ivy.osgi.repo.RepoDescriptor) URI(java.net.URI) Test(org.junit.Test)

Example 4 with RepoDescriptor

use of org.apache.ivy.osgi.repo.RepoDescriptor in project ant-ivy by apache.

the class UpdateSiteLoaderTest method testIvyDE.

@Test
public void testIvyDE() throws IOException, ParseException, SAXException, URISyntaxException {
    RepoDescriptor site = loader.load(new URI("http://www.apache.org/dist/ant/ivyde/updatesite/"));
    assertTrue(site.getModules().hasNext());
    Iterator<ModuleDescriptorWrapper> it = site.getModules();
    while (it.hasNext()) {
        String name = it.next().getModuleDescriptor().getModuleRevisionId().getName();
        assertTrue(name, name.startsWith("org.apache.ivy"));
    }
}
Also used : RepoDescriptor(org.apache.ivy.osgi.repo.RepoDescriptor) ModuleDescriptorWrapper(org.apache.ivy.osgi.repo.ModuleDescriptorWrapper) URI(java.net.URI) Test(org.junit.Test)

Example 5 with RepoDescriptor

use of org.apache.ivy.osgi.repo.RepoDescriptor in project ant-ivy by apache.

the class UpdateSiteLoaderTest method testHeliosEclipse.

@Ignore
@Test
public void testHeliosEclipse() throws IOException, ParseException, SAXException, URISyntaxException {
    RepoDescriptor site = loader.load(new URI("http://download.eclipse.org/releases/helios/"));
    assertTrue(CollectionUtils.toList(site.getModules()).size() > 900);
}
Also used : RepoDescriptor(org.apache.ivy.osgi.repo.RepoDescriptor) URI(java.net.URI) Ignore(org.junit.Ignore) Test(org.junit.Test)

Aggregations

RepoDescriptor (org.apache.ivy.osgi.repo.RepoDescriptor)6 URI (java.net.URI)5 Test (org.junit.Test)4 File (java.io.File)2 URISyntaxException (java.net.URISyntaxException)2 IOException (java.io.IOException)1 ParseException (java.text.ParseException)1 ArtifactOrigin (org.apache.ivy.core.cache.ArtifactOrigin)1 CacheResourceOptions (org.apache.ivy.core.cache.CacheResourceOptions)1 DownloadListener (org.apache.ivy.core.cache.DownloadListener)1 RepositoryCacheManager (org.apache.ivy.core.cache.RepositoryCacheManager)1 Artifact (org.apache.ivy.core.module.descriptor.Artifact)1 ModuleDescriptor (org.apache.ivy.core.module.descriptor.ModuleDescriptor)1 ArtifactDownloadReport (org.apache.ivy.core.report.ArtifactDownloadReport)1 ModuleDescriptorWrapper (org.apache.ivy.osgi.repo.ModuleDescriptorWrapper)1 UpdateSite (org.apache.ivy.osgi.updatesite.xml.UpdateSite)1 ResolvedResource (org.apache.ivy.plugins.resolver.util.ResolvedResource)1 Ignore (org.junit.Ignore)1 SAXException (org.xml.sax.SAXException)1