use of org.apache.ivy.plugins.resolver.ChainResolver in project ant-ivy by apache.
the class XmlSettingsParserTest method testRef.
@Test
public void testRef() throws Exception {
IvySettings settings = new IvySettings();
XmlSettingsParser parser = new XmlSettingsParser(settings);
parser.parse(XmlSettingsParserTest.class.getResource("ivysettings-ref.xml"));
DependencyResolver internal = settings.getResolver("internal");
assertNotNull(internal);
assertTrue(internal instanceof ChainResolver);
ChainResolver chain = (ChainResolver) internal;
List<DependencyResolver> subresolvers = chain.getResolvers();
assertNotNull(subresolvers);
assertEquals(2, subresolvers.size());
FileSystemResolver fsInt1 = (FileSystemResolver) subresolvers.get(0);
assertEquals("fs", fsInt1.getName());
List<String> ivyPatterns = fsInt1.getIvyPatterns();
assertNotNull(ivyPatterns);
assertEquals(1, ivyPatterns.size());
assertLocationEquals("sharedrep/[organisation]/[module]/ivys/ivy-[revision].xml", ivyPatterns.get(0));
DependencyResolver external = settings.getResolver("external");
assertNotNull(external);
assertTrue(external instanceof ChainResolver);
chain = (ChainResolver) external;
subresolvers = chain.getResolvers();
assertNotNull(subresolvers);
assertEquals(1, subresolvers.size());
FileSystemResolver fsInt2 = (FileSystemResolver) subresolvers.get(0);
assertEquals("fs", fsInt2.getName());
ivyPatterns = fsInt2.getIvyPatterns();
assertNotNull(ivyPatterns);
assertEquals(1, ivyPatterns.size());
assertLocationEquals("sharedrep/[organisation]/[module]/ivys/ivy-[revision].xml", ivyPatterns.get(0));
}
use of org.apache.ivy.plugins.resolver.ChainResolver in project ant-ivy by apache.
the class XmlSettingsParserTest method testIncludeSpecialCharInName.
@Test
public void testIncludeSpecialCharInName() throws Exception {
IvySettings settings = new IvySettings();
XmlSettingsParser parser = new XmlSettingsParser(settings);
parser.parse(XmlSettingsParserTest.class.getResource("ivysettings-include-special.xml"));
DependencyResolver def = settings.getResolver("default");
assertNotNull(def);
assertTrue(def instanceof ChainResolver);
ChainResolver chain = (ChainResolver) def;
List<DependencyResolver> subresolvers = chain.getResolvers();
assertNotNull(subresolvers);
assertEquals(2, subresolvers.size());
FileSystemResolver fsInt1 = (FileSystemResolver) subresolvers.get(0);
assertEquals("default-fs1", fsInt1.getName());
List<String> ivyPatterns = fsInt1.getIvyPatterns();
assertNotNull(ivyPatterns);
assertEquals(1, ivyPatterns.size());
assertLocationEquals("path/to/myrep/[organisation]/[module]/[type]s/[artifact]-[revision].[ext]", ivyPatterns.get(0));
DependencyResolver inc = settings.getResolver("includeworks");
assertNotNull(inc);
assertTrue(inc instanceof ChainResolver);
chain = (ChainResolver) inc;
subresolvers = chain.getResolvers();
assertNotNull(subresolvers);
assertEquals(2, subresolvers.size());
fsInt1 = (FileSystemResolver) subresolvers.get(0);
assertEquals("includeworks-fs1", fsInt1.getName());
ivyPatterns = fsInt1.getIvyPatterns();
assertNotNull(ivyPatterns);
assertEquals(1, ivyPatterns.size());
assertLocationEquals("included/myrep/[organisation]/[module]/[type]s/[artifact]-[revision].[ext]", ivyPatterns.get(0));
// properties defined in included file should be available to including file (IVY-780)
assertEquals("myvalue", settings.getVariable("ivy.test.prop"));
}
use of org.apache.ivy.plugins.resolver.ChainResolver in project ant-ivy by apache.
the class UpdateSiteAndIbiblioResolverTest method setUp.
@Before
public void setUp() throws Exception {
settings = new IvySettings();
chain = new ChainResolver();
chain.setName("chain");
chain.setSettings(settings);
resolver = new UpdateSiteResolver();
resolver.setName("ivyde-repo");
resolver.setUrl(new File("test/test-p2/ivyde-repo").toURI().toURL().toExternalForm());
resolver.setSettings(settings);
resolver2 = new IBiblioResolver();
resolver2.setName("maven2");
settings.setVariable("ivy.ibiblio.default.artifact.root", DEFAULT_M2_ROOT);
settings.setVariable("ivy.ibiblio.default.artifact.pattern", "[organisation]/[module]/[revision]/[artifact]-[revision].[ext]");
resolver2.setSettings(settings);
chain.add(resolver);
chain.add(resolver2);
settings.addResolver(chain);
settings.setDefaultResolver("chain");
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 (RepositoryCacheManager cache : caches) {
cache.clean();
}
data = new ResolveData(ivy.getResolveEngine(), new ResolveOptions());
}
use of org.apache.ivy.plugins.resolver.ChainResolver in project ant-ivy by apache.
the class OnlineXmlSettingsParserTest method testIncludeHttpAbsoluteFile.
@Test
public void testIncludeHttpAbsoluteFile() throws Exception {
// Use a settings file via http that use an include with absolute file
// WARNING : this test will only work if the test are launched from the project root
// directory
configureURLHandler();
IvySettings settings = new IvySettings();
XmlSettingsParser parser = new XmlSettingsParser(settings);
parser.parse(new URL("http://ant.apache.org/ivy/test/ivysettings-include-http-absolute-file.xml"));
DependencyResolver inc = settings.getResolver("includeworks");
assertNotNull(inc);
assertTrue(inc instanceof ChainResolver);
}
use of org.apache.ivy.plugins.resolver.ChainResolver in project ant-ivy by apache.
the class XmlSettingsParserTest method testIncludeAbsoluteFile.
@Test
public void testIncludeAbsoluteFile() throws Exception {
// WARNING : this test will only work if the test are launched from the project root
// directory
IvySettings settings = new IvySettings();
XmlSettingsParser parser = new XmlSettingsParser(settings);
parser.parse(XmlSettingsParserTest.class.getResource("ivysettings-include-absolute-file.xml"));
DependencyResolver inc = settings.getResolver("includeworks");
assertNotNull(inc);
assertTrue(inc instanceof ChainResolver);
}
Aggregations