mirror of https://github.com/apache/ant-ivy
IVY-1546 Maven 1 repo is no longer available. Remove the tests, which anyway weren't running
This commit is contained in:
parent
0cdcb1fd8d
commit
37f70ab67f
|
|
@ -459,11 +459,6 @@
|
|||
message="At least one test has failed. See logs (in ${test.xml.dir}) for details (use the target test-report to run the test with a report)"/>
|
||||
</target>
|
||||
|
||||
<target name="check-ibiblio" depends="build-test">
|
||||
<java classname="org.apache.ivy.plugins.resolver.IBiblioHelper"
|
||||
classpathref="test.classpath"/>
|
||||
</target>
|
||||
|
||||
<!-- =================================================================
|
||||
REPORTS AND DOCUMENTATION
|
||||
================================================================= -->
|
||||
|
|
|
|||
|
|
@ -1,70 +0,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.
|
||||
*
|
||||
*/
|
||||
package org.apache.ivy.plugins.resolver;
|
||||
|
||||
import java.net.URL;
|
||||
|
||||
import org.apache.ivy.util.url.URLHandler;
|
||||
import org.apache.ivy.util.url.URLHandlerRegistry;
|
||||
|
||||
/**
|
||||
* TODO write javadoc
|
||||
*/
|
||||
public class IBiblioHelper {
|
||||
private static boolean _checked = false;
|
||||
|
||||
private static String _mirror = null;
|
||||
|
||||
private static URLHandler handler = URLHandlerRegistry.getHttp();
|
||||
|
||||
public static String getIBiblioMirror() throws Exception {
|
||||
if (!_checked) {
|
||||
String[] mirrors = new String[] {"http://maven.ibiblio.org/maven"};
|
||||
String[] mirrorsRoot = new String[] {"http://maven.ibiblio.org/maven"};
|
||||
|
||||
long best = -1;
|
||||
for (int i = 0; i < mirrors.length; i++) {
|
||||
long start = System.currentTimeMillis();
|
||||
if (handler.isReachable(new URL(mirrors[i]), 500)) {
|
||||
long took = System.currentTimeMillis() - start;
|
||||
System.out.println("reached " + mirrors[i] + " in " + took + "ms");
|
||||
if (best == -1 || took < best) {
|
||||
best = took;
|
||||
_mirror = mirrorsRoot[i];
|
||||
if (took < 400) {
|
||||
// this mirror is good enough
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (_mirror == null) {
|
||||
System.out.println("No ibiblio mirror available: no ibiblio test done");
|
||||
}
|
||||
}
|
||||
return _mirror;
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
long start = System.currentTimeMillis();
|
||||
String biblioMirror = getIBiblioMirror();
|
||||
System.out.println("best mirror is " + biblioMirror + " - found in "
|
||||
+ (System.currentTimeMillis() - start) + "ms");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -161,51 +161,6 @@ public class IBiblioResolverTest extends AbstractDependencyResolverTest {
|
|||
l.get(0));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIBiblio() throws Exception {
|
||||
String ibiblioRoot = IBiblioHelper.getIBiblioMirror();
|
||||
if (ibiblioRoot == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
IBiblioResolver resolver = new IBiblioResolver();
|
||||
resolver.setRoot(ibiblioRoot);
|
||||
resolver.setName("test");
|
||||
resolver.setSettings(_settings);
|
||||
assertEquals("test", resolver.getName());
|
||||
|
||||
ModuleRevisionId mrid = ModuleRevisionId.newInstance("apache", "commons-fileupload", "1.0");
|
||||
ResolvedModuleRevision rmr = resolver.getDependency(new DefaultDependencyDescriptor(mrid,
|
||||
false), _data);
|
||||
assertNotNull(rmr);
|
||||
assertEquals(mrid, rmr.getId());
|
||||
|
||||
DefaultArtifact artifact = new DefaultArtifact(mrid, rmr.getPublicationDate(),
|
||||
"commons-fileupload", "jar", "jar");
|
||||
DownloadReport report = resolver.download(new Artifact[] {artifact}, 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}, downloadOptions());
|
||||
assertNotNull(report);
|
||||
|
||||
assertEquals(1, report.getArtifactsReports().length);
|
||||
|
||||
ar = report.getArtifactReport(artifact);
|
||||
assertNotNull(ar);
|
||||
|
||||
assertEquals(artifact, ar.getArtifact());
|
||||
assertEquals(DownloadStatus.NO, ar.getDownloadStatus());
|
||||
}
|
||||
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
@Test
|
||||
public void testMaven2Listing() throws Exception {
|
||||
|
|
@ -266,85 +221,4 @@ public class IBiblioResolverTest extends AbstractDependencyResolverTest {
|
|||
.assertLogContains("tried http://unknown.host.comx/org/apache/commons-fileupload/1.0/commons-fileupload-1.0.jar");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIBiblioArtifacts() throws Exception {
|
||||
String ibiblioRoot = IBiblioHelper.getIBiblioMirror();
|
||||
if (ibiblioRoot == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
IBiblioResolver resolver = new IBiblioResolver();
|
||||
resolver.setRoot(ibiblioRoot);
|
||||
resolver.setName("test");
|
||||
resolver.setSettings(_settings);
|
||||
assertEquals("test", resolver.getName());
|
||||
|
||||
ModuleRevisionId mrid = ModuleRevisionId.newInstance("apache", "nanning", "0.9");
|
||||
DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(mrid, false);
|
||||
dd.addIncludeRule("default", new DefaultIncludeRule(new ArtifactId(mrid.getModuleId(),
|
||||
"nanning-profiler", "jar", "jar"), ExactPatternMatcher.INSTANCE, null));
|
||||
dd.addIncludeRule("default", new DefaultIncludeRule(new ArtifactId(mrid.getModuleId(),
|
||||
"nanning-trace", "jar", "jar"), ExactPatternMatcher.INSTANCE, null));
|
||||
ResolvedModuleRevision rmr = resolver.getDependency(dd, _data);
|
||||
assertNotNull(rmr);
|
||||
assertEquals(mrid, rmr.getId());
|
||||
|
||||
DefaultArtifact profiler = new DefaultArtifact(mrid, rmr.getPublicationDate(),
|
||||
"nanning-profiler", "jar", "jar");
|
||||
DefaultArtifact trace = new DefaultArtifact(mrid, rmr.getPublicationDate(),
|
||||
"nanning-trace", "jar", "jar");
|
||||
DownloadReport report = resolver.download(new Artifact[] {profiler, trace},
|
||||
downloadOptions());
|
||||
assertNotNull(report);
|
||||
|
||||
assertEquals(2, report.getArtifactsReports().length);
|
||||
|
||||
ArtifactDownloadReport ar = report.getArtifactReport(profiler);
|
||||
assertNotNull(ar);
|
||||
|
||||
assertEquals(profiler, ar.getArtifact());
|
||||
assertEquals(DownloadStatus.SUCCESSFUL, ar.getDownloadStatus());
|
||||
|
||||
ar = report.getArtifactReport(trace);
|
||||
assertNotNull(ar);
|
||||
|
||||
assertEquals(trace, ar.getArtifact());
|
||||
assertEquals(DownloadStatus.SUCCESSFUL, ar.getDownloadStatus());
|
||||
|
||||
// test to ask to download again, should use cache
|
||||
report = resolver.download(new Artifact[] {profiler, trace}, downloadOptions());
|
||||
assertNotNull(report);
|
||||
|
||||
assertEquals(2, report.getArtifactsReports().length);
|
||||
|
||||
ar = report.getArtifactReport(profiler);
|
||||
assertNotNull(ar);
|
||||
|
||||
assertEquals(profiler, ar.getArtifact());
|
||||
assertEquals(DownloadStatus.NO, ar.getDownloadStatus());
|
||||
|
||||
ar = report.getArtifactReport(trace);
|
||||
assertNotNull(ar);
|
||||
|
||||
assertEquals(trace, ar.getArtifact());
|
||||
assertEquals(DownloadStatus.NO, ar.getDownloadStatus());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUnknown() throws Exception {
|
||||
String ibiblioRoot = IBiblioHelper.getIBiblioMirror();
|
||||
if (ibiblioRoot == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
IBiblioResolver resolver = new IBiblioResolver();
|
||||
resolver.setRoot(ibiblioRoot);
|
||||
resolver.setName("test");
|
||||
resolver.setSettings(_settings);
|
||||
|
||||
assertNull(resolver.getDependency(
|
||||
new DefaultDependencyDescriptor(ModuleRevisionId.newInstance("unknown", "unknown",
|
||||
"1.0"), false), _data));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -175,176 +175,6 @@ public class URLResolverTest extends AbstractDependencyResolverTest {
|
|||
assertEquals(pubdate, rmr.getPublicationDate());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIBiblio() throws Exception {
|
||||
String ibiblioRoot = IBiblioHelper.getIBiblioMirror();
|
||||
if (ibiblioRoot == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
URLResolver resolver = new URLResolver();
|
||||
resolver.setSettings(settings);
|
||||
resolver.addArtifactPattern(ibiblioRoot + "/[module]/[type]s/[artifact]-[revision].[type]");
|
||||
resolver.setName("test");
|
||||
assertEquals("test", resolver.getName());
|
||||
|
||||
ModuleRevisionId mrid = ModuleRevisionId.newInstance("apache", "commons-fileupload", "1.0");
|
||||
ResolvedModuleRevision rmr = resolver.getDependency(new DefaultDependencyDescriptor(mrid,
|
||||
false), data);
|
||||
assertNotNull(rmr);
|
||||
assertEquals(mrid, rmr.getId());
|
||||
|
||||
DefaultArtifact artifact = new DefaultArtifact(mrid, rmr.getPublicationDate(),
|
||||
"commons-fileupload", "jar", "jar");
|
||||
DownloadReport report = resolver.download(new Artifact[] {artifact}, 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}, downloadOptions());
|
||||
assertNotNull(report);
|
||||
|
||||
assertEquals(1, report.getArtifactsReports().length);
|
||||
|
||||
ar = report.getArtifactReport(artifact);
|
||||
assertNotNull(ar);
|
||||
|
||||
assertEquals(artifact, ar.getArtifact());
|
||||
assertEquals(DownloadStatus.NO, ar.getDownloadStatus());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIBiblioArtifacts() throws Exception {
|
||||
String ibiblioRoot = IBiblioHelper.getIBiblioMirror();
|
||||
if (ibiblioRoot == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
URLResolver resolver = new URLResolver();
|
||||
resolver.setSettings(settings);
|
||||
resolver.addArtifactPattern(ibiblioRoot + "/[module]/[type]s/[artifact]-[revision].[type]");
|
||||
resolver.setName("test");
|
||||
assertEquals("test", resolver.getName());
|
||||
|
||||
ModuleRevisionId mrid = ModuleRevisionId.newInstance("apache", "nanning", "0.9");
|
||||
DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(mrid, false);
|
||||
dd.addIncludeRule("default", new DefaultIncludeRule(new ArtifactId(mrid.getModuleId(),
|
||||
"nanning-profiler", "jar", "jar"), ExactPatternMatcher.INSTANCE, null));
|
||||
dd.addIncludeRule("default", new DefaultIncludeRule(new ArtifactId(mrid.getModuleId(),
|
||||
"nanning-trace", "jar", "jar"), ExactPatternMatcher.INSTANCE, null));
|
||||
ResolvedModuleRevision rmr = resolver.getDependency(dd, data);
|
||||
assertNotNull(rmr);
|
||||
assertEquals(mrid, rmr.getId());
|
||||
|
||||
DefaultArtifact profiler = new DefaultArtifact(mrid, rmr.getPublicationDate(),
|
||||
"nanning-profiler", "jar", "jar");
|
||||
DefaultArtifact trace = new DefaultArtifact(mrid, rmr.getPublicationDate(),
|
||||
"nanning-trace", "jar", "jar");
|
||||
DownloadReport report = resolver.download(new Artifact[] {profiler, trace},
|
||||
downloadOptions());
|
||||
assertNotNull(report);
|
||||
|
||||
assertEquals(2, report.getArtifactsReports().length);
|
||||
|
||||
ArtifactDownloadReport ar = report.getArtifactReport(profiler);
|
||||
assertNotNull(ar);
|
||||
|
||||
assertEquals(profiler, ar.getArtifact());
|
||||
assertEquals(DownloadStatus.SUCCESSFUL, ar.getDownloadStatus());
|
||||
|
||||
ar = report.getArtifactReport(trace);
|
||||
assertNotNull(ar);
|
||||
|
||||
assertEquals(trace, ar.getArtifact());
|
||||
assertEquals(DownloadStatus.SUCCESSFUL, ar.getDownloadStatus());
|
||||
|
||||
// test to ask to download again, should use cache
|
||||
report = resolver.download(new Artifact[] {profiler, trace}, downloadOptions());
|
||||
assertNotNull(report);
|
||||
|
||||
assertEquals(2, report.getArtifactsReports().length);
|
||||
|
||||
ar = report.getArtifactReport(profiler);
|
||||
assertNotNull(ar);
|
||||
|
||||
assertEquals(profiler, ar.getArtifact());
|
||||
assertEquals(DownloadStatus.NO, ar.getDownloadStatus());
|
||||
|
||||
ar = report.getArtifactReport(trace);
|
||||
assertNotNull(ar);
|
||||
|
||||
assertEquals(trace, ar.getArtifact());
|
||||
assertEquals(DownloadStatus.NO, ar.getDownloadStatus());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLatestIBiblio() throws Exception {
|
||||
String ibiblioRoot = IBiblioHelper.getIBiblioMirror();
|
||||
if (ibiblioRoot == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
URLResolver resolver = new URLResolver();
|
||||
resolver.setSettings(settings);
|
||||
resolver.addArtifactPattern(ibiblioRoot + "/[module]/[type]s/[artifact]-[revision].[type]");
|
||||
resolver.setName("test");
|
||||
assertEquals("test", resolver.getName());
|
||||
|
||||
ModuleRevisionId mrid = ModuleRevisionId.newInstance("objectweb", "asm", "1.4+");
|
||||
ResolvedModuleRevision rmr = resolver.getDependency(new DefaultDependencyDescriptor(mrid,
|
||||
false), data);
|
||||
assertNotNull(rmr);
|
||||
assertEquals("1.4.3", rmr.getId().getRevision());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testVersionRangeIBiblio() throws Exception {
|
||||
String ibiblioRoot = IBiblioHelper.getIBiblioMirror();
|
||||
if (ibiblioRoot == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
URLResolver resolver = new URLResolver();
|
||||
resolver.setSettings(settings);
|
||||
resolver.setAlwaysCheckExactRevision(true);
|
||||
resolver.addIvyPattern(ibiblioRoot + "/[module]/poms/[module]-[revision].pom");
|
||||
resolver.addArtifactPattern(ibiblioRoot + "/[module]/[type]s/[artifact]-[revision].[type]");
|
||||
resolver.setName("test");
|
||||
assertEquals("test", resolver.getName());
|
||||
|
||||
ModuleRevisionId mrid = ModuleRevisionId.newInstance("asm", "asm", "[1.4,1.5]");
|
||||
ResolvedModuleRevision rmr = resolver.getDependency(new DefaultDependencyDescriptor(mrid,
|
||||
false), data);
|
||||
assertNotNull(rmr);
|
||||
assertEquals("1.4.4", rmr.getId().getRevision());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUnknown() throws Exception {
|
||||
String ibiblioRoot = IBiblioHelper.getIBiblioMirror();
|
||||
if (ibiblioRoot == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
URLResolver resolver = new URLResolver();
|
||||
resolver.setSettings(settings);
|
||||
resolver.addIvyPattern(ibiblioRoot + "/[module]/ivys/ivy-[revision].xml");
|
||||
resolver.addArtifactPattern(ibiblioRoot
|
||||
+ "/maven/[module]/[type]s/[artifact]-[revision].[type]");
|
||||
resolver.setName("test");
|
||||
|
||||
assertNull(resolver.getDependency(
|
||||
new DefaultDependencyDescriptor(ModuleRevisionId.newInstance("unknown", "unknown",
|
||||
"1.0"), false), data));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDownloadWithUseOriginIsTrue() throws Exception {
|
||||
URLResolver resolver = new URLResolver();
|
||||
|
|
|
|||
Loading…
Reference in New Issue