]> source.dussan.org Git - archiva.git/commitdiff
warnings in scheduled and security modules
authorBrett Porter <brett@apache.org>
Tue, 17 Mar 2009 16:18:51 +0000 (16:18 +0000)
committerBrett Porter <brett@apache.org>
Tue, 17 Mar 2009 16:18:51 +0000 (16:18 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@755300 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-scheduled/src/test/java/org/apache/maven/archiva/scheduled/TestDatabaseCleanupConsumer.java
archiva-modules/archiva-scheduled/src/test/java/org/apache/maven/archiva/scheduled/TestDatabaseUnprocessedConsumer.java
archiva-modules/archiva-scheduled/src/test/java/org/apache/maven/archiva/scheduled/executors/ArchivaDatabaseUpdateTaskExecutorTest.java
archiva-modules/archiva-scheduled/src/test/java/org/apache/maven/archiva/scheduled/executors/ArchivaRepositoryScanningTaskExecutorTest.java
archiva-modules/archiva-web/archiva-security/src/main/java/org/apache/maven/archiva/security/DefaultUserRepositories.java
archiva-modules/archiva-web/archiva-security/src/main/java/org/apache/maven/archiva/security/SecurityStartup.java

index 3b7781a8c6b8314bcf80d6094653444ce1220f4a..d8ab64a4e6f016dbd3c71496ceef8997f1a5571d 100644 (file)
@@ -56,7 +56,7 @@ public class TestDatabaseCleanupConsumer
         countComplete++;
     }
 
-    public List getIncludedTypes()
+    public List<String> getIncludedTypes()
     {
         return null;
     }
index 6e4a6c8d834244cf0282b889f7571f62165e7bcf..6f3807c0717e75765d0cc728d6c15b91914444b7 100644 (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;
index ac769248610f74d67f3e66496eee13eef38786bb..677c950626c5872423536467bd5874b0deed3568 100644 (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() );
     }
index 88b7f69f5376bc7ef77cffcfa7e31c0729aa72d9..b350982f702b398e8648b13e3e58b8b0a8f10c89 100644 (file)
@@ -19,11 +19,21 @@ package org.apache.maven.archiva.scheduled.executors;
  * under the License.
  */
 
+import java.io.File;
+import java.net.URL;
+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.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;
@@ -31,16 +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.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-
-import javax.jdo.PersistenceManager;
-import javax.jdo.PersistenceManagerFactory;
-
 /**
  * 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() );
index 3eb9166c69f181c3cce63777a1ca68e7c250557a..47029880eee09755e9f30ed234e87c1f816bbd97 100644 (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 ) )
index b81b7a5fa9a1bda777dd0913f8244a58ea08bb81..20d1b6fd4c0f4f473f798477cb681dfde54cf8fc 100644 (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 ) )