ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From maart...@apache.org
Subject svn commit: r983793 - /ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorWriterTest.java
Date Mon, 09 Aug 2010 19:41:25 GMT
Author: maartenc
Date: Mon Aug  9 19:41:24 2010
New Revision: 983793

URL: http://svn.apache.org/viewvc?rev=983793&view=rev
Log:
Use dedicated options class to pass configuration options to PomModuleDescriptorWriter.

Modified:
    ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorWriterTest.java

Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorWriterTest.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorWriterTest.java?rev=983793&r1=983792&r2=983793&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorWriterTest.java
(original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorWriterTest.java
Mon Aug  9 19:41:24 2010
@@ -44,7 +44,7 @@ public class PomModuleDescriptorWriterTe
     public void testSimple() throws Exception {
         ModuleDescriptor md = PomModuleDescriptorParser.getInstance().parseDescriptor(
             new IvySettings(), getClass().getResource("test-simple.pom"), false);
-        PomModuleDescriptorWriter.write(md, null, LICENSE, PomModuleDescriptorWriter.DEFAULT_MAPPING,
_dest);
+        PomModuleDescriptorWriter.write(md, _dest, getWriterOptions());
         assertTrue(_dest.exists());
 
         String wrote = FileUtil.readEntirely(new BufferedReader(new FileReader(_dest))).replaceAll(
@@ -57,7 +57,7 @@ public class PomModuleDescriptorWriterTe
     public void testSimpleDependencies() throws Exception {
         ModuleDescriptor md = PomModuleDescriptorParser.getInstance().parseDescriptor(
             new IvySettings(), getClass().getResource("test-dependencies.pom"), false);
-        PomModuleDescriptorWriter.write(md, null, LICENSE, PomModuleDescriptorWriter.DEFAULT_MAPPING,
_dest);
+        PomModuleDescriptorWriter.write(md, _dest, getWriterOptions());
         assertTrue(_dest.exists());
 
         String wrote = FileUtil.readEntirely(new BufferedReader(new FileReader(_dest))).replaceAll(
@@ -70,7 +70,7 @@ public class PomModuleDescriptorWriterTe
     public void testDependenciesWithScope() throws Exception {
         ModuleDescriptor md = PomModuleDescriptorParser.getInstance().parseDescriptor(
             new IvySettings(), getClass().getResource("test-dependencies-with-scope.pom"),
false);
-        PomModuleDescriptorWriter.write(md, null, LICENSE, PomModuleDescriptorWriter.DEFAULT_MAPPING,
_dest);
+        PomModuleDescriptorWriter.write(md, _dest, getWriterOptions());
         assertTrue(_dest.exists());
 
         String wrote = FileUtil.readEntirely(new BufferedReader(new FileReader(_dest))).replaceAll(
@@ -83,7 +83,7 @@ public class PomModuleDescriptorWriterTe
     public void testOptional() throws Exception {
         ModuleDescriptor md = PomModuleDescriptorParser.getInstance().parseDescriptor(
             new IvySettings(), getClass().getResource("test-optional.pom"), false);
-        PomModuleDescriptorWriter.write(md, null, LICENSE, PomModuleDescriptorWriter.DEFAULT_MAPPING,
_dest);
+        PomModuleDescriptorWriter.write(md, _dest, getWriterOptions());
         assertTrue(_dest.exists());
 
         String wrote = FileUtil.readEntirely(new BufferedReader(new FileReader(_dest))).replaceAll(
@@ -96,7 +96,7 @@ public class PomModuleDescriptorWriterTe
     public void testPackaging() throws Exception {
         ModuleDescriptor md = PomModuleDescriptorParser.getInstance().parseDescriptor(
             new IvySettings(), getClass().getResource("test-packaging.pom"), false);
-        PomModuleDescriptorWriter.write(md, null, LICENSE, PomModuleDescriptorWriter.DEFAULT_MAPPING,
_dest);
+        PomModuleDescriptorWriter.write(md, _dest, getWriterOptions());
         assertTrue(_dest.exists());
 
         String wrote = FileUtil.readEntirely(new BufferedReader(new FileReader(_dest))).replaceAll(
@@ -109,7 +109,7 @@ public class PomModuleDescriptorWriterTe
     public void testWriteCompileConfigurationOnly() throws Exception {
         ModuleDescriptor md = PomModuleDescriptorParser.getInstance().parseDescriptor(
             new IvySettings(), getClass().getResource("test-dependencies-with-scope.pom"),
false);
-        PomModuleDescriptorWriter.write(md, new String[] {"compile"}, LICENSE, PomModuleDescriptorWriter.DEFAULT_MAPPING,
_dest);
+        PomModuleDescriptorWriter.write(md, _dest, getWriterOptions().setConfs(new String[]
{"compile"}));
         assertTrue(_dest.exists());
 
         String wrote = FileUtil.readEntirely(new BufferedReader(new FileReader(_dest))).replaceAll(
@@ -122,7 +122,7 @@ public class PomModuleDescriptorWriterTe
     public void testWriteRuntimeConfigurationOnly() throws Exception {
         ModuleDescriptor md = PomModuleDescriptorParser.getInstance().parseDescriptor(
             new IvySettings(), getClass().getResource("test-dependencies-with-scope.pom"),
false);
-        PomModuleDescriptorWriter.write(md, new String[] {"runtime"}, LICENSE, PomModuleDescriptorWriter.DEFAULT_MAPPING,
_dest);
+        PomModuleDescriptorWriter.write(md, _dest, getWriterOptions().setConfs(new String[]
{"runtime"}));
         assertTrue(_dest.exists());
 
         String wrote = FileUtil.readEntirely(new BufferedReader(new FileReader(_dest))).replaceAll(
@@ -135,7 +135,7 @@ public class PomModuleDescriptorWriterTe
     public void testWriteAllConfiguration() throws Exception {
         ModuleDescriptor md = PomModuleDescriptorParser.getInstance().parseDescriptor(
             new IvySettings(), getClass().getResource("test-dependencies-with-scope.pom"),
false);
-        PomModuleDescriptorWriter.write(md, new String[] {"*"}, LICENSE, PomModuleDescriptorWriter.DEFAULT_MAPPING,
_dest);
+        PomModuleDescriptorWriter.write(md, _dest, getWriterOptions().setConfs(new String[]
{"*"}));
         assertTrue(_dest.exists());
 
         String wrote = FileUtil.readEntirely(new BufferedReader(new FileReader(_dest))).replaceAll(
@@ -148,7 +148,7 @@ public class PomModuleDescriptorWriterTe
     public void testWriteAllExceptRuntimeConfiguration() throws Exception {
         ModuleDescriptor md = PomModuleDescriptorParser.getInstance().parseDescriptor(
             new IvySettings(), getClass().getResource("test-dependencies-with-scope.pom"),
false);
-        PomModuleDescriptorWriter.write(md, new String[] {"*", "!runtime"}, LICENSE, PomModuleDescriptorWriter.DEFAULT_MAPPING,
_dest);
+        PomModuleDescriptorWriter.write(md, _dest, getWriterOptions().setConfs(new String[]
{"*", "!runtime"}));
         assertTrue(_dest.exists());
 
         String wrote = FileUtil.readEntirely(new BufferedReader(new FileReader(_dest))).replaceAll(
@@ -162,6 +162,10 @@ public class PomModuleDescriptorWriterTe
         return FileUtil.readEntirely(new BufferedReader(new InputStreamReader(
             PomModuleDescriptorWriterTest.class.getResource(resource).openStream())));
     }
+    
+    private PomWriterOptions getWriterOptions() {
+        return (new PomWriterOptions()).setLicenseHeader(LICENSE);
+    }
 
     public void setUp() {
         // don't add ivy version to se static files for comparison



Mime
View raw message