Repository: ant-ivy Updated Branches: refs/heads/master 0cdcb1fd8 -> 37f70ab67
IVY-1546 Maven 1 repo is no longer available. Remove the tests, which anyway weren't running Project: http://git-wip-us.apache.org/repos/asf/ant-ivy/repo Commit: http://git-wip-us.apache.org/repos/asf/ant-ivy/commit/37f70ab6 Tree: http://git-wip-us.apache.org/repos/asf/ant-ivy/tree/37f70ab6 Diff: http://git-wip-us.apache.org/repos/asf/ant-ivy/diff/37f70ab6 Branch: refs/heads/master Commit: 37f70ab67f9f9057a89e6a0835028ad316baab23 Parents: 0cdcb1f Author: Jaikiran Pai <[email protected]> Authored: Thu Aug 31 17:20:04 2017 +0530 Committer: Jaikiran Pai <[email protected]> Committed: Thu Aug 31 17:20:24 2017 +0530 ---------------------------------------------------------------------- build.xml | 5 - .../ivy/plugins/resolver/IBiblioHelper.java | 70 -------- .../plugins/resolver/IBiblioResolverTest.java | 126 -------------- .../ivy/plugins/resolver/URLResolverTest.java | 170 ------------------- 4 files changed, 371 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/37f70ab6/build.xml ---------------------------------------------------------------------- diff --git a/build.xml b/build.xml index b49c037..9736ed2 100644 --- a/build.xml +++ b/build.xml @@ -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 ================================================================= --> http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/37f70ab6/test/java/org/apache/ivy/plugins/resolver/IBiblioHelper.java ---------------------------------------------------------------------- diff --git a/test/java/org/apache/ivy/plugins/resolver/IBiblioHelper.java b/test/java/org/apache/ivy/plugins/resolver/IBiblioHelper.java deleted file mode 100644 index adc04a1..0000000 --- a/test/java/org/apache/ivy/plugins/resolver/IBiblioHelper.java +++ /dev/null @@ -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"); - } - -} http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/37f70ab6/test/java/org/apache/ivy/plugins/resolver/IBiblioResolverTest.java ---------------------------------------------------------------------- diff --git a/test/java/org/apache/ivy/plugins/resolver/IBiblioResolverTest.java b/test/java/org/apache/ivy/plugins/resolver/IBiblioResolverTest.java index edf77a6..42f353d 100644 --- a/test/java/org/apache/ivy/plugins/resolver/IBiblioResolverTest.java +++ b/test/java/org/apache/ivy/plugins/resolver/IBiblioResolverTest.java @@ -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)); - } - } http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/37f70ab6/test/java/org/apache/ivy/plugins/resolver/URLResolverTest.java ---------------------------------------------------------------------- diff --git a/test/java/org/apache/ivy/plugins/resolver/URLResolverTest.java b/test/java/org/apache/ivy/plugins/resolver/URLResolverTest.java index 7b11e4e..bde3d4c 100644 --- a/test/java/org/apache/ivy/plugins/resolver/URLResolverTest.java +++ b/test/java/org/apache/ivy/plugins/resolver/URLResolverTest.java @@ -176,176 +176,6 @@ public class URLResolverTest extends AbstractDependencyResolverTest { } @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(); resolver.setSettings(settings);
