mirror of https://github.com/apache/archiva.git
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:
parent
6952e5a90e
commit
76a1d2429f
|
@ -56,7 +56,7 @@ public class TestDatabaseCleanupConsumer
|
||||||
countComplete++;
|
countComplete++;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List getIncludedTypes()
|
public List<String> getIncludedTypes()
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,9 +63,9 @@ public class TestDatabaseUnprocessedConsumer
|
||||||
countComplete++;
|
countComplete++;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List getIncludedTypes()
|
public List<String> getIncludedTypes()
|
||||||
{
|
{
|
||||||
List types = new ArrayList();
|
List<String> types = new ArrayList<String>();
|
||||||
types.add( "pom" );
|
types.add( "pom" );
|
||||||
types.add( "jar" );
|
types.add( "jar" );
|
||||||
return types;
|
return types;
|
||||||
|
|
|
@ -19,6 +19,16 @@ package org.apache.maven.archiva.scheduled.executors;
|
||||||
* under the License.
|
* 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.configuration.ManagedRepositoryConfiguration;
|
||||||
import org.apache.maven.archiva.database.ArchivaDAO;
|
import org.apache.maven.archiva.database.ArchivaDAO;
|
||||||
import org.apache.maven.archiva.database.ArtifactDAO;
|
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.codehaus.plexus.taskqueue.execution.TaskExecutor;
|
||||||
import org.jpox.SchemaTool;
|
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
|
* ArchivaDatabaseUpdateTaskExecutorTest
|
||||||
*
|
*
|
||||||
|
@ -102,10 +101,8 @@ public class ArchivaDatabaseUpdateTaskExecutorTest
|
||||||
|
|
||||||
Properties properties = jdoFactory.getProperties();
|
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() );
|
System.setProperty( (String) entry.getKey(), (String) entry.getValue() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -160,12 +157,12 @@ public class ArchivaDatabaseUpdateTaskExecutorTest
|
||||||
assertNotNull( artifact );
|
assertNotNull( artifact );
|
||||||
|
|
||||||
// Test for artifact existance.
|
// Test for artifact existance.
|
||||||
List artifactList = adao.queryArtifacts( null );
|
List<ArchivaArtifact> artifactList = adao.queryArtifacts( null );
|
||||||
assertNotNull( "Artifact list should not be null.", artifactList );
|
assertNotNull( "Artifact list should not be null.", artifactList );
|
||||||
assertEquals( "Artifact list size", 1, artifactList.size() );
|
assertEquals( "Artifact list size", 1, artifactList.size() );
|
||||||
|
|
||||||
// Test for unprocessed artifacts.
|
// 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 );
|
assertNotNull( "Unprocessed Results should not be null.", unprocessedResultList );
|
||||||
assertEquals( "Incorrect number of unprocessed artifacts detected.", 1, unprocessedResultList.size() );
|
assertEquals( "Incorrect number of unprocessed artifacts detected.", 1, unprocessedResultList.size() );
|
||||||
|
|
||||||
|
@ -182,7 +179,7 @@ public class ArchivaDatabaseUpdateTaskExecutorTest
|
||||||
assertEquals( "Artifact list size", 1, artifactList.size() );
|
assertEquals( "Artifact list size", 1, artifactList.size() );
|
||||||
|
|
||||||
// Test for processed artifacts.
|
// 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 );
|
assertNotNull( "Processed Results should not be null.", processedResultList );
|
||||||
assertEquals( "Incorrect number of processed artifacts detected.", 1, processedResultList.size() );
|
assertEquals( "Incorrect number of processed artifacts detected.", 1, processedResultList.size() );
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,21 +19,8 @@ package org.apache.maven.archiva.scheduled.executors;
|
||||||
* under the License.
|
* 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.io.File;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
@ -41,6 +28,19 @@ import java.util.Properties;
|
||||||
import javax.jdo.PersistenceManager;
|
import javax.jdo.PersistenceManager;
|
||||||
import javax.jdo.PersistenceManagerFactory;
|
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
|
* ArchivaRepositoryScanningTaskExecutorTest
|
||||||
*
|
*
|
||||||
|
@ -101,10 +101,8 @@ public class ArchivaRepositoryScanningTaskExecutorTest
|
||||||
|
|
||||||
Properties properties = jdoFactory.getProperties();
|
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() );
|
System.setProperty( (String) entry.getKey(), (String) entry.getValue() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -158,7 +156,7 @@ public class ArchivaRepositoryScanningTaskExecutorTest
|
||||||
taskExecutor.executeTask( repoTask );
|
taskExecutor.executeTask( repoTask );
|
||||||
|
|
||||||
ArtifactDAO adao = dao.getArtifactDAO();
|
ArtifactDAO adao = dao.getArtifactDAO();
|
||||||
List unprocessedResultList = adao.queryArtifacts( new ArtifactsProcessedConstraint( false ) );
|
List<ArchivaArtifact> unprocessedResultList = adao.queryArtifacts( new ArtifactsProcessedConstraint( false ) );
|
||||||
|
|
||||||
assertNotNull( unprocessedResultList );
|
assertNotNull( unprocessedResultList );
|
||||||
assertEquals("Incorrect number of unprocessed artifacts detected.", 8, unprocessedResultList.size() );
|
assertEquals("Incorrect number of unprocessed artifacts detected.", 8, unprocessedResultList.size() );
|
||||||
|
|
|
@ -21,17 +21,15 @@ package org.apache.maven.archiva.security;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.apache.maven.archiva.configuration.ArchivaConfiguration;
|
import org.apache.maven.archiva.configuration.ArchivaConfiguration;
|
||||||
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
|
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.authentication.AuthenticationResult;
|
||||||
import org.codehaus.plexus.redback.authorization.AuthorizationException;
|
import org.codehaus.plexus.redback.authorization.AuthorizationException;
|
||||||
import org.codehaus.plexus.redback.rbac.RBACManager;
|
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.RbacManagerException;
|
||||||
|
import org.codehaus.plexus.redback.rbac.RbacObjectNotFoundException;
|
||||||
import org.codehaus.plexus.redback.rbac.Role;
|
import org.codehaus.plexus.redback.rbac.Role;
|
||||||
import org.codehaus.plexus.redback.role.RoleManager;
|
import org.codehaus.plexus.redback.role.RoleManager;
|
||||||
import org.codehaus.plexus.redback.role.RoleManagerException;
|
import org.codehaus.plexus.redback.role.RoleManagerException;
|
||||||
|
@ -198,14 +196,10 @@ public class DefaultUserRepositories
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Collection roleList = rbacManager.getEffectivelyAssignedRoles( principal );
|
Collection<Role> roleList = rbacManager.getEffectivelyAssignedRoles( principal );
|
||||||
|
|
||||||
Iterator it = roleList.iterator();
|
for ( Role role : roleList )
|
||||||
|
|
||||||
while ( it.hasNext() )
|
|
||||||
{
|
{
|
||||||
Role role = (Role) it.next();
|
|
||||||
|
|
||||||
String roleName = role.getName();
|
String roleName = role.getName();
|
||||||
|
|
||||||
if ( roleName.startsWith( ArchivaRoleConstants.REPOSITORY_MANAGER_ROLE_PREFIX ) )
|
if ( roleName.startsWith( ArchivaRoleConstants.REPOSITORY_MANAGER_ROLE_PREFIX ) )
|
||||||
|
|
|
@ -70,11 +70,6 @@ public class SecurityStartup
|
||||||
*/
|
*/
|
||||||
private ArchivaConfiguration archivaConfiguration;
|
private ArchivaConfiguration archivaConfiguration;
|
||||||
|
|
||||||
/**
|
|
||||||
* @plexus.requirement
|
|
||||||
*/
|
|
||||||
private ArchivaXworkUser archivaXworkUser;
|
|
||||||
|
|
||||||
public void afterConfigurationChange( Registry registry, String propertyName, Object propertyValue )
|
public void afterConfigurationChange( Registry registry, String propertyName, Object propertyValue )
|
||||||
{
|
{
|
||||||
if ( ConfigurationNames.isManagedRepositories( propertyName ) )
|
if ( ConfigurationNames.isManagedRepositories( propertyName ) )
|
||||||
|
|
Loading…
Reference in New Issue