Search in sources :

Example 1 with LockStrategy

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);
    }
}
Also used : CircularDependencyStrategy(org.apache.ivy.plugins.circular.CircularDependencyStrategy) RepositoryCacheManager(org.apache.ivy.core.cache.RepositoryCacheManager) LatestStrategy(org.apache.ivy.plugins.latest.LatestStrategy) ConflictManager(org.apache.ivy.plugins.conflict.ConflictManager) LockStrategy(org.apache.ivy.plugins.lock.LockStrategy)

Example 2 with LockStrategy

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);
}
Also used : LockStrategy(org.apache.ivy.plugins.lock.LockStrategy) AbstractLockStrategy(org.apache.ivy.plugins.lock.AbstractLockStrategy) Test(org.junit.Test) ModuleDescriptorParserRegistryTest(org.apache.ivy.plugins.parser.ModuleDescriptorParserRegistryTest)

Aggregations

LockStrategy (org.apache.ivy.plugins.lock.LockStrategy)2 RepositoryCacheManager (org.apache.ivy.core.cache.RepositoryCacheManager)1 CircularDependencyStrategy (org.apache.ivy.plugins.circular.CircularDependencyStrategy)1 ConflictManager (org.apache.ivy.plugins.conflict.ConflictManager)1 LatestStrategy (org.apache.ivy.plugins.latest.LatestStrategy)1 AbstractLockStrategy (org.apache.ivy.plugins.lock.AbstractLockStrategy)1 ModuleDescriptorParserRegistryTest (org.apache.ivy.plugins.parser.ModuleDescriptorParserRegistryTest)1 Test (org.junit.Test)1