ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xav...@apache.org
Subject svn commit: r600305 - in /ant/ivy/core/trunk: src/java/org/apache/ivy/core/settings/XmlSettingsParser.java test/java/org/apache/ivy/core/settings/XmlSettingsParserTest.java test/java/org/apache/ivy/core/settings/ivysettings-lock-strategies.xml
Date Sun, 02 Dec 2007 15:05:20 GMT
Author: xavier
Date: Sun Dec  2 07:05:19 2007
New Revision: 600305

URL: http://svn.apache.org/viewvc?rev=600305&view=rev
Log:
allow to define new lock strategies in settings (IVY-654)

Added:
    ant/ivy/core/trunk/test/java/org/apache/ivy/core/settings/ivysettings-lock-strategies.xml
  (with props)
Modified:
    ant/ivy/core/trunk/src/java/org/apache/ivy/core/settings/XmlSettingsParser.java
    ant/ivy/core/trunk/test/java/org/apache/ivy/core/settings/XmlSettingsParserTest.java

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/settings/XmlSettingsParser.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/settings/XmlSettingsParser.java?rev=600305&r1=600304&r2=600305&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/settings/XmlSettingsParser.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/settings/XmlSettingsParser.java Sun Dec
 2 07:05:19 2007
@@ -50,7 +50,7 @@
 
     private List configuratorTags = Arrays.asList(new String[] {"resolvers", "namespaces",
             "parsers", "latest-strategies", "conflict-managers", "outputters", "version-matchers",
-            "statuses", "circular-dependency-strategies", "triggers"});
+            "statuses", "circular-dependency-strategies", "triggers", "lock-strategies"});
 
     private IvySettings ivy;
 

Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/core/settings/XmlSettingsParserTest.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/core/settings/XmlSettingsParserTest.java?rev=600305&r1=600304&r2=600305&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/core/settings/XmlSettingsParserTest.java (original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/core/settings/XmlSettingsParserTest.java Sun
Dec  2 07:05:19 2007
@@ -24,11 +24,14 @@
 import junit.framework.TestCase;
 
 import org.apache.ivy.core.cache.ResolutionCacheManager;
+import org.apache.ivy.core.module.descriptor.Artifact;
 import org.apache.ivy.core.module.id.ModuleId;
 import org.apache.ivy.core.report.ResolveReport;
 import org.apache.ivy.plugins.latest.LatestRevisionStrategy;
 import org.apache.ivy.plugins.latest.LatestStrategy;
 import org.apache.ivy.plugins.latest.LatestTimeStrategy;
+import org.apache.ivy.plugins.lock.AbstractLockStrategy;
+import org.apache.ivy.plugins.lock.LockStrategy;
 import org.apache.ivy.plugins.parser.ModuleDescriptorParserRegistry;
 import org.apache.ivy.plugins.parser.ModuleDescriptorParserRegistryTest;
 import org.apache.ivy.plugins.report.ReportOutputter;
@@ -395,8 +398,17 @@
         assertTrue(testOutputter instanceof MyOutputter);
     }
 
-    public static class MyOutputter implements ReportOutputter {
+    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);
+    }
 
+    public static class MyOutputter implements ReportOutputter {
         public void output(ResolveReport report, ResolutionCacheManager cacheMgr) {
         }
 
@@ -404,5 +416,14 @@
             return "test";
         }
 
+    }
+    
+    public static class MyLockStrategy extends AbstractLockStrategy {
+        public boolean lockArtifact(Artifact artifact, File artifactFileToDownload) throws
InterruptedException {
+            return false;
+        }
+
+        public void unlockArtifact(Artifact artifact, File artifactFileToDownload) {
+        }
     }
 }

Added: ant/ivy/core/trunk/test/java/org/apache/ivy/core/settings/ivysettings-lock-strategies.xml
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/core/settings/ivysettings-lock-strategies.xml?rev=600305&view=auto
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/core/settings/ivysettings-lock-strategies.xml
(added)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/core/settings/ivysettings-lock-strategies.xml
Sun Dec  2 07:05:19 2007
@@ -0,0 +1,25 @@
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one
+   or more contributor license agreements.  See the NOTICE file
+   distributed with this work for additional information
+   regarding copyright ownership.  The ASF licenses this file
+   to you under the Apache License, Version 2.0 (the
+   "License"); you may not use this file except in compliance
+   with the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing,
+   software distributed under the License is distributed on an
+   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+   KIND, either express or implied.  See the License for the
+   specific language governing permissions and limitations
+   under the License.    
+-->
+<ivysettings>
+	<typedef name="my-lock" 
+			classname="org.apache.ivy.core.settings.XmlSettingsParserTest$MyLockStrategy"/>
+	<lock-strategies>
+		<my-lock name="test" />
+	</lock-strategies>
+</ivysettings>

Propchange: ant/ivy/core/trunk/test/java/org/apache/ivy/core/settings/ivysettings-lock-strategies.xml
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message