Search in sources :

Example 1 with MockVersionMatcher

use of org.apache.ivy.plugins.version.MockVersionMatcher 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));
}
Also used : MockVersionMatcher(org.apache.ivy.plugins.version.MockVersionMatcher) ChainVersionMatcher(org.apache.ivy.plugins.version.ChainVersionMatcher) MockVersionMatcher(org.apache.ivy.plugins.version.MockVersionMatcher) MavenTimedSnapshotVersionMatcher(org.apache.ivy.plugins.version.MavenTimedSnapshotVersionMatcher) VersionMatcher(org.apache.ivy.plugins.version.VersionMatcher) ChainVersionMatcher(org.apache.ivy.plugins.version.ChainVersionMatcher) Test(org.junit.Test) ModuleDescriptorParserRegistryTest(org.apache.ivy.plugins.parser.ModuleDescriptorParserRegistryTest)

Example 2 with MockVersionMatcher

use of org.apache.ivy.plugins.version.MockVersionMatcher 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")));
}
Also used : MockVersionMatcher(org.apache.ivy.plugins.version.MockVersionMatcher) ChainVersionMatcher(org.apache.ivy.plugins.version.ChainVersionMatcher) MockVersionMatcher(org.apache.ivy.plugins.version.MockVersionMatcher) MavenTimedSnapshotVersionMatcher(org.apache.ivy.plugins.version.MavenTimedSnapshotVersionMatcher) VersionMatcher(org.apache.ivy.plugins.version.VersionMatcher) ChainVersionMatcher(org.apache.ivy.plugins.version.ChainVersionMatcher) Test(org.junit.Test) ModuleDescriptorParserRegistryTest(org.apache.ivy.plugins.parser.ModuleDescriptorParserRegistryTest)

Aggregations

ModuleDescriptorParserRegistryTest (org.apache.ivy.plugins.parser.ModuleDescriptorParserRegistryTest)2 ChainVersionMatcher (org.apache.ivy.plugins.version.ChainVersionMatcher)2 MavenTimedSnapshotVersionMatcher (org.apache.ivy.plugins.version.MavenTimedSnapshotVersionMatcher)2 MockVersionMatcher (org.apache.ivy.plugins.version.MockVersionMatcher)2 VersionMatcher (org.apache.ivy.plugins.version.VersionMatcher)2 Test (org.junit.Test)2