package org.dru.clay.resolver;
import java.io.File;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.Collections;
import org.dru.clay.respository.Repository;
import org.dru.clay.respository.artifact.Group;
import org.dru.clay.respository.artifact.UnresolvedArtifact;
import org.dru.clay.respository.artifact.VersionPattern;
import org.dru.clay.respository.cache.CacheIvyRepository;
import org.dru.clay.respository.dependency.ConfigurationMapping;
import org.dru.clay.respository.dependency.Dependency;
import org.dru.clay.respository.dependency.MappingRules;
import org.dru.clay.respository.ivy.IvyRepository;
import org.dru.clay.respository.transport.Transport;
import org.dru.clay.respository.transport.http.HttpTransport;
import org.junit.Test;
public class DependencyResolverImplTest {
@Test
public void test() throws URISyntaxException {
String ivyPattern = "/[organisation]/[module]/[module]-[revision]/ivy-[revision].xml";
String artifactPattern = "/[organisation]/[module]/[module]-[revision]/[artifact]";
// URI base = new URI("file:///home/erikb/dev/source/ivy-cache/");
// Transport transport = new FileSystemTransport(FileSystemOptions.CreateDirectories);
URI base = new URI("http://ivy.dev.midasplayer.com/repository/");
Transport transport = new HttpTransport();
Repository repository = new IvyRepository(base, ivyPattern, artifactPattern);
CacheIvyRepository cacheIvyRepository = new CacheIvyRepository(new File("repo"), repository, transport);
Group group = new Group("king");
Dependency dependency = new Dependency(group, new UnresolvedArtifact("plataforma", new VersionPattern("0.193.5")),
new ConfigurationMapping(MappingRules.simple("runtime")), true);
final DependencyResolver resolver = new DependencyResolverImpl(cacheIvyRepository, transport);
resolver.resolve(new File("libs"), "runtime", Collections.singletonList(dependency));
}
}