warnings in scheduled and security modules

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@755300 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Porter 2009-03-17 16:18:51 +00:00
parent 6952e5a90e
commit 76a1d2429f
6 changed files with 35 additions and 51 deletions

View File

@ -56,7 +56,7 @@ public class TestDatabaseCleanupConsumer
countComplete++;
}
public List getIncludedTypes()
public List<String> getIncludedTypes()
{
return null;
}

View File

@ -63,9 +63,9 @@ public class TestDatabaseUnprocessedConsumer
countComplete++;
}
public List getIncludedTypes()
public List<String> getIncludedTypes()
{
List types = new ArrayList();
List<String> types = new ArrayList<String>();
types.add( "pom" );
types.add( "jar" );
return types;

View File

@ -19,6 +19,16 @@ package org.apache.maven.archiva.scheduled.executors;
* under the License.
*/
import java.io.File;
import java.net.URL;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import javax.jdo.PersistenceManager;
import javax.jdo.PersistenceManagerFactory;
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
import org.apache.maven.archiva.database.ArchivaDAO;
import org.apache.maven.archiva.database.ArtifactDAO;
@ -31,17 +41,6 @@ import org.codehaus.plexus.spring.PlexusInSpringTestCase;
import org.codehaus.plexus.taskqueue.execution.TaskExecutor;
import org.jpox.SchemaTool;
import java.io.File;
import java.net.URL;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import javax.jdo.PersistenceManager;
import javax.jdo.PersistenceManagerFactory;
/**
* ArchivaDatabaseUpdateTaskExecutorTest
*
@ -102,10 +101,8 @@ public class ArchivaDatabaseUpdateTaskExecutorTest
Properties properties = jdoFactory.getProperties();
for ( Iterator it = properties.entrySet().iterator(); it.hasNext(); )
for ( Map.Entry<Object, Object> entry : properties.entrySet() )
{
Map.Entry entry = (Map.Entry) it.next();
System.setProperty( (String) entry.getKey(), (String) entry.getValue() );
}
@ -160,12 +157,12 @@ public class ArchivaDatabaseUpdateTaskExecutorTest
assertNotNull( artifact );
// Test for artifact existance.
List artifactList = adao.queryArtifacts( null );
List<ArchivaArtifact> artifactList = adao.queryArtifacts( null );
assertNotNull( "Artifact list should not be null.", artifactList );
assertEquals( "Artifact list size", 1, artifactList.size() );
// Test for unprocessed artifacts.
List unprocessedResultList = adao.queryArtifacts( new ArtifactsProcessedConstraint( false ) );
List<ArchivaArtifact> unprocessedResultList = adao.queryArtifacts( new ArtifactsProcessedConstraint( false ) );
assertNotNull( "Unprocessed Results should not be null.", unprocessedResultList );
assertEquals( "Incorrect number of unprocessed artifacts detected.", 1, unprocessedResultList.size() );
@ -182,7 +179,7 @@ public class ArchivaDatabaseUpdateTaskExecutorTest
assertEquals( "Artifact list size", 1, artifactList.size() );
// Test for processed artifacts.
List processedResultList = adao.queryArtifacts( new ArtifactsProcessedConstraint( true ) );
List<ArchivaArtifact> processedResultList = adao.queryArtifacts( new ArtifactsProcessedConstraint( true ) );
assertNotNull( "Processed Results should not be null.", processedResultList );
assertEquals( "Incorrect number of processed artifacts detected.", 1, processedResultList.size() );
}

View File

@ -19,21 +19,8 @@ package org.apache.maven.archiva.scheduled.executors;
* under the License.
*/
import org.apache.maven.archiva.configuration.ArchivaConfiguration;
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
import org.apache.maven.archiva.database.ArchivaDAO;
import org.apache.maven.archiva.database.ArtifactDAO;
import org.apache.maven.archiva.database.constraints.ArtifactsProcessedConstraint;
import org.apache.maven.archiva.scheduled.tasks.RepositoryTask;
import org.codehaus.plexus.jdo.DefaultConfigurableJdoFactory;
import org.codehaus.plexus.jdo.JdoFactory;
import org.codehaus.plexus.spring.PlexusInSpringTestCase;
import org.codehaus.plexus.taskqueue.execution.TaskExecutor;
import org.jpox.SchemaTool;
import java.io.File;
import java.net.URL;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Properties;
@ -41,6 +28,19 @@ import java.util.Properties;
import javax.jdo.PersistenceManager;
import javax.jdo.PersistenceManagerFactory;
import org.apache.maven.archiva.configuration.ArchivaConfiguration;
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
import org.apache.maven.archiva.database.ArchivaDAO;
import org.apache.maven.archiva.database.ArtifactDAO;
import org.apache.maven.archiva.database.constraints.ArtifactsProcessedConstraint;
import org.apache.maven.archiva.model.ArchivaArtifact;
import org.apache.maven.archiva.scheduled.tasks.RepositoryTask;
import org.codehaus.plexus.jdo.DefaultConfigurableJdoFactory;
import org.codehaus.plexus.jdo.JdoFactory;
import org.codehaus.plexus.spring.PlexusInSpringTestCase;
import org.codehaus.plexus.taskqueue.execution.TaskExecutor;
import org.jpox.SchemaTool;
/**
* ArchivaRepositoryScanningTaskExecutorTest
*
@ -101,10 +101,8 @@ public class ArchivaRepositoryScanningTaskExecutorTest
Properties properties = jdoFactory.getProperties();
for ( Iterator it = properties.entrySet().iterator(); it.hasNext(); )
for ( Map.Entry<Object, Object> entry : properties.entrySet() )
{
Map.Entry entry = (Map.Entry) it.next();
System.setProperty( (String) entry.getKey(), (String) entry.getValue() );
}
@ -158,7 +156,7 @@ public class ArchivaRepositoryScanningTaskExecutorTest
taskExecutor.executeTask( repoTask );
ArtifactDAO adao = dao.getArtifactDAO();
List unprocessedResultList = adao.queryArtifacts( new ArtifactsProcessedConstraint( false ) );
List<ArchivaArtifact> unprocessedResultList = adao.queryArtifacts( new ArtifactsProcessedConstraint( false ) );
assertNotNull( unprocessedResultList );
assertEquals("Incorrect number of unprocessed artifacts detected.", 8, unprocessedResultList.size() );

View File

@ -21,17 +21,15 @@ package org.apache.maven.archiva.security;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import org.apache.maven.archiva.configuration.ArchivaConfiguration;
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
import org.apache.maven.archiva.security.ArchivaRoleConstants;
import org.codehaus.plexus.redback.authentication.AuthenticationResult;
import org.codehaus.plexus.redback.authorization.AuthorizationException;
import org.codehaus.plexus.redback.rbac.RBACManager;
import org.codehaus.plexus.redback.rbac.RbacObjectNotFoundException;
import org.codehaus.plexus.redback.rbac.RbacManagerException;
import org.codehaus.plexus.redback.rbac.RbacObjectNotFoundException;
import org.codehaus.plexus.redback.rbac.Role;
import org.codehaus.plexus.redback.role.RoleManager;
import org.codehaus.plexus.redback.role.RoleManagerException;
@ -198,14 +196,10 @@ public class DefaultUserRepositories
try
{
Collection roleList = rbacManager.getEffectivelyAssignedRoles( principal );
Collection<Role> roleList = rbacManager.getEffectivelyAssignedRoles( principal );
Iterator it = roleList.iterator();
while ( it.hasNext() )
for ( Role role : roleList )
{
Role role = (Role) it.next();
String roleName = role.getName();
if ( roleName.startsWith( ArchivaRoleConstants.REPOSITORY_MANAGER_ROLE_PREFIX ) )

View File

@ -70,11 +70,6 @@ public class SecurityStartup
*/
private ArchivaConfiguration archivaConfiguration;
/**
* @plexus.requirement
*/
private ArchivaXworkUser archivaXworkUser;
public void afterConfigurationChange( Registry registry, String propertyName, Object propertyValue )
{
if ( ConfigurationNames.isManagedRepositories( propertyName ) )