*/
public class ArchivaXworkUser
{
- public String getActivePrincipal( Map<String, Object> sessionMap )
+ public String getActivePrincipal( Map<String, ?> sessionMap )
{
SecuritySession securitySession =
(SecuritySession) sessionMap.get( SecuritySystemConstants.SECURITY_SESSION_KEY );
}
}
+ @SuppressWarnings("unchecked")
private String getPrincipal()
{
return archivaXworkUser.getActivePrincipal( ActionContext.getContext().getSession() );
TimeZone timezone = TimeZone.getTimeZone( "UTC" );
DateFormat fmt = new SimpleDateFormat( "yyyyMMdd.HHmmss" );
fmt.setTimeZone( timezone );
- String timestamp = fmt.format( lastUpdatedTimestamp );
-
ManagedRepositoryConfiguration repoConfig =
configuration.getConfiguration().findManagedRepositoryById( repositoryId );
}
}
+ @SuppressWarnings("unchecked")
private String getPrincipal()
{
return archivaXworkUser.getActivePrincipal( ActionContext.getContext().getSession() );
extends ActionSupport\r
implements SessionAware\r
{\r
- protected Map session;\r
+ protected Map<?, ?> session;\r
\r
protected Logger log = LoggerFactory.getLogger( getClass() );\r
\r
+ @SuppressWarnings("unchecked")\r
public void setSession( Map map )\r
{\r
- //noinspection AssignmentToCollectionOrArrayFieldFromParameter\r
this.session = map;\r
}\r
}\r
import org.apache.maven.archiva.database.ObjectNotFoundException;
import org.apache.maven.archiva.database.browsing.RepositoryBrowsing;
import org.apache.maven.archiva.model.ArchivaProjectModel;
+import org.apache.maven.archiva.model.Dependency;
+import org.apache.maven.archiva.model.MailingList;
import org.apache.maven.archiva.security.AccessDeniedException;
import org.apache.maven.archiva.security.ArchivaSecurityException;
import org.apache.maven.archiva.security.PrincipalNotFoundException;
/**
* The list of artifacts that depend on this versioned project.
*/
- private List dependees;
+ private List<ArchivaProjectModel> dependees;
- /**
- * The reports associated with this versioned project.
- */
- private List reports;
-
- private List mailingLists;
+ private List<MailingList> mailingLists;
- private List dependencies;
+ private List<Dependency> dependencies;
private List<String> snapshotVersions;
public String reports()
throws ObjectNotFoundException, ArchivaDatabaseException
{
- System.out.println( "#### In reports." );
// TODO: hook up reports on project - this.reports = artifactsDatabase.findArtifactResults( groupId, artifactId,
// version );
- System.out.println( "#### Found " + reports.size() + " reports." );
return SUCCESS;
}
return SUCCESS;
}
+ @SuppressWarnings("unchecked")
private String getPrincipal()
{
return archivaXworkUser.getActivePrincipal( ActionContext.getContext().getSession() );
this.version = version;
}
- public List getReports()
- {
- return reports;
- }
-
- public List getMailingLists()
+ public List<MailingList> getMailingLists()
{
return mailingLists;
}
- public List getDependencies()
+ public List<Dependency> getDependencies()
{
return dependencies;
}
- public List getDependees()
+ public List<ArchivaProjectModel> getDependees()
{
return dependees;
}
*/
private File artifactFile;
- /**
- * The content type of the artifact to be deployed.
- */
- private String artifactContentType;
-
- /**
- * The original filename of the uploaded artifact file.
- */
- private String artifactFilename;
-
/**
* The temporary file representing the pom to be deployed alongside the artifact.
*/
private File pomFile;
- /**
- * The content type of the pom file.
- */
- private String pomContentType;
-
- /**
- * The original filename of the uploaded pom file.
- */
- private String pomFilename;
-
/**
* The repository where the artifact is to be deployed.
*/
public void setArtifactContentType( String contentType )
{
- this.artifactContentType = StringUtils.trim( contentType );
+ StringUtils.trim( contentType );
}
public void setArtifactFileName( String filename )
{
- this.artifactFilename = StringUtils.trim( filename );
+ StringUtils.trim( filename );
}
public void setPom( File file )
public void setPomContentType( String contentType )
{
- this.pomContentType = StringUtils.trim( contentType );
+ StringUtils.trim( contentType );
}
public void setPomFileName( String filename )
{
- this.pomFilename = StringUtils.trim( filename );
+ StringUtils.trim( filename );
}
public String getGroupId()
packaging = "";
classifier = "";
artifactFile = null;
- artifactContentType = "";
- artifactFilename = "";
pomFile = null;
- pomContentType = "";
- pomFilename = "";
repositoryId = "";
generatePom = false;
}
}
}
+ @SuppressWarnings("unchecked")
private String getPrincipal()
{
return archivaXworkUser.getActivePrincipal( ActionContext.getContext().getSession() );
extends PlexusActionSupport
implements SecureAction
{
- private static final String REPO_SUCCESS = "repoSucces";
-
- private static final String DB_SUCCESS = "dbSuccess";
-
/**
* @plexus.requirement
*/
* under the License.
*/
-import com.opensymphony.xwork2.Preparable;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
import org.apache.commons.lang.StringUtils;
import org.apache.maven.archiva.configuration.ProxyConnectorConfiguration;
import org.apache.maven.archiva.policies.DownloadErrorPolicy;
import org.apache.maven.archiva.policies.PostDownloadPolicy;
import org.apache.maven.archiva.policies.PreDownloadPolicy;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
+import com.opensymphony.xwork2.Preparable;
/**
* AbstractProxyConnectorFormAction - generic fields and methods for either add or edit actions related with the
return INPUT;
}
+ @SuppressWarnings("unchecked")
public String addProperty()
{
String key = getPropertyKey();
return new ArrayList<String>( getConfig().getRemoteRepositoriesAsMap().keySet() );
}
+ @SuppressWarnings("unchecked")
protected void validateConnector()
{
if ( connector.getPolicies() == null )
continue;
}
- Map properties = connector.getProperties();
- for ( Iterator j = properties.keySet().iterator(); j.hasNext(); )
+ Map<String, Object> properties = connector.getProperties();
+ for ( String key : properties.keySet() )
{
- String key = (String) j.next();
-
Object value = properties.get( key );
if ( value.getClass().isArray() )
{
public class AddAdminDatabaseConsumerClosure
implements Closure
{
- private List list = new ArrayList();
+ private List<AdminDatabaseConsumer> list = new ArrayList<AdminDatabaseConsumer>();
- private List selectedIds;
+ private List<String> selectedIds;
- public AddAdminDatabaseConsumerClosure( List selectedIds )
+ public AddAdminDatabaseConsumerClosure( List<String> selectedIds )
{
this.selectedIds = selectedIds;
}
}
}
- public List getList()
+ public List<AdminDatabaseConsumer> getList()
{
return list;
}
* @version $Id$
*/
public class AdminDatabaseConsumerComparator
- implements Comparator
+ implements Comparator<AdminDatabaseConsumer>
{
private static AdminDatabaseConsumerComparator INSTANCE = new AdminDatabaseConsumerComparator();
return INSTANCE;
}
- public int compare( Object o1, Object o2 )
+ public int compare( AdminDatabaseConsumer o1, AdminDatabaseConsumer o2 )
{
if ( o1 == null && o2 == null )
{
return -1;
}
- if ( ( o1 instanceof AdminDatabaseConsumer ) && ( o2 instanceof AdminDatabaseConsumer ) )
- {
- String id1 = ( (AdminDatabaseConsumer) o1 ).getId();
- String id2 = ( (AdminDatabaseConsumer) o2 ).getId();
- return id1.compareToIgnoreCase( id2 );
- }
-
- return 0;
+ String id1 = o1.getId();
+ String id2 = o2.getId();
+ return id1.compareToIgnoreCase( id2 );
}
-
}
* under the License.
*/
-import com.opensymphony.xwork2.Preparable;
+import java.util.Collections;
+import java.util.List;
+
import org.apache.commons.collections.CollectionUtils;
import org.apache.maven.archiva.configuration.ArchivaConfiguration;
import org.apache.maven.archiva.configuration.Configuration;
import org.apache.maven.archiva.configuration.IndeterminateConfigurationException;
import org.apache.maven.archiva.database.updater.DatabaseConsumers;
import org.apache.maven.archiva.security.ArchivaRoleConstants;
-import org.apache.maven.archiva.web.action.admin.scanning.AdminRepositoryConsumerComparator;
import org.apache.maven.archiva.web.action.PlexusActionSupport;
import org.codehaus.plexus.redback.rbac.Resource;
import org.codehaus.plexus.registry.RegistryException;
-
-import java.util.Collections;
-import java.util.List;
import org.codehaus.redback.integration.interceptor.SecureAction;
import org.codehaus.redback.integration.interceptor.SecureActionBundle;
import org.codehaus.redback.integration.interceptor.SecureActionException;
+import com.opensymphony.xwork2.Preparable;
+
/**
* DatabaseAction
*
/**
* List of available {@link AdminDatabaseConsumer} objects for unprocessed artifacts.
*/
- private List unprocessedConsumers;
+ private List<AdminDatabaseConsumer> unprocessedConsumers;
/**
* List of enabled {@link AdminDatabaseConsumer} objects for unprocessed artifacts.
*/
- private List enabledUnprocessedConsumers;
+ private List<String> enabledUnprocessedConsumers;
/**
* List of {@link AdminDatabaseConsumer} objects for "to cleanup" artifacts.
*/
- private List cleanupConsumers;
+ private List<AdminDatabaseConsumer> cleanupConsumers;
/**
* List of enabled {@link AdminDatabaseConsumer} objects for "to cleanup" artifacts.
*/
- private List enabledCleanupConsumers;
+ private List<String> enabledCleanupConsumers;
public void prepare()
throws Exception
addAdminDbConsumer = new AddAdminDatabaseConsumerClosure( dbscanning.getUnprocessedConsumers() );
CollectionUtils.forAllDo( databaseConsumers.getAvailableUnprocessedConsumers(), addAdminDbConsumer );
this.unprocessedConsumers = addAdminDbConsumer.getList();
- Collections.sort( this.unprocessedConsumers, AdminRepositoryConsumerComparator.getInstance() );
+ Collections.sort( this.unprocessedConsumers, AdminDatabaseConsumerComparator.getInstance() );
addAdminDbConsumer = new AddAdminDatabaseConsumerClosure( dbscanning.getCleanupConsumers() );
CollectionUtils.forAllDo( databaseConsumers.getAvailableCleanupConsumers(), addAdminDbConsumer );
this.cleanupConsumers = addAdminDbConsumer.getList();
- Collections.sort( this.cleanupConsumers, AdminRepositoryConsumerComparator.getInstance() );
+ Collections.sort( this.cleanupConsumers, AdminDatabaseConsumerComparator.getInstance() );
}
public String updateUnprocessedConsumers()
this.cron = cron;
}
- public List getCleanupConsumers()
+ public List<AdminDatabaseConsumer> getCleanupConsumers()
{
return cleanupConsumers;
}
- public List getUnprocessedConsumers()
+ public List<AdminDatabaseConsumer> getUnprocessedConsumers()
{
return unprocessedConsumers;
}
- public List getEnabledUnprocessedConsumers()
+ public List<String> getEnabledUnprocessedConsumers()
{
return enabledUnprocessedConsumers;
}
- public void setEnabledUnprocessedConsumers( List enabledUnprocessedConsumers )
+ public void setEnabledUnprocessedConsumers( List<String> enabledUnprocessedConsumers )
{
this.enabledUnprocessedConsumers = enabledUnprocessedConsumers;
}
- public List getEnabledCleanupConsumers()
+ public List<String> getEnabledCleanupConsumers()
{
return enabledCleanupConsumers;
}
- public void setEnabledCleanupConsumers( List enabledCleanupConsumers )
+ public void setEnabledCleanupConsumers( List<String> enabledCleanupConsumers )
{
this.enabledCleanupConsumers = enabledCleanupConsumers;
}
{\r
log.info( "remove [" + path + "] from legacy artifact path resolution" );\r
Configuration configuration = archivaConfiguration.getConfiguration();\r
- for ( Iterator iterator = configuration.getLegacyArtifactPaths().iterator(); iterator.hasNext(); )\r
+ for ( Iterator<LegacyArtifactPath> iterator = configuration.getLegacyArtifactPaths().iterator(); iterator.hasNext(); )\r
{\r
LegacyArtifactPath legacyArtifactPath = (LegacyArtifactPath) iterator.next();\r
if (legacyArtifactPath.match( path ))\r
import com.opensymphony.xwork2.Preparable;
import org.apache.maven.archiva.configuration.ArchivaConfiguration;
+import org.apache.maven.archiva.configuration.NetworkProxyConfiguration;
import org.apache.maven.archiva.security.ArchivaRoleConstants;
import org.apache.maven.archiva.web.action.PlexusActionSupport;
import org.codehaus.plexus.redback.rbac.Resource;
*/
private ArchivaConfiguration configuration;
- private List networkProxies;
+ private List<NetworkProxyConfiguration> networkProxies;
public void prepare()
throws Exception
return bundle;
}
- public List getNetworkProxies()
+ public List<NetworkProxyConfiguration> getNetworkProxies()
{
return networkProxies;
}
- public void setNetworkProxies( List networkProxies )
+ public void setNetworkProxies( List<NetworkProxyConfiguration> networkProxies )
{
this.networkProxies = networkProxies;
}
public class AddAdminRepoConsumerClosure
implements Closure
{
- private List list = new ArrayList();
+ private List<AdminRepositoryConsumer> list = new ArrayList<AdminRepositoryConsumer>();
- private List selectedIds;
+ private List<String> selectedIds;
- public AddAdminRepoConsumerClosure( List selectedIds )
+ public AddAdminRepoConsumerClosure( List<String> selectedIds )
{
this.selectedIds = selectedIds;
}
}
}
- public List getList()
+ public List<AdminRepositoryConsumer> getList()
{
return list;
}
* @version $Id$
*/
public class AdminRepositoryConsumerComparator
- implements Comparator
+ implements Comparator<AdminRepositoryConsumer>
{
private static AdminRepositoryConsumerComparator INSTANCE = new AdminRepositoryConsumerComparator();
return INSTANCE;
}
- public int compare( Object o1, Object o2 )
+ public int compare( AdminRepositoryConsumer o1, AdminRepositoryConsumer o2 )
{
if ( o1 == null && o2 == null )
{
return -1;
}
- if ( ( o1 instanceof AdminRepositoryConsumer ) && ( o2 instanceof AdminRepositoryConsumer ) )
- {
- String id1 = ( (AdminRepositoryConsumer) o1 ).getId();
- String id2 = ( (AdminRepositoryConsumer) o2 ).getId();
- return id1.compareToIgnoreCase( id2 );
- }
-
- return 0;
+ String id1 = o1.getId();
+ String id2 = o2.getId();
+ return id1.compareToIgnoreCase( id2 );
}
}
*/
private RepositoryContentConsumers repoconsumerUtil;
- private Map fileTypeMap;
+ private Map<String, FileType> fileTypeMap;
- private List fileTypeIds;
+ private List<String> fileTypeIds;
/**
* List of {@link AdminRepositoryConsumer} objects for consumers of known content.
*/
- private List knownContentConsumers;
+ private List<AdminRepositoryConsumer> knownContentConsumers;
/**
* List of enabled {@link AdminRepositoryConsumer} objects for consumers of known content.
*/
- private List enabledKnownContentConsumers;
+ private List<String> enabledKnownContentConsumers;
/**
* List of {@link AdminRepositoryConsumer} objects for consumers of invalid/unknown content.
*/
- private List invalidContentConsumers;
+ private List<AdminRepositoryConsumer> invalidContentConsumers;
/**
* List of enabled {@link AdminRepositoryConsumer} objects for consumers of invalid/unknown content.
*/
- private List enabledInvalidContentConsumers;
+ private List<String> enabledInvalidContentConsumers;
private String pattern;
return fileTypeId;
}
- public List getFileTypeIds()
+ public List<String> getFileTypeIds()
{
return fileTypeIds;
}
- public Map getFileTypeMap()
+ public Map<String, FileType> getFileTypeMap()
{
return fileTypeMap;
}
- public List getInvalidContentConsumers()
+ public List<AdminRepositoryConsumer> getInvalidContentConsumers()
{
return invalidContentConsumers;
}
- public List getKnownContentConsumers()
+ public List<AdminRepositoryConsumer> getKnownContentConsumers()
{
return knownContentConsumers;
}
this.invalidContentConsumers = addAdminRepoConsumer.getList();
Collections.sort( invalidContentConsumers, AdminRepositoryConsumerComparator.getInstance() );
- fileTypeIds = new ArrayList();
+ fileTypeIds = new ArrayList<String>();
fileTypeIds.addAll( fileTypeMap.keySet() );
Collections.sort( fileTypeIds );
}
return SUCCESS;
}
- public List getEnabledInvalidContentConsumers()
+ public List<String> getEnabledInvalidContentConsumers()
{
return enabledInvalidContentConsumers;
}
- public void setEnabledInvalidContentConsumers( List enabledInvalidContentConsumers )
+ public void setEnabledInvalidContentConsumers( List<String> enabledInvalidContentConsumers )
{
this.enabledInvalidContentConsumers = enabledInvalidContentConsumers;
}
- public List getEnabledKnownContentConsumers()
+ public List<String> getEnabledKnownContentConsumers()
{
return enabledKnownContentConsumers;
}
- public void setEnabledKnownContentConsumers( List enabledKnownContentConsumers )
+ public void setEnabledKnownContentConsumers( List<String> enabledKnownContentConsumers )
{
this.enabledKnownContentConsumers = enabledKnownContentConsumers;
}
}
else
{
- Map params = new HashMap();
+ Map<String, String> params = new HashMap<String, String>();
if ( path.charAt( 0 ) == '/' )
{
return super.getMapping( httpServletRequest, manager );
}
+ @SuppressWarnings("unchecked")
@Override
public String getUriFromActionMapping( ActionMapping actionMapping )
{
- Map params = actionMapping.getParams();
+ Map<String, String> params = actionMapping.getParams();
if ( ACTION_BROWSE.equals( actionMapping.getName() ) )
{
return BROWSE_PREFIX;
return super.getUriFromActionMapping( actionMapping );
}
- private String toUri( Map params, boolean artifactId, boolean version, String method )
+ private String toUri( Map<String, String> params, boolean artifactId, boolean version, String method )
{
StringBuffer buf = new StringBuffer();
import org.apache.maven.archiva.database.ArchivaDatabaseException;
import org.apache.maven.archiva.security.AccessDeniedException;
import org.apache.maven.archiva.security.ArchivaSecurityException;
-import org.apache.maven.archiva.security.ArchivaXworkUser;
import org.apache.maven.archiva.security.PrincipalNotFoundException;
import org.apache.maven.archiva.security.ServletAuthenticator;
import org.apache.maven.archiva.security.UserRepositories;
private HttpAuthenticator httpAuth;
- private ArchivaXworkUser archivaXworkUser;
-
public void init( javax.servlet.ServletConfig servletConfig )
throws ServletException
{
(ServletAuthenticator) wac.getBean( PlexusToSpringUtils.buildSpringId( ServletAuthenticator.class.getName() ) );
httpAuth =
(HttpAuthenticator) wac.getBean( PlexusToSpringUtils.buildSpringId( HttpAuthenticator.ROLE, "basic" ) );
- archivaXworkUser = (ArchivaXworkUser) wac.getBean( PlexusToSpringUtils.buildSpringId( ArchivaXworkUser.class ) );
}
public void doGet( HttpServletRequest req, HttpServletResponse res )
SecuritySynchronization securitySync = (SecuritySynchronization) wac.getBean(PlexusToSpringUtils.buildSpringId(SecuritySynchronization.class));
ResolverFactoryInit resolverFactory = (ResolverFactoryInit) wac.getBean(PlexusToSpringUtils.buildSpringId(ResolverFactoryInit.class));
ArchivaTaskScheduler taskScheduler = (ArchivaTaskScheduler) wac.getBean(PlexusToSpringUtils.buildSpringId(ArchivaTaskScheduler.class));
- TaskQueueExecutor databaseUpdateQueue = (TaskQueueExecutor) wac.getBean(PlexusToSpringUtils.buildSpringId(TaskQueueExecutor.class, "database-update"));
- TaskQueueExecutor repositoryScanningQueue = (TaskQueueExecutor) wac.getBean(PlexusToSpringUtils.buildSpringId(TaskQueueExecutor.class, "repository-scanning"));
+ wac.getBean(PlexusToSpringUtils.buildSpringId(TaskQueueExecutor.class, "database-update"));
+ wac.getBean(PlexusToSpringUtils.buildSpringId(TaskQueueExecutor.class, "repository-scanning"));
try
{
private String artifactId;
+ @SuppressWarnings("unused")
private String version;
private String nodevar;
- private Iterator treeIterator;
+ private Iterator<TreeEntry> treeIterator;
private List<TreeEntry> tree;
unExposeVariables();
}
+ @SuppressWarnings("unchecked")
public int doStartTag()
throws JspException
{
* under the License.
*/
-import com.opensymphony.xwork2.util.ValueStack;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import org.apache.struts2.components.Component;
-import org.apache.struts2.views.jsp.TagUtils;
-
import javax.servlet.jsp.JspException;
-import javax.servlet.jsp.tagext.TagSupport;
+
+import org.apache.struts2.components.Component;
import org.apache.struts2.views.jsp.ComponentTagSupport;
+import com.opensymphony.xwork2.util.ValueStack;
+
/**
* DownloadArtifactTag
*
return determineActionURL( "browse", NAMESPACE, method, req, res, parameters, req.getScheme(), includeContext, encode, false, false );
}
+ @SuppressWarnings("unchecked")
private String determineBrowseGroupActionUrl( String gid )
{
parameters.put( "groupId", gid );
*/
public class PlexusTagUtil
{
- public static Object lookup( PageContext pageContext, Class clazz )
+ public static Object lookup( PageContext pageContext, Class<?> clazz )
throws ComponentLookupException
{
return getContainer( pageContext ).lookup( clazz );
return getContainer( pageContext ).lookup( role );
}
- public static Object lookup( PageContext pageContext, Class clazz, String hint )
+ public static Object lookup( PageContext pageContext, Class<?> clazz, String hint )
throws ComponentLookupException
{
return getContainer( pageContext ).lookup( clazz, hint );
*/
public class ContextUtils
{
- private static final Map defaultSchemePortMap;
+ private static final Map<String, Integer> defaultSchemePortMap;
static
{
- defaultSchemePortMap = new HashMap();
+ defaultSchemePortMap = new HashMap<String, Integer>();
defaultSchemePortMap.put( "http", new Integer( 80 ) );
defaultSchemePortMap.put( "https", new Integer( 443 ) );
}
+++ /dev/null
-package org.apache.maven.archiva.web.util;
-
-/*
- * 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.
- */
-
-//import org.apache.maven.archiva.indexer.record.StandardArtifactIndexRecord;
-//import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
-//import org.apache.maven.model.Dependency;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
-public class VersionMerger
-{
-
- public static List /*<DependencyWrapper>*/ wrap( List /*<StandardArtifactIndexRecord>*/ artifacts )
- {
- List dependencies = new ArrayList();
-
-// for ( Iterator i = artifacts.iterator(); i.hasNext(); )
-// {
-// Dependency dependency = (Dependency) i.next();
-//
-// dependencies.add( new DependencyWrapper( dependency ) );
-// }
-
- return dependencies;
- }
-
- public static Collection /*<DependencyWrapper*/ merge( Collection /*<StandardArtifactIndexRecord>*/ artifacts )
- {
- Map dependees = new LinkedHashMap();
-
-// for ( Iterator i = artifacts.iterator(); i.hasNext(); )
-// {
-// StandardArtifactIndexRecord record = (StandardArtifactIndexRecord) i.next();
-//
-// String key = record.getGroupId() + ":" + record.getArtifactId();
-// if ( dependees.containsKey( key ) )
-// {
-// DependencyWrapper wrapper = (DependencyWrapper) dependees.get( key );
-// wrapper.addVersion( record.getVersion() );
-// }
-// else
-// {
-// DependencyWrapper wrapper = new DependencyWrapper( record );
-//
-// dependees.put( key, wrapper );
-// }
-// }
-
- return dependees.values();
- }
-
-// public static class DependencyWrapper
-// {
-// private final String groupId;
-//
-// private final String artifactId;
-//
-// /**
-// * Versions added. We ignore duplicates since you might add those with varying classifiers.
-// */
-// private Set versions = new HashSet();
-//
-// private String version;
-//
-// private String scope;
-//
-// private String classifier;
-//
-// public DependencyWrapper( StandardArtifactIndexRecord record )
-// {
-// this.groupId = record.getGroupId();
-//
-// this.artifactId = record.getArtifactId();
-//
-// addVersion( record.getVersion() );
-// }
-//
-// public DependencyWrapper( Dependency dependency )
-// {
-// this.groupId = dependency.getGroupId();
-//
-// this.artifactId = dependency.getArtifactId();
-//
-// this.scope = dependency.getScope();
-//
-// this.classifier = dependency.getClassifier();
-//
-// addVersion( dependency.getVersion() );
-// }
-//
-// public String getScope()
-// {
-// return scope;
-// }
-//
-// public String getClassifier()
-// {
-// return classifier;
-// }
-//
-// public void addVersion( String version )
-// {
-// // We use DefaultArtifactVersion to get the correct sorting order later, however it does not have
-// // hashCode properly implemented, so we add it here.
-// // TODO: add these methods to the actual DefaultArtifactVersion and use that.
-// versions.add( new DefaultArtifactVersion( version )
-// {
-// public int hashCode()
-// {
-// int result;
-// result = getBuildNumber();
-// result = 31 * result + getMajorVersion();
-// result = 31 * result + getMinorVersion();
-// result = 31 * result + getIncrementalVersion();
-// result = 31 * result + ( getQualifier() != null ? getQualifier().hashCode() : 0 );
-// return result;
-// }
-//
-// public boolean equals( Object o )
-// {
-// if ( this == o )
-// {
-// return true;
-// }
-// if ( o == null || getClass() != o.getClass() )
-// {
-// return false;
-// }
-//
-// DefaultArtifactVersion that = (DefaultArtifactVersion) o;
-//
-// if ( getBuildNumber() != that.getBuildNumber() )
-// {
-// return false;
-// }
-// if ( getIncrementalVersion() != that.getIncrementalVersion() )
-// {
-// return false;
-// }
-// if ( getMajorVersion() != that.getMajorVersion() )
-// {
-// return false;
-// }
-// if ( getMinorVersion() != that.getMinorVersion() )
-// {
-// return false;
-// }
-// if ( getQualifier() != null ? !getQualifier().equals( that.getQualifier() )
-// : that.getQualifier() != null )
-// {
-// return false;
-// }
-//
-// return true;
-// }
-// } );
-//
-// if ( versions.size() == 1 )
-// {
-// this.version = version;
-// }
-// else
-// {
-// this.version = null;
-// }
-// }
-//
-// public String getGroupId()
-// {
-// return groupId;
-// }
-//
-// public String getArtifactId()
-// {
-// return artifactId;
-// }
-//
-// public List getVersions()
-// {
-// List versions = new ArrayList( this.versions );
-// Collections.sort( versions );
-// return versions;
-// }
-//
-// public String getVersion()
-// {
-// return version;
-// }
-// }
-}
*
* NOTE: Don't forget to run {@link #preRequest(ActionSupport)} before each request to your action!
*/
+ @SuppressWarnings("unchecked")
protected void assertNoErrors( ActionSupport action )
{
List<String> errors = (List<String>) action.getActionErrors();
}
}
+ @SuppressWarnings("unchecked")
protected void assertRequestStatus( ActionSupport action, String expectedStatus, String methodName )
throws Exception
{
*/
import java.util.ArrayList;
-import java.util.HashMap;
+import java.util.Collections;
import java.util.List;
import org.apache.archiva.indexer.search.RepositorySearch;
versions.add( "1.0" );
versions.add( "1.1" );
- archivaXworkUserControl.expectAndReturn( archivaXworkUser.getActivePrincipal( new HashMap() ), "user", 3 );
+ archivaXworkUserControl.expectAndReturn( getActivePrincipal(), "user", 3 );
userReposControl.expectAndReturn( userRepos.getObservableRepositoryIds( "user" ), selectedRepos, 2 );
searchControl.verify();
daoControl.verify();
}
+
+ private String getActivePrincipal()
+ {
+ return archivaXworkUser.getActivePrincipal( Collections.<String,Object>emptyMap() );
+ }
public void testSearchWithinSearchResults()
throws Exception
versions.add( "1.0" );
versions.add( "1.1" );
- archivaXworkUserControl.expectAndReturn( archivaXworkUser.getActivePrincipal( new HashMap() ), "user", 3 );
+ archivaXworkUserControl.expectAndReturn( getActivePrincipal(), "user", 3 );
userReposControl.expectAndReturn( userRepos.getObservableRepositoryIds( "user" ), selectedRepos, 2 );
List<String> selectedRepos = new ArrayList<String>();
- archivaXworkUserControl.expectAndReturn( archivaXworkUser.getActivePrincipal( new HashMap() ), "user" );
+ archivaXworkUserControl.expectAndReturn( getActivePrincipal(), "user" );
userReposControl.expectAndReturn( userRepos.getObservableRepositoryIds( "user" ), selectedRepos );
SearchResults results = new SearchResults();
- archivaXworkUserControl.expectAndReturn( archivaXworkUser.getActivePrincipal( new HashMap() ), "user", 2 );
+ archivaXworkUserControl.expectAndReturn( getActivePrincipal(), "user", 2 );
userReposControl.expectAndReturn( userRepos.getObservableRepositoryIds( "user" ), selectedRepos );
SearchFields searchFields = new SearchFields( "org", null, null, null, null, selectedRepos );
- archivaXworkUserControl.expectAndReturn( archivaXworkUser.getActivePrincipal( new HashMap() ), "user" );
+ archivaXworkUserControl.expectAndReturn( getActivePrincipal(), "user" );
searchControl.expectAndReturn( search.search( "user", searchFields, limits ), results );
SearchFields searchFields = new SearchFields( "org", null, null, null, null, selectedRepos );
- archivaXworkUserControl.expectAndReturn( archivaXworkUser.getActivePrincipal( new HashMap() ), "user", 2 );
+ archivaXworkUserControl.expectAndReturn( getActivePrincipal(), "user", 2 );
userReposControl.expectAndReturn( userRepos.getObservableRepositoryIds( "user" ), selectedRepos );
SearchFields searchFields = new SearchFields( "org", null, null, null, null, selectedRepos );
- archivaXworkUserControl.expectAndReturn( archivaXworkUser.getActivePrincipal( new HashMap() ), "user" );
+ archivaXworkUserControl.expectAndReturn( getActivePrincipal(), "user" );
searchControl.expectAndReturn( search.search( "user", searchFields, limits ), results );
* under the License.
*/
-import com.opensymphony.xwork2.Action;
-import org.apache.maven.archiva.configuration.ArchivaConfiguration;
import org.apache.maven.archiva.configuration.OrganisationInformation;
-import org.apache.maven.archiva.configuration.Configuration;
-import org.apache.maven.archiva.web.action.AbstractWebworkTestCase;
+
+import com.opensymphony.xwork2.Action;
/**
*/
assertEquals( 1, connector.getProperties().size() );
}
+ @SuppressWarnings("unchecked")
public void testAddProxyConnectorCommit()
throws Exception
{
archivaConfiguration.save( config );
}
+ @SuppressWarnings("unchecked")
private void populateProxyConnector( ProxyConnectorConfiguration connector )
{
connector.setProxyId( AbstractProxyConnectorFormAction.DIRECT_CONNECTION );
assertEquals( 1, connector.getWhiteListPatterns().size() );
}
+ @SuppressWarnings("unchecked")
public void testEditProxyConnectorCommit()
throws Exception
{
assertEquals( TEST_TARGET_ID, connector.getTargetRepoId() );
}
+ @SuppressWarnings("unchecked")
private Configuration createInitialConfiguration()
{
Configuration config = new Configuration();
import org.apache.maven.archiva.database.RepositoryContentStatisticsDAO;
import org.apache.maven.archiva.database.RepositoryProblemDAO;
import org.apache.maven.archiva.database.SimpleConstraint;
+import org.apache.maven.archiva.model.RepositoryContentStatistics;
/**
* AbstractManagedRepositoryArchivaDAOStub
*/
private RepositoryContentStatisticsDAO repoContentStatisticsDAO;
- public List query( SimpleConstraint constraint )
+ public List<RepositoryContentStatistics> query( SimpleConstraint constraint )
{
return null;
}
{
private ArchivaConfiguration configuration;
- public List query( SimpleConstraint constraint )
+ public List<RepositoryContentStatistics> query( SimpleConstraint constraint )
{
Assert.assertEquals( RepositoryContentStatistics.class, constraint.getResultClass() );
return projectModel;
}
- public List queryProjectModels( Constraint constraint )
+ public List<ArchivaProjectModel> queryProjectModels( Constraint constraint )
throws ObjectNotFoundException, ArchivaDatabaseException
{
// TODO Auto-generated method stub
Assert.assertEquals( "repo-ident", stats.getRepositoryId() );
}
- public List queryRepositoryContentStatistics( Constraint constraint )
+ public List<RepositoryContentStatistics> queryRepositoryContentStatistics( Constraint constraint )
throws ObjectNotFoundException, ArchivaDatabaseException
{
Assert.assertTrue( constraint instanceof RepositoryContentStatisticsByRepositoryConstraint );
*/
import java.util.Collections;
+import java.util.List;
import org.apache.maven.archiva.configuration.ArchivaConfiguration;
import org.apache.maven.archiva.configuration.Configuration;
assertNotNull( action.getGroupToRepositoryMap() );
assertEquals( 1, action.getGroupToRepositoryMap().size() );
- java.util.List repos = action.getGroupToRepositoryMap().get( repoGroup.getId() );
+ List<String> repos = action.getGroupToRepositoryMap().get( repoGroup.getId() );
assertEquals( 1, repos.size() );
assertEquals( REPO2_ID, repos.get( 0 ) );
}
assertNotNull( action.getGroupToRepositoryMap() );
assertEquals( 1, action.getGroupToRepositoryMap().size() );
- java.util.List repos = action.getGroupToRepositoryMap().get( repoGroup.getId() );
+ List<String> repos = action.getGroupToRepositoryMap().get( repoGroup.getId() );
assertEquals( 1, repos.size() );
assertEquals( REPO2_ID, repos.get( 0 ) );
assertNotNull( action.getGroupToRepositoryMap() );
assertEquals( 1, action.getGroupToRepositoryMap().size() );
- java.util.List repos = action.getGroupToRepositoryMap().get( repoGroup.getId() );
+ List<String> repos = action.getGroupToRepositoryMap().get( repoGroup.getId() );
assertEquals( 1, repos.size() );
assertEquals( REPO2_ID, repos.get( 0 ) );
assertNotNull( action.getGroupToRepositoryMap() );
assertEquals( 1, action.getGroupToRepositoryMap().size() );
- java.util.List repos = action.getGroupToRepositoryMap().get( repoGroup.getId() );
+ List<String> repos = action.getGroupToRepositoryMap().get( repoGroup.getId() );
assertEquals( 1, repos.size() );
assertEquals( REPO2_ID, repos.get( 0 ) );
assertNotNull( action.getGroupToRepositoryMap() );
assertEquals( 1, action.getGroupToRepositoryMap().size() );
- java.util.List repos = action.getGroupToRepositoryMap().get( repoGroup.getId() );
+ List<String> repos = action.getGroupToRepositoryMap().get( repoGroup.getId() );
assertEquals( 1, repos.size() );
assertEquals( REPO2_ID, repos.get( 0 ) );
return null;
}
- public List queryArtifacts( Constraint constraint )
+ public List<ArchivaArtifact> queryArtifacts( Constraint constraint )
throws ObjectNotFoundException, ArchivaDatabaseException
{
List<ArchivaArtifact> artifacts = new ArrayList<ArchivaArtifact>();
* under the License.
*/
-import java.io.IOException;
-
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.codec.Encoder;
try
{
- WebResponse response = client.getResponse( "http://localhost/feeds?invalid_param=xxx" );
+ client.getResponse( "http://localhost/feeds?invalid_param=xxx" );
+ fail( "Expected exception" );
}
catch ( HttpException he )
{
try
{
- WebResponse response = client.getResponse( request );
+ client.getResponse( request );
+ fail( "Expected exception" );
}
catch ( HttpException he )
{
try
{
- WebResponse response = client.getResponse( request );
+ client.getResponse( request );
+ fail( "Expected exception" );
}
catch ( HttpException he )
{