]> source.dussan.org Git - archiva.git/commitdiff
cleanup formatting, and force all paths to use '/' so it works on Windows and Unix
authorBrett Porter <brett@apache.org>
Fri, 30 Dec 2005 04:05:25 +0000 (04:05 +0000)
committerBrett Porter <brett@apache.org>
Fri, 30 Dec 2005 04:05:25 +0000 (04:05 +0000)
git-svn-id: https://svn.apache.org/repos/asf/maven/repository-manager/trunk@359981 13f79535-47bb-0310-9956-ffa450edef68

maven-repository-discovery/src/test/java/org/apache/maven/repository/discovery/DefaultMetadataDiscovererTest.java

index 172779c89270b611a8b6ba4ceb1517919df2d0d5..f4df65bbf9e4d8a81557c2b5a924c336fc4837e8 100644 (file)
@@ -25,74 +25,83 @@ import org.codehaus.plexus.PlexusTestCase;
 /**
  * This class tests the DefaultMetadataDiscoverer class.
  */
-public class DefaultMetadataDiscovererTest extends PlexusTestCase {
-       private MetadataDiscoverer discoverer;
+public class DefaultMetadataDiscovererTest
+    extends PlexusTestCase
+{
+    private MetadataDiscoverer discoverer;
 
-       private File repositoryLocation;
+    private File repositoryLocation;
 
-       /**
-        * 
-        */
-       public void setUp() throws Exception {
-               super.setUp();
+    /**
+     *
+     */
+    public void setUp()
+        throws Exception
+    {
+        super.setUp();
 
-               discoverer = (MetadataDiscoverer) lookup(MetadataDiscoverer.ROLE,
-                               "default");
-               repositoryLocation = getTestFile("src/test/repository");
-       }
+        discoverer = (MetadataDiscoverer) lookup( MetadataDiscoverer.ROLE, "default" );
+        repositoryLocation = getTestFile( "src/test/repository" );
+    }
 
-       /**
-        * 
-        */
-       public void tearDown() throws Exception {
-               super.tearDown();
-               discoverer = null;
-       }
+    /**
+     *
+     */
+    public void tearDown()
+        throws Exception
+    {
+        super.tearDown();
+        discoverer = null;
+    }
 
-       /**
-        * Test DefaultMetadataDiscoverer when the all metadata paths are valid.
-        * 
-        */
-       public void testMetadataDiscovererSuccess() {
-               List metadataPaths = discoverer.discoverMetadata(repositoryLocation,
-                               null);
-               assertNotNull("Check metadata not null", metadataPaths);
-               assertTrue(metadataPaths.size() == 3);
-       }
+    /**
+     * Test DefaultMetadataDiscoverer when the all metadata paths are valid.
+     */
+    public void testMetadataDiscovererSuccess()
+    {
+        List metadataPaths = discoverer.discoverMetadata( repositoryLocation, null );
+        assertNotNull( "Check metadata not null", metadataPaths );
+        assertTrue( metadataPaths.size() == 3 );
+    }
 
-       /**
-        * Test if metadata file in wrong directory was added to the kickedOutPaths.
-        */
-       public void testKickoutWrongDirectory() {
-               List metadataPaths = discoverer.discoverMetadata(repositoryLocation,
-                               null);
-               Iterator iter = discoverer.getKickedOutPathsIterator();
-               boolean found = false;
-               while (iter.hasNext() && !found) {
-                       String dir = (String) iter.next();
-                       if (dir.equals("javax\\maven-metadata-repository.xml")) {
-                               found = true;
-                       }
-               }
-               assertTrue(found);
-       }
+    /**
+     * Test if metadata file in wrong directory was added to the kickedOutPaths.
+     */
+    public void testKickoutWrongDirectory()
+    {
+        List metadataPaths = discoverer.discoverMetadata( repositoryLocation, null );
+        Iterator iter = discoverer.getKickedOutPathsIterator();
+        boolean found = false;
+        while ( iter.hasNext() && !found )
+        {
+            String dir = (String) iter.next();
+            String normalizedDir = dir.replace( '\\', '/' );
+            if ( "javax/maven-metadata-repository.xml".equals( normalizedDir ) )
+            {
+                found = true;
+            }
+        }
+        assertTrue( found );
+    }
 
-       /**
-        * Test if blank metadata file was added to the kickedOutPaths.
-        */
-       public void testKickoutBlankMetadata() {
-               List metadataPaths = discoverer.discoverMetadata(repositoryLocation,
-                               null);
-               Iterator iter = discoverer.getKickedOutPathsIterator();
-               boolean found = false;
-               while (iter.hasNext() && !found) {
-                       String dir = (String) iter.next();
-                       if (dir
-                                       .equals("org\\apache\\maven\\some-ejb\\1.0\\maven-metadata-repository.xml")) {
-                               found = true;
-                       }
-               }
-               assertTrue(found);
-       }
+    /**
+     * Test if blank metadata file was added to the kickedOutPaths.
+     */
+    public void testKickoutBlankMetadata()
+    {
+        List metadataPaths = discoverer.discoverMetadata( repositoryLocation, null );
+        Iterator iter = discoverer.getKickedOutPathsIterator();
+        boolean found = false;
+        while ( iter.hasNext() && !found )
+        {
+            String dir = (String) iter.next();
+            String normalizedDir = dir.replace( '\\', '/' );
+            if ( "org/apache/maven/some-ejb/1.0/maven-metadata-repository.xml".equals( normalizedDir ) )
+            {
+                found = true;
+            }
+        }
+        assertTrue( found );
+    }
 
 }