]> source.dussan.org Git - archiva.git/commitdiff
add an other unit to test directory content with both files and directory
authorOlivier Lamy <olamy@apache.org>
Tue, 15 May 2012 11:25:10 +0000 (11:25 +0000)
committerOlivier Lamy <olamy@apache.org>
Tue, 15 May 2012 11:25:10 +0000 (11:25 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1338653 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/BrowseServiceTest.java

index e4bf009a465e02fefa11662ad1f8cb0b5ae20468..9d3d03d86c1db40958a788fef4ccf118decc8062 100644 (file)
@@ -275,4 +275,33 @@ public class BrowseServiceTest
             new ArtifactContentEntry( "org/apache", false, 1 ) );
         deleteTestRepo( testRepoId );
     }
+
+    @Test
+    public void readArtifactContentEntriesFilesAndDirectories()
+        throws Exception
+    {
+        String testRepoId = "test-repo";
+        // force guest user creation if not exists
+        if ( getUserService( authorizationHeader ).getGuestUser() == null )
+        {
+            assertNotNull( getUserService( authorizationHeader ).createGuestUser() );
+        }
+
+        createAndIndexRepo( testRepoId, new File( getBasedir(), "src/test/repo-with-osgi" ).getAbsolutePath(), false );
+
+        BrowseService browseService = getBrowseService( authorizationHeader, true );
+
+        List<ArtifactContentEntry> artifactContentEntries =
+            browseService.getArtifactContentEntries( "commons-logging", "commons-logging", "1.1", null, null,
+                                                     "org/apache/commons/logging/", testRepoId );
+
+        log.info( "artifactContentEntries: {}", artifactContentEntries );
+
+        assertThat( artifactContentEntries ).isNotNull().isNotEmpty().hasSize( 10 ).contains(
+            new ArtifactContentEntry( "org/apache/commons/logging/impl", false, 4 ),
+            new ArtifactContentEntry( "org/apache/commons/logging/LogSource.class", true, 4 ) );
+        deleteTestRepo( testRepoId );
+    }
+
+
 }