You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by hi...@apache.org on 2014/12/13 16:42:41 UTC

[3/3] ant-ivy git commit: IVY-1474 : Ivy Bintray resolver (Thanks to Evgeny Goldin)

IVY-1474 : Ivy Bintray resolver (Thanks to Evgeny Goldin)


Project: http://git-wip-us.apache.org/repos/asf/ant-ivy/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant-ivy/commit/79cb7c62
Tree: http://git-wip-us.apache.org/repos/asf/ant-ivy/tree/79cb7c62
Diff: http://git-wip-us.apache.org/repos/asf/ant-ivy/diff/79cb7c62

Branch: refs/heads/2.4.x
Commit: 79cb7c6270b37ee529336e61bd085176d7fd2ce5
Parents: 9651c29
Author: Nicolas Lalevée <ni...@hibnet.org>
Authored: Sat Dec 13 16:36:17 2014 +0100
Committer: Nicolas Lalevée <ni...@hibnet.org>
Committed: Sat Dec 13 16:39:42 2014 +0100

----------------------------------------------------------------------
 doc/release-notes.html                          |   3 +
 doc/resolver/bintray.html                       |  69 +++++
 doc/toc.json                                    |   7 +
 src/example/bintray/build.xml                   |  23 ++
 src/example/bintray/ivy.xml                     |  31 +++
 src/example/bintray/ivysettings.xml             |  37 +++
 .../apache/ivy/core/settings/typedef.properties |   1 +
 .../ivy/plugins/resolver/BintrayResolver.java   |  81 ++++++
 .../plugins/resolver/BintrayResolverTest.java   | 261 +++++++++++++++++++
 9 files changed, 513 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/79cb7c62/doc/release-notes.html
----------------------------------------------------------------------
diff --git a/doc/release-notes.html b/doc/release-notes.html
index 32647b0..c01f090 100644
--- a/doc/release-notes.html
+++ b/doc/release-notes.html
@@ -38,6 +38,7 @@ configurability, and tight integration with Apache Ant.
 Key features of this 2.4.0 release are
 * some new Ant tasks
 * improved OSGI support
+* a Bintray resolver
 * numerous bug fixes as documented in Jira and in the release notes
  
 You can download this 2.4.0 release at:
@@ -66,6 +67,7 @@ List of changes since Ivy 2.3.0:
 - NEW: Agent authentication for SSH and SFTP transports (IVY-1421)
 - NEW: New OSGi resolver 'osgi-agg': a chain resolver dedicated to better handle OSGi dependencies
 - NEW: Add support for "packed" artifacts: .pack.gz bundles in an OSGi P2 repository for instance
+- NEW: Ivy Bintray resolver (IVY-1474) (Thanks to Evgeny Goldin)
 
 - IMPROVEMENT: Generate POMs with /xsd/maven-4.0.0.xsd reference instead of old /maven-v4_0_0.xsd (IVY-1491) (thanks to Hervé Boutemy)
 - IMPROVEMENT: Add support for packed jar within an OSGi bundle
@@ -160,6 +162,7 @@ Here is the list of people who have contributed source code and documentation up
 <li>Jacob Grydholt Jensen</li>
 <li>John Gibson</li>
 <li>Mitch Gitman</li>
+<li>Evgeny Goldin</li>
 <li>Scott Goldstein</li>
 <li>Pierre Hägnestrand</li>
 <li>Scott Hebert</li>

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/79cb7c62/doc/resolver/bintray.html
----------------------------------------------------------------------
diff --git a/doc/resolver/bintray.html b/doc/resolver/bintray.html
new file mode 100644
index 0000000..aa5236b
--- /dev/null
+++ b/doc/resolver/bintray.html
@@ -0,0 +1,69 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<!--
+   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.    
+-->
+<html>
+<head>
+	<script type="text/javascript">var xookiConfig = {level: 1};</script>	
+	<script type="text/javascript" src="../xooki/xooki.js"></script>
+</head>
+<body>
+	<textarea id="xooki-source">
+<table class="resolver">
+<tr><td class="title">Tag</td><td class="value">bintray</td></tr>
+<tr><td class="title">Handle latest</td><td class="value">yes, at least if the repository server is apache based</td></tr>
+<tr><td class="title">Handle publish</td><td class="value">no</td></tr>
+</table>
+
+<span class="tagdoc" id="ivysettings.resolvers.ibiblio">This resolver uses Bintray DaaS (Distribution as a Service) platform to retrieve artifacts.</span>
+
+<h1>Attributes</h1>
+<table class="ivy-attributes">
+<thead>
+    <tr><th class="ivy-att">Attribute</th><th class="ivy-att-desc">Description</th><th class="ivy-att-req">Required</th></tr>
+</thead>
+<tbody>
+    <tr><td>subject</td><td>Bintray username of a repository owner.</td>
+        <td>No, defaults to JCenter</td></tr>
+    <tr><td>repo</td><td>User's repository name.</td>
+        <td>No, defaults to JCenter</td></tr>
+</tbody>
+</table>
+
+<h1>Examples</h1>
+<code type="xml">
+<bintray />
+</code>
+
+A default, defines a <a href="https://bintray.com/bintray/jcenter">JCenter</a> (http://jcenter.bintray.com/) resolver. 
+In most circumstances you won't need any other resolvers as JCenter is already a super-set of many other repositories, including Maven Central.
+
+<hr/>
+
+<code type="xml">
+<bintray subject="dsowerby" repo="maven"/>
+<bintray subject="igelgrun" repo="batrak"/>
+</code>
+
+Defines two resolvers to use a <a href="https://bintray.com/dsowerby/maven">repository</a> "maven" of user "dsowerby" (https://dl.bintray.com/dsowerby/maven/) 
+and <a href="https://bintray.com/igelgrun/batrak">repository</a> "batrak" of user "igelgrun" (https://dl.bintray.com/igelgrun/batrak/).
+</textarea>
+<script type="text/javascript">xooki.postProcess();</script>
+</body>
+</html>
+

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/79cb7c62/doc/toc.json
----------------------------------------------------------------------
diff --git a/doc/toc.json b/doc/toc.json
index bff771f..55a0f21 100644
--- a/doc/toc.json
+++ b/doc/toc.json
@@ -409,6 +409,13 @@
                                 "children": [
 
                                   ]
+                              },
+                              {
+                                "id":"resolver/bintray",
+                                "title":"Bintray Resolver",
+                                "children": [
+
+                                  ]
                               }
                             ]
                         },

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/79cb7c62/src/example/bintray/build.xml
----------------------------------------------------------------------
diff --git a/src/example/bintray/build.xml b/src/example/bintray/build.xml
new file mode 100644
index 0000000..c82359e
--- /dev/null
+++ b/src/example/bintray/build.xml
@@ -0,0 +1,23 @@
+<!--
+   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.
+-->
+<project xmlns:ivy="antlib:org.apache.ivy.ant" name="ivy-bintray-example" default="retrieve">
+    <target name="retrieve">
+        <ivy:retrieve />
+    </target>
+</project>

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/79cb7c62/src/example/bintray/ivy.xml
----------------------------------------------------------------------
diff --git a/src/example/bintray/ivy.xml b/src/example/bintray/ivy.xml
new file mode 100644
index 0000000..120a43b
--- /dev/null
+++ b/src/example/bintray/ivy.xml
@@ -0,0 +1,31 @@
+<!--
+   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.
+-->
+<ivy-module version="2.0">
+    <info organisation="org.apache" module="hello-ivy"/>
+    <dependencies>
+        <!-- https://jcenter.bintray.com/ -->
+        <dependency org="org.jfrog.artifactory.client" name="artifactory-cli" rev="1.0" />
+        <dependency org="org.jfrog.artifactory.client" name="artifactory-cli" rev="1.0" />
+        <dependency org="org.jfrog"                    name="build-info-api"  rev="1.3.1" />
+        <!-- https://dl.bintray.com/dsowerby/maven/ -->
+        <dependency org="uk.q3c.krail"                 name="krail"           rev="0.7.0" />
+        <!-- https://dl.bintray.com/igelgrun/batrak/ -->
+        <dependency org="igel.batrak"                  name="batrak-core"     rev="0.1" />
+    </dependencies>
+</ivy-module>

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/79cb7c62/src/example/bintray/ivysettings.xml
----------------------------------------------------------------------
diff --git a/src/example/bintray/ivysettings.xml b/src/example/bintray/ivysettings.xml
new file mode 100644
index 0000000..15adc16
--- /dev/null
+++ b/src/example/bintray/ivysettings.xml
@@ -0,0 +1,37 @@
+<!--
+   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.
+-->
+<ivysettings>
+  <settings defaultResolver="chain"/>
+  <resolvers>
+    <chain name="chain">
+
+      <!-- https://jcenter.bintray.com/ -->
+      <bintray />
+
+      <!-- https://bintray.com/dsowerby/maven     -->
+      <!-- https://dl.bintray.com/dsowerby/maven/ -->
+      <bintray subject="dsowerby" repo="maven"/>
+
+      <!-- https://bintray.com/igelgrun/batrak     -->
+      <!-- https://dl.bintray.com/igelgrun/batrak/ -->
+      <bintray subject="igelgrun" repo="batrak"/>
+
+    </chain>
+  </resolvers>
+</ivysettings>

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/79cb7c62/src/java/org/apache/ivy/core/settings/typedef.properties
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/core/settings/typedef.properties b/src/java/org/apache/ivy/core/settings/typedef.properties
index 230b928..ba140d2 100644
--- a/src/java/org/apache/ivy/core/settings/typedef.properties
+++ b/src/java/org/apache/ivy/core/settings/typedef.properties
@@ -19,6 +19,7 @@
 filesystem 	= org.apache.ivy.plugins.resolver.FileSystemResolver
 chain 		= org.apache.ivy.plugins.resolver.ChainResolver
 ibiblio		= org.apache.ivy.plugins.resolver.IBiblioResolver
+bintray     = org.apache.ivy.plugins.resolver.BintrayResolver
 url			= org.apache.ivy.plugins.resolver.URLResolver
 dual		= org.apache.ivy.plugins.resolver.DualResolver
 ivyrep		= org.apache.ivy.plugins.resolver.IvyRepResolver

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/79cb7c62/src/java/org/apache/ivy/plugins/resolver/BintrayResolver.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/plugins/resolver/BintrayResolver.java b/src/java/org/apache/ivy/plugins/resolver/BintrayResolver.java
new file mode 100644
index 0000000..c8d7b26
--- /dev/null
+++ b/src/java/org/apache/ivy/plugins/resolver/BintrayResolver.java
@@ -0,0 +1,81 @@
+/*
+ *  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;
+
+/**
+ * BintrayResolver is a resolver which can be used to resolve dependencies found in the Bintray
+ * artifacts repository.
+ */
+@SuppressWarnings("ClassTooDeepInInheritanceTree")
+public class BintrayResolver extends IBiblioResolver {
+
+    private static final String JCENTER = "https://jcenter.bintray.com/";
+
+    private static final String DL_BINTRAY = "https://dl.bintray.com/";
+
+    private static final String DEFAULT_NAME = "bintray/jcenter";
+
+    private String subject;
+
+    private String repo;
+
+    private boolean isNameUpdatable; // Whether resolver's name was not originally specified and can
+                                     // be updated.
+
+    public BintrayResolver() {
+        setRoot(JCENTER);
+        updateName(DEFAULT_NAME);
+        setM2compatible(true);
+        setUsepoms(true);
+        setUseMavenMetadata(true);
+    }
+
+    public void setSubject(String subject) {
+        this.subject = subject;
+        updateRoot();
+    }
+
+    public void setRepo(String repo) {
+        this.repo = repo;
+        updateRoot();
+    }
+
+    @SuppressWarnings("MethodWithMultipleReturnPoints")
+    private void updateRoot() {
+        if (isEmpty(subject) || isEmpty(repo)) {
+            return;
+        }
+
+        setRoot(String.format("%s%s/%s/", DL_BINTRAY, subject, repo));
+        updateName(String.format("bintray/%s/%s", subject, repo));
+    }
+
+    private void updateName(String defaultName) {
+        if (isEmpty(defaultName)) {
+            throw new IllegalArgumentException("Default resolver name must not be null or empty");
+        }
+        if (isEmpty(getName()) || isNameUpdatable) {
+            isNameUpdatable = true;
+            setName(defaultName);
+        }
+    }
+
+    private boolean isEmpty(String s) {
+        return ((s == null) || (s.trim().length() < 1));
+    }
+}

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/79cb7c62/test/java/org/apache/ivy/plugins/resolver/BintrayResolverTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/plugins/resolver/BintrayResolverTest.java b/test/java/org/apache/ivy/plugins/resolver/BintrayResolverTest.java
new file mode 100644
index 0000000..fdcf9ae
--- /dev/null
+++ b/test/java/org/apache/ivy/plugins/resolver/BintrayResolverTest.java
@@ -0,0 +1,261 @@
+/*
+ *  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.io.File;
+
+import org.apache.ivy.core.IvyContext;
+import org.apache.ivy.core.event.EventManager;
+import org.apache.ivy.core.module.descriptor.Artifact;
+import org.apache.ivy.core.module.descriptor.DefaultArtifact;
+import org.apache.ivy.core.module.descriptor.DefaultDependencyDescriptor;
+import org.apache.ivy.core.module.descriptor.DefaultIncludeRule;
+import org.apache.ivy.core.module.id.ArtifactId;
+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.ResolveData;
+import org.apache.ivy.core.resolve.ResolveEngine;
+import org.apache.ivy.core.resolve.ResolveOptions;
+import org.apache.ivy.core.resolve.ResolvedModuleRevision;
+import org.apache.ivy.core.settings.IvySettings;
+import org.apache.ivy.core.sort.SortEngine;
+import org.apache.ivy.plugins.matcher.ExactPatternMatcher;
+import org.apache.ivy.util.MockMessageLogger;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.taskdefs.Delete;
+
+public class BintrayResolverTest extends AbstractDependencyResolverTest {
+
+    private IvySettings _settings;
+
+    private ResolveEngine _engine;
+
+    private ResolveData _data;
+
+    private File _cache;
+
+    @Override
+    protected void setUp() throws Exception {
+        _settings = new IvySettings();
+        _engine = new ResolveEngine(_settings, new EventManager(), new SortEngine(_settings));
+        _cache = new File("build/cache");
+        _data = new ResolveData(_engine, new ResolveOptions());
+        _cache.mkdirs();
+        _settings.setDefaultCache(_cache);
+    }
+
+    @Override
+    protected void tearDown() throws Exception {
+        Delete del = new Delete();
+        del.setProject(new Project());
+        del.setDir(_cache);
+        del.execute();
+    }
+
+    public void testDefaults() {
+        BintrayResolver resolver = new BintrayResolver();
+        assertEquals("https://jcenter.bintray.com/", resolver.getRoot());
+        assertEquals("bintray/jcenter", resolver.getName());
+    }
+
+    public void testDefaultsWithName() {
+        BintrayResolver resolver = new BintrayResolver();
+        resolver.setName("TestName");
+        assertEquals("https://jcenter.bintray.com/", resolver.getRoot());
+        assertEquals("TestName", resolver.getName());
+    }
+
+    public void testSubjectOnly() {
+        BintrayResolver resolver = new BintrayResolver();
+        resolver.setSubject("jfrog");
+        assertEquals("https://jcenter.bintray.com/", resolver.getRoot());
+        assertEquals("bintray/jcenter", resolver.getName());
+    }
+
+    public void testRepoOnly() {
+        BintrayResolver resolver = new BintrayResolver();
+        resolver.setRepo("jfrog-jars");
+        assertEquals("https://jcenter.bintray.com/", resolver.getRoot());
+        assertEquals("bintray/jcenter", resolver.getName());
+    }
+
+    public void testSubjectOnlyWithName() {
+        BintrayResolver resolver = new BintrayResolver();
+        resolver.setSubject("jfrog");
+        resolver.setName("TestName");
+        assertEquals("https://jcenter.bintray.com/", resolver.getRoot());
+        assertEquals("TestName", resolver.getName());
+    }
+
+    public void testRepoOnlyWithName() {
+        BintrayResolver resolver = new BintrayResolver();
+        resolver.setRepo("jfrog-jars");
+        resolver.setName("TestName");
+        assertEquals("https://jcenter.bintray.com/", resolver.getRoot());
+        assertEquals("TestName", resolver.getName());
+    }
+
+    public void testSubjectAndRepo() {
+        BintrayResolver resolver = new BintrayResolver();
+        resolver.setSubject("jfrog");
+        resolver.setRepo("jfrog-jars");
+        assertEquals("https://dl.bintray.com/jfrog/jfrog-jars/", resolver.getRoot());
+        assertEquals("bintray/jfrog/jfrog-jars", resolver.getName());
+    }
+
+    public void testSubjectAndRepoWithName() {
+        BintrayResolver resolver = new BintrayResolver();
+        resolver.setSubject("jfrog");
+        resolver.setRepo("jfrog-jars");
+        resolver.setName("TestName");
+        assertEquals("https://dl.bintray.com/jfrog/jfrog-jars/", resolver.getRoot());
+        assertEquals("TestName", resolver.getName());
+    }
+
+    public void testBintray() throws Exception {
+
+        BintrayResolver resolver = new BintrayResolver();
+        resolver.setSettings(_settings);
+        ModuleRevisionId mrid = ModuleRevisionId
+                .newInstance("org.apache.ant", "ant-antunit", "1.2");
+        ResolvedModuleRevision rmr = resolver.getDependency(new DefaultDependencyDescriptor(mrid,
+                false), _data);
+        assertNotNull(rmr);
+        assertEquals(mrid, rmr.getId());
+
+        DefaultArtifact artifact = new DefaultArtifact(mrid, rmr.getPublicationDate(),
+                "ant-antunit", "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());
+    }
+
+    public void testErrorReport() throws Exception {
+        BintrayResolver resolver = new BintrayResolver();
+        resolver.setSubject("unknown");
+        resolver.setRepo("unknown");
+        resolver.setName("test");
+        resolver.setM2compatible(true);
+        resolver.setSettings(_settings);
+        assertEquals("test", resolver.getName());
+
+        MockMessageLogger mockMessageImpl = new MockMessageLogger();
+        IvyContext.getContext().getIvy().getLoggerEngine().setDefaultLogger(mockMessageImpl);
+
+        ModuleRevisionId mrid = ModuleRevisionId.newInstance("org.apache", "commons-fileupload",
+            "1.0");
+        ResolvedModuleRevision rmr = resolver.getDependency(new DefaultDependencyDescriptor(mrid,
+                false), _data);
+        assertNull(rmr);
+
+        mockMessageImpl
+                .assertLogContains("trying https://dl.bintray.com/unknown/unknown/org/apache/commons-fileupload/1.0/commons-fileupload-1.0.jar");
+        mockMessageImpl
+                .assertLogContains("tried https://dl.bintray.com/unknown/unknown/org/apache/commons-fileupload/1.0/commons-fileupload-1.0.jar");
+    }
+
+    public void testBintrayArtifacts() throws Exception {
+        BintrayResolver resolver = new BintrayResolver();
+        resolver.setName("test");
+        resolver.setSettings(_settings);
+        assertEquals("test", resolver.getName());
+
+        ModuleRevisionId mrid = ModuleRevisionId
+                .newInstance("org.apache.ant", "ant-antunit", "1.2");
+        DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(mrid, false);
+        dd.addIncludeRule("default", new DefaultIncludeRule(new ArtifactId(mrid.getModuleId(),
+                "ant-antunit", "javadoc", "jar"), ExactPatternMatcher.INSTANCE, null));
+        dd.addIncludeRule("default", new DefaultIncludeRule(new ArtifactId(mrid.getModuleId(),
+                "ant-antunit", "sources", "jar"), ExactPatternMatcher.INSTANCE, null));
+        ResolvedModuleRevision rmr = resolver.getDependency(dd, _data);
+        assertNotNull(rmr);
+        assertEquals(mrid, rmr.getId());
+
+        DefaultArtifact profiler = new DefaultArtifact(mrid, rmr.getPublicationDate(),
+                "ant-antunit", "javadoc", "jar");
+        DefaultArtifact trace = new DefaultArtifact(mrid, rmr.getPublicationDate(), "ant-antunit",
+                "sources", "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());
+    }
+
+    public void testUnknown() throws Exception {
+        BintrayResolver resolver = new BintrayResolver();
+        resolver.setName("test");
+        resolver.setSettings(_settings);
+
+        assertNull(resolver.getDependency(
+            new DefaultDependencyDescriptor(ModuleRevisionId.newInstance("unknown", "unknown",
+                "1.0"), false), _data));
+    }
+
+}