maven-doxia-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vsive...@apache.org
Subject svn commit: r542488 - /maven/doxia/doxia-sitetools/trunk/doxia-decoration-model/src/test/java/org/apache/maven/doxia/site/decoration/inheritance/PathDescriptorTest.java
Date Tue, 29 May 2007 11:15:49 GMT
Author: vsiveton
Date: Tue May 29 04:15:48 2007
New Revision: 542488

URL: http://svn.apache.org/viewvc?view=rev&rev=542488
Log:
o fixed the new tests (r542333) to work on windows

Modified:
    maven/doxia/doxia-sitetools/trunk/doxia-decoration-model/src/test/java/org/apache/maven/doxia/site/decoration/inheritance/PathDescriptorTest.java

Modified: maven/doxia/doxia-sitetools/trunk/doxia-decoration-model/src/test/java/org/apache/maven/doxia/site/decoration/inheritance/PathDescriptorTest.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia-sitetools/trunk/doxia-decoration-model/src/test/java/org/apache/maven/doxia/site/decoration/inheritance/PathDescriptorTest.java?view=diff&rev=542488&r1=542487&r2=542488
==============================================================================
--- maven/doxia/doxia-sitetools/trunk/doxia-decoration-model/src/test/java/org/apache/maven/doxia/site/decoration/inheritance/PathDescriptorTest.java
(original)
+++ maven/doxia/doxia-sitetools/trunk/doxia-decoration-model/src/test/java/org/apache/maven/doxia/site/decoration/inheritance/PathDescriptorTest.java
Tue May 29 04:15:48 2007
@@ -19,6 +19,10 @@
  * under the License.
  */
 
+import java.io.File;
+
+import org.codehaus.plexus.util.StringUtils;
+
 import junit.framework.TestCase;
 
 /**
@@ -26,10 +30,8 @@
  *
  * @author <a href="mailto:henning@apache.org">Henning P. Schmiedehausen</a>
  */
-
 public class PathDescriptorTest extends TestCase
 {
-
     public void testAbsPath() throws Exception
     {
         String path = "absolutePath";
@@ -293,8 +295,17 @@
         assertNotNull( desc.getPathUrl() );
         assertNotNull( desc.getPath() );
         assertNotNull( desc.getLocation() );
-        assertEquals( "wrong path", base + "/" + path, desc.getPath() );
-        assertEquals( "wrong location", base + "/" + path, desc.getLocation() );
+        if ( System.getProperty( "os.name" ).toLowerCase().indexOf( "windows" ) != -1 )
+        {
+            String s = StringUtils.replace( new File( base + "/" + path ).toURL().toString(),
"file:", "" );
+            assertEquals( "wrong path", s, desc.getPath() );
+            assertEquals( "wrong location", s, desc.getLocation() );
+        }
+        else
+        {
+            assertEquals( "wrong path", base + "/" + path, desc.getPath() );
+            assertEquals( "wrong location", base + "/" + path, desc.getLocation() );
+        }
     }
 
     public void testFileBaseRelPath() throws Exception
@@ -310,8 +321,17 @@
         assertNotNull( desc.getPathUrl() );
         assertNotNull( desc.getPath() );
         assertNotNull( desc.getLocation() );
-        assertEquals( "wrong path", base + "/" + path, desc.getPath() );
-        assertEquals( "wrong location", base + "/" + path, desc.getLocation() );
+        if ( System.getProperty( "os.name" ).toLowerCase().indexOf( "windows" ) != -1 )
+        {
+            String s = StringUtils.replace( new File( base + "/" + path ).toURL().toString(),
"file:", "" );
+            assertEquals( "wrong path", s, desc.getPath() );
+            assertEquals( "wrong location", s, desc.getLocation() );
+        }
+        else
+        {
+            assertEquals( "wrong path", base + "/" + path, desc.getPath() );
+            assertEquals( "wrong location", base + "/" + path, desc.getLocation() );
+        }
     }
 
     public void testFileBaseEmptyAbsPath() throws Exception
@@ -327,8 +347,17 @@
         assertNotNull( desc.getPathUrl() );
         assertNotNull( desc.getPath() );
         assertNotNull( desc.getLocation() );
-        assertEquals( "wrong path", base, desc.getPath() );
-        assertEquals( "wrong location", base, desc.getLocation() );
+        if ( System.getProperty( "os.name" ).toLowerCase().indexOf( "windows" ) != -1 )
+        {
+            String s = StringUtils.replace( new File( base ).toURL().toString(), "file:",
"" );
+            assertEquals( "wrong path", s, desc.getPath() );
+            assertEquals( "wrong location", s, desc.getLocation() );
+        }
+        else
+        {
+            assertEquals( "wrong path", base, desc.getPath() );
+            assertEquals( "wrong location", base, desc.getLocation() );
+        }
     }
 
     public void testFileBaseEmptyRelPath() throws Exception
@@ -344,8 +373,17 @@
         assertNotNull( desc.getPathUrl() );
         assertNotNull( desc.getPath() );
         assertNotNull( desc.getLocation() );
-        assertEquals( "wrong path", base, desc.getPath() );
-        assertEquals( "wrong location", base, desc.getLocation() );
+        if ( System.getProperty( "os.name" ).toLowerCase().indexOf( "windows" ) != -1 )
+        {
+            String s = StringUtils.replace( new File( base ).toURL().toString(), "file:",
"" );
+            assertEquals( "wrong path", s, desc.getPath() );
+            assertEquals( "wrong location", s, desc.getLocation() );
+        }
+        else
+        {
+            assertEquals( "wrong path", base, desc.getPath() );
+            assertEquals( "wrong location", base, desc.getLocation() );
+        }
     }
 
     public void testFileBaseNullPath() throws Exception
@@ -378,8 +416,17 @@
         assertNotNull( desc.getPathUrl() );
         assertNotNull( desc.getPath() );
         assertNotNull( desc.getLocation() );
-        assertEquals( "wrong path", base + "/" + path, desc.getPath() );
-        assertEquals( "wrong location", base + "/" + path, desc.getLocation() );
+        if ( System.getProperty( "os.name" ).toLowerCase().indexOf( "windows" ) != -1 )
+        {
+            String s = StringUtils.replace( new File( base + "/" + path ).toURL().toString(),
"file:", "" );
+            assertEquals( "wrong path", s, desc.getPath() );
+            assertEquals( "wrong location", s, desc.getLocation() );
+        }
+        else
+        {
+            assertEquals( "wrong path", base + "/" + path, desc.getPath() );
+            assertEquals( "wrong location", base + "/" + path, desc.getLocation() );
+        }
     }
 
     public void testPathBaseRelPath() throws Exception
@@ -395,8 +442,17 @@
         assertNotNull( desc.getPathUrl() );
         assertNotNull( desc.getPath() );
         assertNotNull( desc.getLocation() );
-        assertEquals( "wrong path", base + "/" + path, desc.getPath() );
-        assertEquals( "wrong location", base + "/" + path, desc.getLocation() );
+        if ( System.getProperty( "os.name" ).toLowerCase().indexOf( "windows" ) != -1 )
+        {
+            String s = StringUtils.replace( new File( base + "/" + path ).toURL().toString(),
"file:", "" );
+            assertEquals( "wrong path", s, desc.getPath() );
+            assertEquals( "wrong location", s, desc.getLocation() );
+        }
+        else
+        {
+            assertEquals( "wrong path", base + "/" + path, desc.getPath() );
+            assertEquals( "wrong location", base + "/" + path, desc.getLocation() );
+        }
     }
 
     public void testPathBaseEmptyAbsPath() throws Exception
@@ -412,8 +468,17 @@
         assertNotNull( desc.getPathUrl() );
         assertNotNull( desc.getPath() );
         assertNotNull( desc.getLocation() );
-        assertEquals( "wrong path", base, desc.getPath() );
-        assertEquals( "wrong location", base, desc.getLocation() );
+        if ( System.getProperty( "os.name" ).toLowerCase().indexOf( "windows" ) != -1 )
+        {
+            String s = StringUtils.replace( new File( base ).toURL().toString(), "file:",
"" );
+            assertEquals( "wrong path", s, desc.getPath() );
+            assertEquals( "wrong location", s, desc.getLocation() );
+        }
+        else
+        {
+            assertEquals( "wrong path", base, desc.getPath() );
+            assertEquals( "wrong location", base, desc.getLocation() );
+        }
     }
 
     public void testPathBaseEmptyRelPath() throws Exception
@@ -429,8 +494,17 @@
         assertNotNull( desc.getPathUrl() );
         assertNotNull( desc.getPath() );
         assertNotNull( desc.getLocation() );
-        assertEquals( "wrong path", base, desc.getPath() );
-        assertEquals( "wrong location", base, desc.getLocation() );
+        if ( System.getProperty( "os.name" ).toLowerCase().indexOf( "windows" ) != -1 )
+        {
+            String s = StringUtils.replace( new File( base ).toURL().toString(), "file:",
"" );
+            assertEquals( "wrong path", s, desc.getPath() );
+            assertEquals( "wrong location", s, desc.getLocation() );
+        }
+        else
+        {
+            assertEquals( "wrong path", base, desc.getPath() );
+            assertEquals( "wrong location", base, desc.getLocation() );
+        }
     }
 
     public void testPathBaseNullPath() throws Exception
@@ -446,7 +520,16 @@
         assertNotNull( desc.getPathUrl() );
         assertNotNull( desc.getPath() );
         assertNotNull( desc.getLocation() );
-        assertEquals( "wrong path", base, desc.getPath() );
-        assertEquals( "wrong location", base, desc.getLocation() );
+        if ( System.getProperty( "os.name" ).toLowerCase().indexOf( "windows" ) != -1 )
+        {
+            String s = StringUtils.replace( new File( base ).toURL().toString(), "file:",
"" );
+            assertEquals( "wrong path", s, desc.getPath() );
+            assertEquals( "wrong location", s, desc.getLocation() );
+        }
+        else
+        {
+            assertEquals( "wrong path", base, desc.getPath() );
+            assertEquals( "wrong location", base, desc.getLocation() );
+        }
     }
 }



Mime
View raw message