use of org.apache.ivy.plugins.version.ChainVersionMatcher in project ant-ivy by apache.
the class XmlSettingsParserTest method testVersionMatchers2.
@Test
public void testVersionMatchers2() throws Exception {
IvySettings settings = new IvySettings();
XmlSettingsParser parser = new XmlSettingsParser(settings);
parser.parse(XmlSettingsParserTest.class.getResource("ivysettings-vmatcher2.xml"));
VersionMatcher mock = settings.getVersionMatcher("vmock");
assertNotNull(mock);
assertTrue(mock instanceof MockVersionMatcher);
VersionMatcher v = settings.getVersionMatcher();
assertTrue(v instanceof ChainVersionMatcher);
ChainVersionMatcher chain = (ChainVersionMatcher) v;
assertEquals(5, chain.getMatchers().size());
assertTrue(chain.getMatchers().contains(mock));
}
use of org.apache.ivy.plugins.version.ChainVersionMatcher in project ant-ivy by apache.
the class XmlSettingsParserTest method testVersionMatchers1.
@Test
public void testVersionMatchers1() throws Exception {
IvySettings settings = new IvySettings();
XmlSettingsParser parser = new XmlSettingsParser(settings);
parser.parse(XmlSettingsParserTest.class.getResource("ivysettings-vmatcher1.xml"));
VersionMatcher mock = settings.getVersionMatcher("vmock");
assertNotNull(mock);
assertTrue(mock instanceof MockVersionMatcher);
VersionMatcher v = settings.getVersionMatcher();
assertTrue(v instanceof ChainVersionMatcher);
ChainVersionMatcher chain = (ChainVersionMatcher) v;
assertEquals(3, chain.getMatchers().size());
assertTrue(chain.getMatchers().contains(mock));
assertTrue(chain.getMatchers().contains(settings.getVersionMatcher("exact")));
assertTrue(chain.getMatchers().contains(settings.getVersionMatcher("latest")));
}
use of org.apache.ivy.plugins.version.ChainVersionMatcher in project ant-ivy by apache.
the class IvySettings method addVersionMatcher.
public synchronized void addVersionMatcher(VersionMatcher vmatcher) {
init(vmatcher);
versionMatchers.put(vmatcher.getName(), vmatcher);
if (versionMatcher == null) {
versionMatcher = new ChainVersionMatcher();
addVersionMatcher(new ExactVersionMatcher());
}
if (versionMatcher instanceof ChainVersionMatcher) {
ChainVersionMatcher chain = (ChainVersionMatcher) versionMatcher;
chain.add(vmatcher);
}
}
Aggregations