]> source.dussan.org Git - archiva.git/commitdiff
fix archiva-xmlrpc-services unit tests
authorOlivier Lamy <olamy@apache.org>
Thu, 3 Nov 2011 14:31:06 +0000 (14:31 +0000)
committerOlivier Lamy <olamy@apache.org>
Thu, 3 Nov 2011 14:31:06 +0000 (14:31 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1197142 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/test/resources/spring-context.xml
archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/managed/DefaultManagedRepositoryAdmin.java
archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/pom.xml
archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/java/org/apache/archiva/web/xmlrpc/services/AdministrationServiceImplTest.java
archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/resources/META-INF/redback/redback-core.xml [new file with mode: 0644]
archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/resources/spring-context.xml

index 2ae481a947bdb7a6287435f297d85e76c04b1b71..f4c99b2fe23551e13d8b54b524ff906881997576 100644 (file)
@@ -63,6 +63,7 @@ import java.io.IOException;
 import java.net.MalformedURLException;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -158,6 +159,11 @@ public class DefaultManagedRepositoryAdmin
         List<ManagedRepositoryConfiguration> managedRepoConfigs =
             getArchivaConfiguration().getConfiguration().getManagedRepositories();
 
+        if ( managedRepoConfigs == null )
+        {
+            return Collections.emptyList();
+        }
+
         List<ManagedRepository> managedRepos = new ArrayList<ManagedRepository>( managedRepoConfigs.size() );
 
         for ( ManagedRepositoryConfiguration repoConfig : managedRepoConfigs )
@@ -739,4 +745,24 @@ public class DefaultManagedRepositoryAdmin
     {
         this.repositoryTaskScheduler = repositoryTaskScheduler;
     }
+
+    public PlexusSisuBridge getPlexusSisuBridge()
+    {
+        return plexusSisuBridge;
+    }
+
+    public void setPlexusSisuBridge( PlexusSisuBridge plexusSisuBridge )
+    {
+        this.plexusSisuBridge = plexusSisuBridge;
+    }
+
+    public MavenIndexerUtils getMavenIndexerUtils()
+    {
+        return mavenIndexerUtils;
+    }
+
+    public void setMavenIndexerUtils( MavenIndexerUtils mavenIndexerUtils )
+    {
+        this.mavenIndexerUtils = mavenIndexerUtils;
+    }
 }
index e6e29b310586edcd542bb2a2eef30029096120de..45efa378f6d6080f81cd57435f642ecf1ed8d742 100644 (file)
       <artifactId>archiva-configuration</artifactId>
       <scope>runtime</scope>
     </dependency>
+    <dependency>
+      <groupId>org.apache.jackrabbit</groupId>
+      <artifactId>jackrabbit-core</artifactId>
+      <scope>test</scope>
+      <exclusions>
+        <exclusion>
+          <groupId>commons-logging</groupId>
+          <artifactId>commons-logging</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.derby</groupId>
+      <artifactId>derby</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.codehaus.redback</groupId>
+      <artifactId>redback-keys-memory</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.codehaus.redback</groupId>
+      <artifactId>redback-rbac-cached</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.codehaus.redback</groupId>
+      <artifactId>redback-rbac-memory</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.codehaus.redback</groupId>
+      <artifactId>redback-users-memory</artifactId>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
   <build>
     <pluginManagement>
             </excludes>
           </configuration>
         </plugin>
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-surefire-plugin</artifactId>
+          <configuration>
+            <systemPropertyVariables>
+              <appserver.base>${project.build.directory}/appserver-base</appserver.base>
+              <plexus.home>${project.build.directory}/appserver-base</plexus.home>
+              <java.io.tmpdir>${project.build.testOutputDirectory}</java.io.tmpdir>
+            </systemPropertyVariables>
+          </configuration>
+        </plugin>
       </plugins>
     </pluginManagement>
   </build>
index ff2cb54fde6fdacb95ca303c2da83942a15d1b76..0ed7cdc39beeb649958fd5803ce061690547694e 100644 (file)
@@ -29,6 +29,17 @@ import org.apache.archiva.admin.repository.proxyconnector.DefaultProxyConnectorA
 import org.apache.archiva.admin.repository.remote.DefaultRemoteRepositoryAdmin;
 import org.apache.archiva.audit.AuditEvent;
 import org.apache.archiva.audit.AuditListener;
+import org.apache.archiva.common.plexusbridge.MavenIndexerUtils;
+import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
+import org.apache.archiva.configuration.ArchivaConfiguration;
+import org.apache.archiva.configuration.Configuration;
+import org.apache.archiva.configuration.FileTypes;
+import org.apache.archiva.configuration.ManagedRepositoryConfiguration;
+import org.apache.archiva.configuration.RemoteRepositoryConfiguration;
+import org.apache.archiva.configuration.RepositoryGroupConfiguration;
+import org.apache.archiva.configuration.RepositoryScanningConfiguration;
+import org.apache.archiva.consumers.InvalidRepositoryContentConsumer;
+import org.apache.archiva.consumers.KnownRepositoryContentConsumer;
 import org.apache.archiva.metadata.model.ArtifactMetadata;
 import org.apache.archiva.metadata.repository.MetadataRepository;
 import org.apache.archiva.metadata.repository.RepositorySession;
@@ -36,7 +47,13 @@ import org.apache.archiva.metadata.repository.RepositorySessionFactory;
 import org.apache.archiva.metadata.repository.filter.Filter;
 import org.apache.archiva.metadata.repository.filter.IncludesFilter;
 import org.apache.archiva.metadata.repository.stats.RepositoryStatisticsManager;
+import org.apache.archiva.model.ArtifactReference;
+import org.apache.archiva.repository.RepositoryContentFactory;
+import org.apache.archiva.repository.content.ManagedDefaultRepositoryContent;
+import org.apache.archiva.repository.content.ManagedLegacyRepositoryContent;
+import org.apache.archiva.repository.content.PathParser;
 import org.apache.archiva.repository.events.RepositoryListener;
+import org.apache.archiva.repository.layout.LayoutException;
 import org.apache.archiva.repository.scanner.RepositoryContentConsumers;
 import org.apache.archiva.scheduler.repository.RepositoryArchivaTaskScheduler;
 import org.apache.archiva.scheduler.repository.RepositoryTask;
@@ -46,31 +63,18 @@ import org.apache.archiva.web.xmlrpc.api.beans.ManagedRepository;
 import org.apache.archiva.web.xmlrpc.api.beans.RemoteRepository;
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.io.filefilter.FileFilterUtils;
-import org.apache.archiva.configuration.ArchivaConfiguration;
-import org.apache.archiva.configuration.Configuration;
-import org.apache.archiva.configuration.FileTypes;
-import org.apache.archiva.configuration.ManagedRepositoryConfiguration;
-import org.apache.archiva.configuration.RemoteRepositoryConfiguration;
-import org.apache.archiva.configuration.RepositoryGroupConfiguration;
-import org.apache.archiva.configuration.RepositoryScanningConfiguration;
-import org.apache.archiva.consumers.InvalidRepositoryContentConsumer;
-import org.apache.archiva.consumers.KnownRepositoryContentConsumer;
-import org.apache.archiva.model.ArtifactReference;
-import org.apache.archiva.repository.RepositoryContentFactory;
-import org.apache.archiva.repository.content.ManagedDefaultRepositoryContent;
-import org.apache.archiva.repository.content.ManagedLegacyRepositoryContent;
-import org.apache.archiva.repository.content.PathParser;
-import org.apache.archiva.repository.layout.LayoutException;
 import org.codehaus.plexus.redback.role.RoleManager;
 import org.codehaus.plexus.registry.Registry;
 import org.easymock.MockControl;
 import org.easymock.classextension.MockClassControl;
+import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.springframework.test.context.ContextConfiguration;
 import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
 
+import javax.inject.Inject;
 import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
@@ -170,6 +174,12 @@ public class AdministrationServiceImplTest
 
     private DefaultRepositoryGroupAdmin repositoryGroupAdmin;
 
+    @Inject
+    PlexusSisuBridge plexusSisuBridge;
+
+    @Inject
+    MavenIndexerUtils mavenIndexerUtils;
+
     @Before
     public void setUp()
         throws Exception
@@ -182,6 +192,8 @@ public class AdministrationServiceImplTest
         configControl = MockClassControl.createControl( Configuration.class );
         config = (Configuration) configControl.getMock();
 
+
+
         repositoryTaskSchedulerControl = MockClassControl.createControl( RepositoryArchivaTaskScheduler.class );
         repositoryTaskScheduler = (RepositoryArchivaTaskScheduler) repositoryTaskSchedulerControl.getMock();
 
@@ -236,6 +248,14 @@ public class AdministrationServiceImplTest
         managedRepositoryAdmin.setRepositorySessionFactory( repositorySessionFactory );
         managedRepositoryAdmin.setAuditListeners( Arrays.asList( auditListener ) );
         managedRepositoryAdmin.setRoleManager( roleManager );
+        managedRepositoryAdmin.setMavenIndexerUtils( mavenIndexerUtils );
+        managedRepositoryAdmin.setPlexusSisuBridge( plexusSisuBridge );
+        archivaConfigControl.reset();
+        archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config, 1, 3 );
+        configControl.expectAndReturn( config.getManagedRepositories(), new ArrayList( 0 ) );
+        archivaConfigControl.replay();
+        configControl.replay();
+        managedRepositoryAdmin.initialize();
 
         RepositoryCommonValidator repositoryCommonValidator = new RepositoryCommonValidator();
         repositoryCommonValidator.setArchivaConfiguration( archivaConfig );
@@ -266,6 +286,18 @@ public class AdministrationServiceImplTest
                                                  Collections.singletonList( listener ), repositoryStatisticsManager,
                                                  repositoryMerger, auditListener, managedRepositoryAdmin,
                                                  remoteRepositoryAdmin, proxyConnectorAdmin, repositoryGroupAdmin );
+
+
+    }
+
+    @After
+    public void shutdown()
+        throws Exception
+    {
+        //archivaConfigControl.reset();
+        //archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config, 1 );
+        //configControl.expectAndReturn( config.getManagedRepositories(), new ArrayList( 0 ), 1 );
+        //managedRepositoryAdmin.shutdown();
     }
 
     /* Tests for repository consumers */
@@ -305,7 +337,9 @@ public class AdministrationServiceImplTest
         // test enable "check-metadata" consumer
         recordRepoConsumers();
 
+        archivaConfigControl.reset();
         archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config );
+        configControl.reset();
         configControl.expectAndReturn( config.getRepositoryScanning(), repoScanning, 1, 5 );
 
         archivaConfig.save( config );
@@ -406,7 +440,9 @@ public class AdministrationServiceImplTest
     {
         ManagedRepositoryConfiguration managedRepo = createManagedRepo( "default", "default-repo" );
 
+        archivaConfigControl.reset();
         archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config );
+        configControl.reset();
         configControl.expectAndReturn( config.getManagedRepositories(), Arrays.asList( managedRepo ), 1, 5 );
 
         ManagedDefaultRepositoryContent repoContent = new ManagedDefaultRepositoryContent();
@@ -458,8 +494,9 @@ public class AdministrationServiceImplTest
         PathParser parser = (PathParser) pathParserControl.getMock();
 
         ManagedRepositoryConfiguration managedRepo = createManagedRepo( "legacy", "legacy-repo" );
-
+        archivaConfigControl.reset();
         archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config );
+        configControl.reset();
         configControl.expectAndReturn( config.getManagedRepositories(), Arrays.asList( managedRepo ), 1, 5 );
 
         ManagedLegacyRepositoryContent repoContent = new ManagedLegacyRepositoryContent();
@@ -520,7 +557,9 @@ public class AdministrationServiceImplTest
     {
         ManagedRepositoryConfiguration managedRepo = createManagedRepo( "default", "default-repo" );
 
+        archivaConfigControl.reset();
         archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config );
+        configControl.reset();
         configControl.expectAndReturn( config.getManagedRepositories(), Arrays.asList( managedRepo ), 1, 5 );
 
         ManagedDefaultRepositoryContent repoContent = new ManagedDefaultRepositoryContent();
@@ -569,7 +608,9 @@ public class AdministrationServiceImplTest
     public void testDeleteArtifacRepositoryDoesNotExist()
         throws Exception
     {
+        archivaConfigControl.reset();
         archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config );
+        configControl.reset();
         configControl.expectAndReturn( config.getManagedRepositories(), Collections.emptyList() );
 
         archivaConfigControl.replay();
@@ -594,7 +635,9 @@ public class AdministrationServiceImplTest
     public void testExecuteRepoScannerRepoExistsAndNotBeingScanned()
         throws Exception
     {
+        archivaConfigControl.reset();
         archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config );
+        configControl.reset();
         configControl.expectAndReturn( config.getManagedRepositories(), Arrays.asList(
             createManagedRepo( "internal", "default", "Internal Repository", true, false ) ), 1, 5 );
 
@@ -630,8 +673,10 @@ public class AdministrationServiceImplTest
     public void testExecuteRepoScannerRepoExistsButBeingScanned()
         throws Exception
     {
+        archivaConfigControl.reset();
         archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config );
 
+        configControl.reset();
         configControl.expectAndReturn( config.getManagedRepositories(), Arrays.asList(
             createManagedRepo( "internal", "default", "Internal Repository", true, false ) ), 1, 5 );
 
@@ -661,7 +706,9 @@ public class AdministrationServiceImplTest
     public void testExecuteRepoScannerRepoDoesNotExist()
         throws Exception
     {
+        archivaConfigControl.reset();
         archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config );
+        configControl.reset();
         configControl.expectAndReturn( config.getManagedRepositories(), Collections.emptyList(), 1, 5 );
 
         archivaConfigControl.replay();
@@ -690,7 +737,9 @@ public class AdministrationServiceImplTest
         managedRepos.add( createManagedRepo( "internal", "default", "Internal Repository", true, false ) );
         managedRepos.add( createManagedRepo( "snapshots", "default", "Snapshots Repository", false, true ) );
 
+        archivaConfigControl.reset();
         archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config );
+        configControl.reset();
         configControl.expectAndReturn( config.getManagedRepositories(), managedRepos );
 
         archivaConfigControl.replay();
@@ -718,7 +767,9 @@ public class AdministrationServiceImplTest
         remoteRepos.add(
             createRemoteRepository( "dummy", "Dummy Remote Repository", "legacy", "http://dummy.com/dummy" ) );
 
+        archivaConfigControl.reset();
         archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config );
+        configControl.reset();
         configControl.expectAndReturn( config.getRemoteRepositories(), remoteRepos );
 
         archivaConfigControl.replay();
@@ -739,7 +790,9 @@ public class AdministrationServiceImplTest
     @Test
     public void testDeleteInvalidRepositoryContent()
     {
+        archivaConfigControl.reset();
         archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config );
+        configControl.reset();
         configControl.expectAndReturn( config.getManagedRepositories(), Collections.emptyList(), 1, 5 );
 
         archivaConfigControl.replay();
@@ -765,7 +818,9 @@ public class AdministrationServiceImplTest
         ManagedRepositoryConfiguration managedRepo = createManagedRepo( "default", "default-repo" );
         assertTrue( new File( managedRepo.getLocation(), "org" ).exists() );
 
+        archivaConfigControl.reset();
         archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config, 1, 3 );
+        configControl.reset();
         configControl.expectAndReturn( config.getManagedRepositories(), Arrays.asList( managedRepo ), 1, 5 );
         metadataRepository.removeRepository( "internal" );
 
@@ -789,7 +844,9 @@ public class AdministrationServiceImplTest
     public void testMergeRepositoryWithInvalidRepository()
         throws Exception
     {
+        archivaConfigControl.reset();
         archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config );
+        configControl.reset();
         configControl.expectAndReturn( config.getManagedRepositories(), Collections.emptyList(), 1, 2 );
 
         archivaConfigControl.replay();
@@ -812,8 +869,10 @@ public class AdministrationServiceImplTest
     public void testMergeWithNoStagingRepository()
         throws Exception
     {
+        archivaConfigControl.reset();
         archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config, 1, 5 );
 
+        configControl.reset();
         configControl.expectAndReturn( config.getManagedRepositories(),
                                        Arrays.asList( createManagedRepo( "repo", "default", "repo", true, false ) ), 1,
                                        4 );
@@ -853,7 +912,9 @@ public class AdministrationServiceImplTest
         RepositoryTask task = new RepositoryTask();
         task.setScanAll( true );
 
+        archivaConfigControl.reset();
         archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config, 1, 5 );
+        configControl.reset();
         configControl.expectAndReturn( config.getManagedRepositories(), Arrays.asList( merge, staging ), 1, 5 );
 
         metadataRepositoryControl.expectAndReturn( metadataRepository.getArtifacts( staging.getId() ), sources );
@@ -921,7 +982,9 @@ public class AdministrationServiceImplTest
         repo.setLocation( "target/test-repository/one" );
         ManagedRepositoryConfiguration staging = createStagingRepo( repo );
 
+        configControl.reset();
         configControl.expectAndReturn( config.getManagedRepositories(), Arrays.asList( repo, staging ), 1, 5 );
+        archivaConfigControl.reset();
         archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config, 1, 5 );
 
         metadataRepositoryControl.expectAndReturn( metadataRepository.getArtifacts( staging.getId() ), sources );
@@ -984,8 +1047,10 @@ public class AdministrationServiceImplTest
         remoteRepoMap.put( "repo1", remoteRepo );
         repoGroupMap.put( "repo1", repoGroup );
 
+        archivaConfigControl.reset();
         archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config );
 
+        configControl.reset();
         configControl.expectAndReturn( config.getManagedRepositoriesAsMap(), managedRepoMap );
         configControl.expectAndReturn( config.getRemoteRepositoriesAsMap(), remoteRepoMap );
         configControl.expectAndReturn( config.getRepositoryGroupsAsMap(), repoGroupMap );
@@ -1051,7 +1116,7 @@ public class AdministrationServiceImplTest
         assertFalse( new File( releaseLocation ).isDirectory() );
         assertFalse( new File( stageLocation ).isDirectory() );
         boolean success = service.addManagedRepository( repoId, layout, name,
-                                                        "${appserver.base}/test-repository/" + projId + ".releases",
+                                                        appserverBase + "/test-repository/" + projId + ".releases",
                                                         true, true, false, true, "0 15 3 * * ? *", 1, 1, true );
         assertTrue( success );
         assertTrue( new File( releaseLocation ).isDirectory() );
@@ -1085,8 +1150,10 @@ public class AdministrationServiceImplTest
         remoteRepoMap.put( "repo1", remoteRepo );
         repoGroupMap.put( "repo1", repoGroup );
 
+        archivaConfigControl.reset();
         archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config );
 
+        configControl.reset();
         configControl.expectAndReturn( config.getManagedRepositoriesAsMap(), managedRepoMap );
         configControl.expectAndReturn( config.getRemoteRepositoriesAsMap(), remoteRepoMap );
         configControl.expectAndReturn( config.getRepositoryGroupsAsMap(), repoGroupMap );
@@ -1097,7 +1164,7 @@ public class AdministrationServiceImplTest
         try
         {
             service.addManagedRepository( repoId, layout, name,
-                                          "${appserver.base}/test-repository/" + projId + ".releases", true, true,
+                                           "target/test-repository/" + projId + ".releases", true, true,
                                           false, true, "0 15 3 * * ? *", 1, 1, true );
             fail( "An exception should have been thrown! Repository ID is not valid." );
         }
@@ -1132,8 +1199,10 @@ public class AdministrationServiceImplTest
         remoteRepoMap.put( "repo1", remoteRepo );
         repoGroupMap.put( "repo1", repoGroup );
 
+        archivaConfigControl.reset();
         archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config );
 
+        configControl.reset();
         configControl.expectAndReturn( config.getManagedRepositoriesAsMap(), managedRepoMap );
         configControl.expectAndReturn( config.getRemoteRepositoriesAsMap(), remoteRepoMap );
         configControl.expectAndReturn( config.getRepositoryGroupsAsMap(), repoGroupMap );
@@ -1144,7 +1213,7 @@ public class AdministrationServiceImplTest
         try
         {
             service.addManagedRepository( repoId, layout, name,
-                                          "${appserver.base}/test-repository/" + projId + ".releases", true, true,
+                                          "target/test-repository/" + projId + ".releases", true, true,
                                           false, true, "0 15 3 * * ? *", 1, 1, true );
             fail( "An exception should have been thrown! Repository name is not valid." );
         }
@@ -1181,11 +1250,12 @@ public class AdministrationServiceImplTest
         remoteRepoMap.put( "repo1", remoteRepo );
         repoGroupMap.put( "repo1", repoGroup );
 
-        archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config );
-        archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config );
+        archivaConfigControl.reset();
+        archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config, 1, 3 );
 
-        configControl.expectAndReturn( config.getManagedRepositoriesAsMap(), managedRepoMap );
-        configControl.expectAndReturn( config.getRemoteRepositoriesAsMap(), remoteRepoMap );
+        configControl.reset();
+        configControl.expectAndReturn( config.getManagedRepositoriesAsMap(), managedRepoMap, 0, 3 );
+        configControl.expectAndReturn( config.getRemoteRepositoriesAsMap(), remoteRepoMap, 1, 3 );
         configControl.expectAndReturn( config.getRepositoryGroupsAsMap(), repoGroupMap );
         registryControl.expectAndReturn( registry.getString( "appserver.base", "${appserver.base}" ), appserverBase );
         registryControl.expectAndReturn( registry.getString( "appserver.home", "${appserver.home}" ), appserverBase );
diff --git a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/resources/META-INF/redback/redback-core.xml b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/resources/META-INF/redback/redback-core.xml
new file mode 100644 (file)
index 0000000..751ac5c
--- /dev/null
@@ -0,0 +1,247 @@
+<!--
+  ~ 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.
+  -->
+
+<redback-role-model>
+  <modelVersion>1.0.0</modelVersion>
+  <applications>
+    <application>
+      <id>System</id>
+      <description>Roles that apply system-wide, across all of the applications</description>
+      <version>1.0.0</version>
+      <resources>
+        <resource>
+          <id>global</id>
+          <name>*</name>
+          <permanent>true</permanent>
+          <description>global resource implies full access for authorization</description>
+        </resource>
+        <resource>
+          <id>username</id>
+          <name>${username}</name>
+          <permanent>true</permanent>
+          <description>replaced with the username of the principal at authorization check time</description>
+        </resource>
+      </resources>
+      <operations>
+        <operation>
+          <id>configuration-edit</id>
+          <name>configuration-edit</name>
+          <description>edit configuration</description>
+          <permanent>true</permanent>
+        </operation>
+        <operation>
+          <id>user-management-user-create</id>
+          <name>user-management-user-create</name>
+          <description>create user</description>
+          <permanent>true</permanent>
+        </operation>
+        <operation>
+          <id>user-management-user-edit</id>
+          <name>user-management-user-edit</name>
+          <description>edit user</description>
+          <permanent>true</permanent>
+        </operation>
+        <operation>
+          <id>user-management-user-role</id>
+          <name>user-management-user-role</name>
+          <description>user roles</description>
+          <permanent>true</permanent>
+        </operation>
+        <operation>
+          <id>user-management-user-delete</id>
+          <name>user-management-user-delete</name>
+          <description>delete user</description>
+          <permanent>true</permanent>
+        </operation>
+        <operation>
+          <id>user-management-user-list</id>
+          <name>user-management-user-list</name>
+          <description>list users</description>
+          <permanent>true</permanent>
+        </operation>
+        <operation>
+          <id>user-management-role-grant</id>
+          <name>user-management-role-grant</name>
+          <description>grant role</description>
+          <permanent>true</permanent>
+        </operation>
+        <operation>
+          <id>user-management-role-drop</id>
+          <name>user-management-role-drop</name>
+          <description>drop role</description>
+          <permanent>true</permanent>
+        </operation>
+        <operation>
+          <id>user-management-rbac-admin</id>
+          <name>user-management-rbac-admin</name>
+          <description>administer rbac</description>
+          <permanent>true</permanent>
+        </operation>
+        <operation>
+          <id>guest-access</id>
+          <name>guest-access</name>
+          <description>access guest</description>
+          <permanent>true</permanent>
+        </operation>
+        <operation>
+          <id>user-management-manage-data</id>
+          <name>user-management-manage-data</name>
+          <description>manage data</description>
+          <permanent>true</permanent>
+        </operation>
+      </operations>
+      <roles>
+        <role>
+          <id>system-administrator</id>
+          <name>System Administrator</name>
+          <permanent>true</permanent>
+          <assignable>true</assignable>
+          <permissions>
+            <permission>
+              <id>edit-redback-configuration</id>
+              <name>Edit Redback Configuration</name>
+              <operation>configuration-edit</operation>
+              <resource>global</resource>
+              <permanent>true</permanent>
+            </permission>
+            <permission>
+              <id>manage-rbac-setup</id>
+              <name>User RBAC Management</name>
+              <operation>user-management-rbac-admin</operation>
+              <resource>global</resource>
+              <permanent>true</permanent>
+            </permission>
+            <permission>
+              <id>manage-rbac-data</id>
+              <name>RBAC Manage Data</name>
+              <operation>user-management-manage-data</operation>
+              <resource>global</resource>
+              <permanent>true</permanent>
+            </permission>
+          </permissions>
+          <childRoles>
+            <childRole>user-administrator</childRole>
+          </childRoles>
+        </role>
+        <role>
+          <id>user-administrator</id>
+          <name>User Administrator</name>
+          <permanent>true</permanent>
+          <assignable>true</assignable>
+          <permissions>
+            <permission>
+              <id>drop-roles-for-anyone</id>
+              <name>Drop Roles for Anyone</name>
+              <operation>user-management-role-drop</operation>
+              <resource>global</resource>
+              <permanent>true</permanent>
+            </permission>
+            <permission>
+              <id>grant-roles-for-anyone</id>
+              <name>Grant Roles for Anyone</name>
+              <operation>user-management-role-grant</operation>
+              <resource>global</resource>
+              <permanent>true</permanent>
+            </permission>
+            <permission>
+              <id>user-create</id>
+              <name>Create Users</name>
+              <operation>user-management-user-create</operation>
+              <resource>global</resource>
+              <permanent>true</permanent>
+            </permission>
+            <permission>
+              <id>user-delete</id>
+              <name>Delete Users</name>
+              <operation>user-management-user-delete</operation>
+              <resource>global</resource>
+              <permanent>true</permanent>
+            </permission>
+            <permission>
+              <id>user-edit</id>
+              <name>Edit Users</name>
+              <operation>user-management-user-edit</operation>
+              <resource>global</resource>
+              <permanent>true</permanent>
+            </permission>
+            <permission>
+              <id>access-users-roles</id>
+              <name>Access Users Roles</name>
+              <operation>user-management-user-role</operation>
+              <resource>global</resource>
+              <permanent>true</permanent>
+            </permission>
+            <permission>
+              <id>access-user-list</id>
+              <name>Access User List</name>
+              <operation>user-management-user-list</operation>
+              <resource>global</resource>
+              <permanent>true</permanent>
+            </permission>
+          </permissions>
+        </role>
+        <role>
+          <id>edit-users-list</id>
+          <name>edit users list</name>
+          <permanent>true</permanent>
+          <assignable>true</assignable>
+          <permissions>
+            <permission>
+              <id>access-user-list</id>
+              <name>Access User List</name>
+              <operation>user-management-user-list</operation>
+              <resource>global</resource>
+              <permanent>true</permanent>
+            </permission>
+          </permissions>
+        </role>
+        <role>
+          <id>registered-user</id>
+          <name>Registered User</name>
+          <permanent>true</permanent>
+          <assignable>true</assignable>
+          <permissions>
+            <permission>
+              <id>edit-user-by-username</id>
+              <name>Edit User Data by Username</name>
+              <operation>user-management-user-edit</operation>
+              <resource>username</resource>
+              <permanent>true</permanent>
+            </permission>
+          </permissions>
+        </role>
+        <role>
+          <id>guest</id>
+          <name>Guest</name>
+          <permanent>true</permanent>
+          <assignable>true</assignable>
+          <permissions>
+            <permission>
+              <id>guest-permission</id>
+              <name>Guest Permission</name>
+              <operation>guest-access</operation>
+              <resource>global</resource>
+              <permanent>true</permanent>
+            </permission>
+          </permissions>
+        </role>
+      </roles>
+    </application>
+  </applications>
+</redback-role-model>
\ No newline at end of file
index 86208a3b043f2474b603816247ade15365db2bef..4a73047acbaa68722df740d6022f1b8295266f96 100644 (file)
            http://www.springframework.org/schema/context/spring-context-3.0.xsd"
        default-lazy-init="true">
 
+  <bean id="jcr-config" class="org.apache.archiva.metadata.repository.jcr.ArchivaJcrRepositoryConfig" factory-method="create">
+    <constructor-arg value="${appserver.base}/conf/repository.xml"/>
+    <constructor-arg value="${appserver.base}/data/jcr"/>
+  </bean>
+
+  <bean id="jcr-repository" class="org.apache.jackrabbit.core.RepositoryImpl" destroy-method="shutdown" lazy-init="true">
+    <constructor-arg ref="jcr-config"/>
+  </bean>
+
+  <bean name="scheduler" class="org.codehaus.redback.components.scheduler.DefaultScheduler">
+    <property name="properties">
+      <props>
+        <prop key="org.quartz.scheduler.instanceName">scheduler1</prop>
+        <prop key="org.quartz.threadPool.class">org.quartz.simpl.SimpleThreadPool</prop>
+        <prop key="org.quartz.threadPool.threadCount">2</prop>
+        <prop key="org.quartz.threadPool.threadPriority">4</prop>
+        <prop key="org.quartz.jobStore.class">org.quartz.simpl.RAMJobStore</prop>
+      </props>
+    </property>
+  </bean>
+
 </beans>
\ No newline at end of file