use of org.apache.ivy.plugins.lock.LockStrategy in project ant-ivy by apache.
the class XmlSettingsParser method endDocument.
@Override
public void endDocument() throws SAXException {
if (defaultResolver != null) {
ivy.setDefaultResolver(ivy.substitute(defaultResolver));
}
if (defaultCM != null) {
ConflictManager conflictManager = ivy.getConflictManager(ivy.substitute(defaultCM));
if (conflictManager == null) {
throw new IllegalArgumentException("unknown conflict manager " + ivy.substitute(defaultCM));
}
ivy.setDefaultConflictManager(conflictManager);
}
if (defaultLatest != null) {
LatestStrategy latestStrategy = ivy.getLatestStrategy(ivy.substitute(defaultLatest));
if (latestStrategy == null) {
throw new IllegalArgumentException("unknown latest strategy " + ivy.substitute(defaultLatest));
}
ivy.setDefaultLatestStrategy(latestStrategy);
}
if (defaultCacheManager != null) {
RepositoryCacheManager cache = ivy.getRepositoryCacheManager(ivy.substitute(defaultCacheManager));
if (cache == null) {
throw new IllegalArgumentException("unknown cache manager " + ivy.substitute(defaultCacheManager));
}
ivy.setDefaultRepositoryCacheManager(cache);
}
if (defaultCircular != null) {
CircularDependencyStrategy strategy = ivy.getCircularDependencyStrategy(ivy.substitute(defaultCircular));
if (strategy == null) {
throw new IllegalArgumentException("unknown circular dependency strategy " + ivy.substitute(defaultCircular));
}
ivy.setCircularDependencyStrategy(strategy);
}
if (defaultLock != null) {
LockStrategy strategy = ivy.getLockStrategy(ivy.substitute(defaultLock));
if (strategy == null) {
throw new IllegalArgumentException("unknown lock strategy " + ivy.substitute(defaultLock));
}
ivy.setDefaultLockStrategy(strategy);
}
}
use of org.apache.ivy.plugins.lock.LockStrategy in project ant-ivy by apache.
the class XmlSettingsParserTest method testLockingStrategies.
@Test
public void testLockingStrategies() throws Exception {
IvySettings settings = new IvySettings();
XmlSettingsParser parser = new XmlSettingsParser(settings);
parser.parse(XmlSettingsParserTest.class.getResource("ivysettings-lock-strategies.xml"));
LockStrategy lockStrategy = settings.getLockStrategy("test");
assertNotNull(lockStrategy);
assertTrue(lockStrategy instanceof MyLockStrategy);
}
Aggregations