ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hi...@apache.org
Subject svn commit: r1165100 [2/4] - in /ant/ivy/core/trunk: src/java/org/apache/ivy/ant/ src/java/org/apache/ivy/osgi/core/ src/java/org/apache/ivy/osgi/obr/ src/java/org/apache/ivy/osgi/obr/xml/ src/java/org/apache/ivy/osgi/p2/ src/java/org/apache/ivy/osgi/r...
Date Sun, 04 Sep 2011 19:37:05 GMT
Added: ant/ivy/core/trunk/test/java/org/apache/ivy/osgi/updatesite/UpdateSiteResolverTest.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/osgi/updatesite/UpdateSiteResolverTest.java?rev=1165100&view=auto
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/osgi/updatesite/UpdateSiteResolverTest.java
(added)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/osgi/updatesite/UpdateSiteResolverTest.java
Sun Sep  4 19:37:03 2011
@@ -0,0 +1,131 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+package org.apache.ivy.osgi.updatesite;
+
+import java.io.File;
+import java.text.ParseException;
+
+import junit.framework.TestCase;
+
+import org.apache.ivy.Ivy;
+import org.apache.ivy.core.cache.RepositoryCacheManager;
+import org.apache.ivy.core.module.descriptor.Artifact;
+import org.apache.ivy.core.module.descriptor.DefaultDependencyDescriptor;
+import org.apache.ivy.core.module.id.ModuleRevisionId;
+import org.apache.ivy.core.report.ArtifactDownloadReport;
+import org.apache.ivy.core.report.DownloadReport;
+import org.apache.ivy.core.report.DownloadStatus;
+import org.apache.ivy.core.resolve.DownloadOptions;
+import org.apache.ivy.core.resolve.ResolveData;
+import org.apache.ivy.core.resolve.ResolveOptions;
+import org.apache.ivy.core.resolve.ResolvedModuleRevision;
+import org.apache.ivy.core.search.ModuleEntry;
+import org.apache.ivy.core.search.OrganisationEntry;
+import org.apache.ivy.core.settings.IvySettings;
+import org.apache.ivy.osgi.core.BundleInfoAdapter;
+import org.apache.ivy.plugins.resolver.DependencyResolver;
+
+public class UpdateSiteResolverTest extends TestCase {
+
+    private IvySettings settings;
+
+    private UpdateSiteResolver resolver;
+
+    private File cache;
+
+    private Ivy ivy;
+
+    private ResolveData data;
+
+    public void setUp() throws Exception {
+        settings = new IvySettings();
+
+        resolver = new UpdateSiteResolver();
+        resolver.setName("ivyde-repo");
+        resolver.setUrl(new File("test/test-p2/ivyde-repo").toURL().toExternalForm());
+        resolver.setSettings(settings);
+        settings.addResolver(resolver);
+
+        settings.setDefaultResolver("ivyde-repo");
+
+        cache = new File("build/cache");
+        cache.mkdirs();
+        settings.setDefaultCache(cache);
+
+        ivy = new Ivy();
+        ivy.setSettings(settings);
+        ivy.bind();
+
+        ivy.getResolutionCacheManager().clean();
+        RepositoryCacheManager[] caches = settings.getRepositoryCacheManagers();
+        for (int i = 0; i < caches.length; i++) {
+            caches[i].clean();
+        }
+
+        data = new ResolveData(ivy.getResolveEngine(), new ResolveOptions());
+    }
+
+    public void testListOrganization() throws Exception {
+        OrganisationEntry[] orgs = resolver.listOrganisations();
+        assertEquals(1, orgs.length);
+        assertEquals("", orgs[0].getOrganisation());
+    }
+
+    public void testListModules() throws Exception {
+        ModuleEntry[] modules = resolver.listModules(new OrganisationEntry(resolver, ""));
+        assertEquals(7, modules.length);
+    }
+
+    private void genericTestResolveDownload(DependencyResolver resolver, ModuleRevisionId
mrid)
+            throws ParseException {
+        ResolvedModuleRevision rmr = resolver.getDependency(new DefaultDependencyDescriptor(mrid,
+                false), data);
+        assertNotNull(rmr);
+        assertEquals(mrid, rmr.getId());
+
+        Artifact artifact = rmr.getDescriptor().getAllArtifacts()[0];
+        DownloadReport report = resolver.download(new Artifact[] {artifact}, new DownloadOptions());
+        assertNotNull(report);
+
+        assertEquals(1, report.getArtifactsReports().length);
+
+        ArtifactDownloadReport ar = report.getArtifactReport(artifact);
+        assertNotNull(ar);
+
+        assertEquals(artifact, ar.getArtifact());
+        assertEquals(DownloadStatus.SUCCESSFUL, ar.getDownloadStatus());
+
+        // test to ask to download again, should use cache
+        report = resolver.download(new Artifact[] {artifact}, new DownloadOptions());
+        assertNotNull(report);
+
+        assertEquals(1, report.getArtifactsReports().length);
+
+        ar = report.getArtifactReport(artifact);
+        assertNotNull(ar);
+
+        assertEquals(artifact, ar.getArtifact());
+        assertEquals(DownloadStatus.NO, ar.getDownloadStatus());
+    }
+
+    public void testResolve() throws Exception {
+        ModuleRevisionId mrid = ModuleRevisionId.newInstance("", "org.apache.ivy",
+            "2.0.0.final_20090108225011", BundleInfoAdapter.OSGI_BUNDLE);
+        genericTestResolveDownload(resolver, mrid);
+    }
+}

Propchange: ant/ivy/core/trunk/test/java/org/apache/ivy/osgi/updatesite/UpdateSiteResolverTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ant/ivy/core/trunk/test/java/org/apache/ivy/osgi/updatesite/UpdateSiteResolverTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: ant/ivy/core/trunk/test/java/org/apache/ivy/osgi/updatesite/UpdateSiteResolverTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: ant/ivy/core/trunk/test/test-p2/ivyde-repo/artifacts.xml
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/test-p2/ivyde-repo/artifacts.xml?rev=1165100&view=auto
==============================================================================
--- ant/ivy/core/trunk/test/test-p2/ivyde-repo/artifacts.xml (added)
+++ ant/ivy/core/trunk/test/test-p2/ivyde-repo/artifacts.xml Sun Sep  4 19:37:03 2011
@@ -0,0 +1,129 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<?artifactRepository version='1.1.0'?>
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one
+   or more contributor license agreements.  See the NOTICE file
+   distributed with this work for additional information
+   regarding copyright ownership.  The ASF licenses this file
+   to you under the Apache License, Version 2.0 (the
+   "License"); you may not use this file except in compliance
+   with the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing,
+   software distributed under the License is distributed on an
+   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+   KIND, either express or implied.  See the License for the
+   specific language governing permissions and limitations
+   under the License.    
+-->
+<repository name='Test repo of IvyDE (artifacts)' type='org.eclipse.equinox.p2.artifact.repository.simpleRepository'
version='1'>
+  <properties size='2'>
+    <property name='p2.timestamp' value='1311544192362'/>
+    <property name='p2.compressed' value='false'/>
+  </properties>
+  <mappings size='3'>
+    <rule filter='(&amp; (classifier=osgi.bundle))' output='${repoUrl}/plugins/${id}_${version}.jar'/>
+    <rule filter='(&amp; (classifier=binary))' output='${repoUrl}/binary/${id}_${version}'/>
+    <rule filter='(&amp; (classifier=org.eclipse.update.feature))' output='${repoUrl}/features/${id}_${version}.jar'/>
+  </mappings>
+  <artifacts size='13'>
+    <artifact classifier='osgi.bundle' id='org.apache.ivyde.eclipse' version='2.0.0.final-200907011148-RELEASE'>
+      <properties size='3'>
+        <property name='artifact.size' value='2916005'/>
+        <property name='download.size' value='2916005'/>
+        <property name='download.md5' value='f9e5813d7930dc765a9531b73e0fdb86'/>
+      </properties>
+    </artifact>
+    <artifact classifier='org.eclipse.update.feature' id='org.apache.ivyde.feature' version='2.1.0.201008101807-RELEASE'>
+      <properties size='4'>
+        <property name='artifact.size' value='6342'/>
+        <property name='download.size' value='6342'/>
+        <property name='download.md5' value='eb75f985353313dabdc7e7a77df30f62'/>
+        <property name='download.contentType' value='application/zip'/>
+      </properties>
+    </artifact>
+    <artifact classifier='org.eclipse.update.feature' id='org.apache.ivy.feature' version='2.1.0.final_20090925235825'>
+      <properties size='4'>
+        <property name='artifact.size' value='6131'/>
+        <property name='download.size' value='6131'/>
+        <property name='download.md5' value='d6acc824b248674a1cdaa4083622c033'/>
+        <property name='download.contentType' value='application/zip'/>
+      </properties>
+    </artifact>
+    <artifact classifier='osgi.bundle' id='org.apache.ivy.eclipse.ant' version='2.0.0.final_20090108225011'>
+      <properties size='3'>
+        <property name='artifact.size' value='824011'/>
+        <property name='download.size' value='824011'/>
+        <property name='download.md5' value='6727e4aab68649a93254e14c478be021'/>
+      </properties>
+    </artifact>
+    <artifact classifier='osgi.bundle' id='org.apache.ivyde.eclipse' version='2.1.0.201008101807-RELEASE'>
+      <properties size='3'>
+        <property name='artifact.size' value='4066803'/>
+        <property name='download.size' value='4066803'/>
+        <property name='download.md5' value='4b45b0d54f0a056943d7aae7175caa35'/>
+      </properties>
+    </artifact>
+    <artifact classifier='osgi.bundle' id='org.apache.ivy.eclipse.ant' version='2.2.0.final_20100923230623'>
+      <properties size='3'>
+        <property name='artifact.size' value='874646'/>
+        <property name='download.size' value='874646'/>
+        <property name='download.md5' value='eee79b2ed2e022c6e909f599ce233757'/>
+      </properties>
+    </artifact>
+    <artifact classifier='org.eclipse.update.feature' id='org.apache.ivy.feature' version='2.2.0.final_20100923230623'>
+      <properties size='4'>
+        <property name='artifact.size' value='6142'/>
+        <property name='download.size' value='6142'/>
+        <property name='download.md5' value='ed10d1e1648eeec13a2880f1addc3285'/>
+        <property name='download.contentType' value='application/zip'/>
+      </properties>
+    </artifact>
+    <artifact classifier='org.eclipse.update.feature' id='org.apache.ivyde.feature' version='2.0.0.final-200907011148-RELEASE'>
+      <properties size='4'>
+        <property name='artifact.size' value='6345'/>
+        <property name='download.size' value='6345'/>
+        <property name='download.md5' value='3e70b7a26da2bab0527bb3fb0d6bca31'/>
+        <property name='download.contentType' value='application/zip'/>
+      </properties>
+    </artifact>
+    <artifact classifier='org.eclipse.update.feature' id='org.apache.ivy.feature' version='2.0.0.final_20090108225011'>
+      <properties size='4'>
+        <property name='artifact.size' value='6130'/>
+        <property name='download.size' value='6130'/>
+        <property name='download.md5' value='56d82c8b1596f7b6de5284cdea7f5eb9'/>
+        <property name='download.contentType' value='application/zip'/>
+      </properties>
+    </artifact>
+    <artifact classifier='osgi.bundle' id='org.apache.ivy.eclipse.ant' version='2.1.0.final_20090925235825'>
+      <properties size='3'>
+        <property name='artifact.size' value='840374'/>
+        <property name='download.size' value='840374'/>
+        <property name='download.md5' value='b72373994caa0e1094cd14a0ffc561fe'/>
+      </properties>
+    </artifact>
+    <artifact classifier='osgi.bundle' id='org.apache.ivy' version='2.2.0.final_20100923230623'>
+      <properties size='3'>
+        <property name='artifact.size' value='947592'/>
+        <property name='download.size' value='947592'/>
+        <property name='download.md5' value='2703395cb677b36bbe04f0e868a10d2b'/>
+      </properties>
+    </artifact>
+    <artifact classifier='osgi.bundle' id='org.apache.ivy' version='2.0.0.final_20090108225011'>
+      <properties size='3'>
+        <property name='artifact.size' value='893618'/>
+        <property name='download.size' value='893618'/>
+        <property name='download.md5' value='1828fd7e76ab6af953b039f0daa0a2de'/>
+      </properties>
+    </artifact>
+    <artifact classifier='osgi.bundle' id='org.apache.ivy' version='2.1.0.final_20090925235825'>
+      <properties size='3'>
+        <property name='artifact.size' value='910990'/>
+        <property name='download.size' value='910990'/>
+        <property name='download.md5' value='62a75bdc8395f7b44b03dfb835ef7e48'/>
+      </properties>
+    </artifact>
+  </artifacts>
+</repository>

Propchange: ant/ivy/core/trunk/test/test-p2/ivyde-repo/artifacts.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ant/ivy/core/trunk/test/test-p2/ivyde-repo/artifacts.xml
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: ant/ivy/core/trunk/test/test-p2/ivyde-repo/artifacts.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml



Mime
View raw message