From 1f633d5244e2cf1cb7721b666758fbfec8b3625e Mon Sep 17 00:00:00 2001 From: Brett Porter Date: Mon, 21 Dec 2009 11:34:37 +0000 Subject: [PATCH] [MRM-1285][MRM-404] improve appearance of the downloads box and correct handling of snapshots git-svn-id: https://svn.apache.org/repos/asf/archiva/branches/MRM-1025@892772 13f79535-47bb-0310-9956-ffa450edef68 --- .../web/action/ShowArtifactAction.java | 249 +++++++++---- .../archiva/web/tags/DownloadArtifact.java | 333 ------------------ .../archiva/web/tags/DownloadArtifactTag.java | 103 ------ .../src/main/resources/struts.xml | 2 +- .../src/main/webapp/WEB-INF/decorators.xml | 4 - .../WEB-INF/jsp/artifact/dependencyTree.jsp | 28 -- .../jsp/decorators/artifactDecorator.jsp | 150 -------- .../WEB-INF/jsp/include/artifactInfo.jspf | 17 - .../WEB-INF/jsp/include/dependencyTree.jspf | 16 +- .../main/webapp/WEB-INF/jsp/showArtifact.jsp | 70 +++- .../src/main/webapp/WEB-INF/taglib.tld | 41 --- .../src/main/webapp/css/site.css | 113 +----- .../memory/TestMetadataResolver.java | 15 +- .../web/action/ShowArtifactActionTest.java | 121 +++++-- 14 files changed, 356 insertions(+), 906 deletions(-) delete mode 100644 archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/DownloadArtifact.java delete mode 100644 archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/DownloadArtifactTag.java delete mode 100644 archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/artifact/dependencyTree.jsp delete mode 100644 archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/decorators/artifactDecorator.jsp diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/ShowArtifactAction.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/ShowArtifactAction.java index 94f33f1dc..c6998e075 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/ShowArtifactAction.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/ShowArtifactAction.java @@ -19,16 +19,26 @@ package org.apache.maven.archiva.web.action; * under the License. */ +import java.text.DecimalFormat; import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; import java.util.List; +import java.util.Map; import com.opensymphony.xwork2.Validateable; +import org.apache.archiva.metadata.model.ArtifactMetadata; import org.apache.archiva.metadata.model.Dependency; import org.apache.archiva.metadata.model.MailingList; import org.apache.archiva.metadata.model.ProjectVersionMetadata; import org.apache.archiva.metadata.model.ProjectVersionReference; import org.apache.archiva.metadata.repository.MetadataResolver; import org.apache.commons.lang.StringUtils; +import org.apache.maven.archiva.model.ArtifactReference; +import org.apache.maven.archiva.repository.ManagedRepositoryContent; +import org.apache.maven.archiva.repository.RepositoryContentFactory; +import org.apache.maven.archiva.repository.RepositoryException; +import org.apache.maven.archiva.repository.layout.LayoutException; /** * Browse the repository. @@ -48,6 +58,11 @@ public class ShowArtifactAction */ private MetadataResolver metadataResolver; + /** + * @plexus.requirement + */ + private RepositoryContentFactory repositoryFactory; + /* .\ Exposed Output Objects \.__________________________________ */ private String groupId; @@ -72,7 +87,9 @@ public class ShowArtifactAction private List dependencies; - private List snapshotVersions; + private Map> artifacts; + + private boolean dependencyTree = false; /** * Show the versioned project information tab. @@ -81,18 +98,16 @@ public class ShowArtifactAction */ public String artifact() { + ProjectVersionMetadata versionMetadata = null; + artifacts = new HashMap>(); + + List repos = getObservableRepos(); // In the future, this should be replaced by the repository grouping mechanism, so that we are only making // simple resource requests here and letting the resolver take care of it - ProjectVersionMetadata versionMetadata = null; - snapshotVersions = new ArrayList(); - for ( String repoId : getObservableRepos() ) + for ( String repoId : repos ) { if ( versionMetadata == null ) { - // TODO: though we have a simple mapping now, do we want to support paths like /1.0-20090111.123456-1/ - // again by mapping it to /1.0-SNAPSHOT/? Currently, the individual versions are not supported as we - // are only displaying the project's single version. - // we don't want the implementation being that intelligent - so another resolver to do the // "just-in-time" nature of picking up the metadata (if appropriate for the repository type) is used versionMetadata = metadataResolver.getProjectVersion( repoId, groupId, artifactId, version ); @@ -100,9 +115,17 @@ public class ShowArtifactAction { repositoryId = repoId; - snapshotVersions.addAll( - metadataResolver.getArtifactVersions( repoId, groupId, artifactId, versionMetadata.getId() ) ); - snapshotVersions.remove( version ); + Collection artifacts = metadataResolver.getArtifacts( repoId, groupId, artifactId, version ); + for ( ArtifactMetadata artifact : artifacts ) + { + List l = this.artifacts.get( artifact.getVersion() ); + if ( l == null ) + { + l = new ArrayList(); + this.artifacts.put( artifact.getVersion(), l ); + } + l.add( new ArtifactDownloadInfo( artifact ) ); + } } } } @@ -122,25 +145,11 @@ public class ShowArtifactAction */ public String dependencies() { - ProjectVersionMetadata versionMetadata = null; - for ( String repoId : getObservableRepos() ) - { - if ( versionMetadata == null ) - { - versionMetadata = metadataResolver.getProjectVersion( repoId, groupId, artifactId, version ); - } - } - - if ( versionMetadata == null ) - { - addActionError( "Artifact not found" ); - return ERROR; - } - model = versionMetadata; + String result = artifact(); this.dependencies = model.getDependencies(); - return SUCCESS; + return result; } /** @@ -148,25 +157,11 @@ public class ShowArtifactAction */ public String mailingLists() { - ProjectVersionMetadata versionMetadata = null; - for ( String repoId : getObservableRepos() ) - { - if ( versionMetadata == null ) - { - versionMetadata = metadataResolver.getProjectVersion( repoId, groupId, artifactId, version ); - } - } - - if ( versionMetadata == null ) - { - addActionError( "Artifact not found" ); - return ERROR; - } - model = versionMetadata; - + String result = artifact(); + this.mailingLists = model.getMailingLists(); - return SUCCESS; + return result; } /** @@ -184,22 +179,6 @@ public class ShowArtifactAction */ public String dependees() { - ProjectVersionMetadata versionMetadata = null; - for ( String repoId : getObservableRepos() ) - { - if ( versionMetadata == null ) - { - versionMetadata = metadataResolver.getProjectVersion( repoId, groupId, artifactId, version ); - } - } - - if ( versionMetadata == null ) - { - addActionError( "Artifact not found" ); - return ERROR; - } - model = versionMetadata; - List references = new ArrayList(); // TODO: what if we get duplicates across repositories? for ( String repoId : getObservableRepos() ) @@ -213,7 +192,7 @@ public class ShowArtifactAction // TODO: may need to note on the page that references will be incomplete if the other artifacts are not yet stored in the content repository // (especially in the case of pre-population import) - return SUCCESS; + return artifact(); } /** @@ -227,6 +206,9 @@ public class ShowArtifactAction // TODO: may need to note on the page that tree will be incomplete if the other artifacts are not yet stored in the content repository // (especially in the case of pre-population import) + // TODO: a bit ugly, should really be mapping all these results differently now + this.dependencyTree = true; + return artifact(); } @@ -299,7 +281,7 @@ public class ShowArtifactAction return dependees; } - public String getRepositoryId() + public String getRepositoryId() { return repositoryId; } @@ -309,13 +291,148 @@ public class ShowArtifactAction this.repositoryId = repositoryId; } - public List getSnapshotVersions() + public MetadataResolver getMetadataResolver() { - return snapshotVersions; + return metadataResolver; } - public MetadataResolver getMetadataResolver() + public Map> getArtifacts() { - return metadataResolver; + return artifacts; + } + + public Collection getSnapshotVersions() + { + return artifacts.keySet(); + } + + public void setRepositoryFactory( RepositoryContentFactory repositoryFactory ) + { + this.repositoryFactory = repositoryFactory; + } + + public boolean isDependencyTree() + { + return dependencyTree; + } + + // TODO: move this into the artifact metadata itself via facets where necessary + public class ArtifactDownloadInfo + { + private String type; + + private String namespace; + + private String project; + + private String size; + + private String id; + + private String repositoryId; + + private String version; + + private String path; + + public ArtifactDownloadInfo( ArtifactMetadata artifact ) + { + repositoryId = artifact.getRepositoryId(); + + // TODO: use metadata resolver capability instead + ManagedRepositoryContent repo; + try + { + repo = repositoryFactory.getManagedRepositoryContent( repositoryId ); + } + catch ( RepositoryException e ) + { + throw new RuntimeException( e ); + } + + ArtifactReference ref = new ArtifactReference(); + ref.setArtifactId( artifact.getProject() ); + ref.setGroupId( artifact.getNamespace() ); + ref.setVersion( artifact.getVersion() ); + path = repo.toPath( ref ); + path = path.substring( 0, path.lastIndexOf( "/" ) + 1 ) + artifact.getId(); + + try + { + type = repo.toArtifactReference( path ).getType(); + } + catch ( LayoutException e ) + { + throw new RuntimeException( e ); + } + + namespace = artifact.getNamespace(); + project = artifact.getProject(); + + // TODO: find a reusable formatter for this + double s = artifact.getSize(); + String symbol = "b"; + if ( s > 1024 ) + { + symbol = "K"; + s /= 1024; + + if ( s > 1024 ) + { + symbol = "M"; + s /= 1024; + + if ( s > 1024 ) + { + symbol = "G"; + s /= 1024; + } + } + } + + size = new DecimalFormat( "#,###.##" ).format( s ) + " " + symbol; + id = artifact.getId(); + version = artifact.getVersion(); + } + + public String getNamespace() + { + return namespace; + } + + public String getType() + { + return type; + } + + public String getProject() + { + return project; + } + + public String getSize() + { + return size; + } + + public String getId() + { + return id; + } + + public String getVersion() + { + return version; + } + + public String getRepositoryId() + { + return repositoryId; + } + + public String getPath() + { + return path; + } } } diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/DownloadArtifact.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/DownloadArtifact.java deleted file mode 100644 index 1cb8f8542..000000000 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/DownloadArtifact.java +++ /dev/null @@ -1,333 +0,0 @@ -package org.apache.maven.archiva.web.tags; - -/* - * 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 java.io.IOException; -import java.io.Writer; -import java.text.DecimalFormat; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.jsp.PageContext; - -import com.opensymphony.xwork2.ActionContext; -import com.opensymphony.xwork2.util.ValueStack; -import org.apache.archiva.metadata.model.ArtifactMetadata; -import org.apache.archiva.metadata.repository.MetadataResolver; -import org.apache.commons.lang.StringEscapeUtils; -import org.apache.commons.lang.StringUtils; -import org.apache.maven.archiva.model.ArtifactReference; -import org.apache.maven.archiva.repository.ManagedRepositoryContent; -import org.apache.maven.archiva.repository.RepositoryContentFactory; -import org.apache.maven.archiva.repository.RepositoryException; -import org.apache.maven.archiva.repository.RepositoryNotFoundException; -import org.apache.maven.archiva.repository.layout.LayoutException; -import org.apache.maven.archiva.security.ArchivaSecurityException; -import org.apache.maven.archiva.security.ArchivaXworkUser; -import org.apache.maven.archiva.security.UserRepositories; -import org.apache.struts2.StrutsException; -import org.apache.struts2.components.Component; -import org.codehaus.plexus.component.repository.exception.ComponentLookupException; - -public class DownloadArtifact - extends Component -{ - private static final String DEFAULT_DOWNLOAD_IMAGE = "download-type-other.png"; - - private RepositoryContentFactory repositoryFactory; - - private MetadataResolver metadataResolver; - - private HttpServletRequest req; - - private String groupId; - - private String artifactId; - - private String version; - - private boolean mini = false; - - private DecimalFormat decimalFormat; - - private static final Map DOWNLOAD_IMAGES = new HashMap(); - - private UserRepositories userRepositories; - - static - { - DOWNLOAD_IMAGES.put( "jar", "download-type-jar.png" ); - DOWNLOAD_IMAGES.put( "java-source", "download-type-jar.png" ); - DOWNLOAD_IMAGES.put( "pom", "download-type-pom.png" ); - DOWNLOAD_IMAGES.put( "maven-plugin", "download-type-maven-plugin.png" ); - DOWNLOAD_IMAGES.put( "maven-archetype", "download-type-archetype.png" ); - DOWNLOAD_IMAGES.put( "maven-skin", "download-type-skin.png" ); - } - - public DownloadArtifact( ValueStack stack, PageContext pageContext ) - { - super( stack ); - decimalFormat = new DecimalFormat( "#,#00" ); - this.req = (HttpServletRequest) pageContext.getRequest(); - try - { - metadataResolver = (MetadataResolver) PlexusTagUtil.lookup( pageContext, MetadataResolver.class ); - repositoryFactory = - (RepositoryContentFactory) PlexusTagUtil.lookup( pageContext, RepositoryContentFactory.class ); - userRepositories = (UserRepositories) PlexusTagUtil.lookup( pageContext, UserRepositories.class ); - } - catch ( ComponentLookupException e ) - { - throw new RuntimeException( e.getMessage(), e ); - } - } - - @Override - public boolean end( Writer writer, String body ) - { - StringBuffer sb = new StringBuffer(); - - try - { - List artifacts = new ArrayList(); - for ( String repoId : getObservableRepos() ) - { - artifacts.addAll( metadataResolver.getArtifacts( repoId, groupId, artifactId, version ) ); - } - - if ( !artifacts.isEmpty() ) - { - String prefix = req.getContextPath() + "/repository/"; - - if ( mini ) - { - // TODO: write 1 line download link for main artifact. - } - else - { - appendNormal( sb, prefix, artifacts ); - } - } - } - catch ( RepositoryNotFoundException e ) - { - // TODO Auto-generated catch block - e.printStackTrace(); - } - catch ( RepositoryException e ) - { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - try - { - writer.write( sb.toString() ); - } - catch ( IOException e ) - { - throw new StrutsException( "IOError: " + e.getMessage(), e ); - } - - return super.end( writer, body ); - } - - private void appendNormal( StringBuffer sb, String prefix, List relatedArtifacts ) - throws RepositoryException - { - /* - *
- *
- *
- *
- *
- *
- * <-- main content goes here --> - *
- *
- *
- *
- *
- *
- */ - - sb.append( "
" ); - sb.append( "
" ); - sb.append( "
" ); - - // Heading - sb.append( "

" ); - if ( relatedArtifacts.size() > 1 ) - { - sb.append( "Downloads" ); - } - else - { - sb.append( "Download" ); - } - sb.append( "

" ); - - // Body - sb.append( "

" ); - - sb.append( "" ); - for ( ArtifactMetadata artifact : relatedArtifacts ) - { - String repoId = artifact.getRepositoryId(); - ManagedRepositoryContent repo = repositoryFactory.getManagedRepositoryContent( repoId ); - - sb.append( "\n" ); - - sb.append( "" ); - - sb.append( "" ); - - sb.append( "" ); - - sb.append( "" ); - } - sb.append( "
" ); - appendImageLink( sb, prefix + repoId, repo, artifact ); - sb.append( "" ); - appendLink( sb, prefix + repoId, repo, artifact ); - sb.append( "" ); - appendFilesize( sb, artifact ); - sb.append( "
" ); - sb.append( "

" ); - - sb.append( "
" ); // close "downloadbox.bd.c" - sb.append( "
" ); // close "downloadbox.bd" - - sb.append( "
" ); - sb.append( "
" ); // close "download" - } - - private void appendImageLink( StringBuffer sb, String prefix, ManagedRepositoryContent repo, - ArtifactMetadata artifact ) - { - String path = getPath( repo, artifact ); - String type = getType( repo, path ); - String linkText = ""; - appendLink( sb, prefix, artifact, linkText, path ); - } - - private String getType( ManagedRepositoryContent repo, String path ) - { - String type = null; - try - { - type = repo.toArtifactReference( path ).getType(); - } - catch ( LayoutException e ) - { - e.printStackTrace(); //TODO - } - return type; - } - - private String getDownloadImage( String type ) - { - String name = DOWNLOAD_IMAGES.get( type ); - return name != null ? name : DEFAULT_DOWNLOAD_IMAGE; - } - - private static void appendLink( StringBuffer sb, String prefix, ArtifactMetadata artifact, String linkText, - String path ) - { - - StringBuffer url = new StringBuffer(); - url.append( prefix ); - url.append( "/" ).append( path ); - - sb.append( "" ); - - sb.append( linkText ); - - sb.append( "" ); - } - - private static String getPath( ManagedRepositoryContent repo, ArtifactMetadata artifact ) - { - // TODO: use metadata resolver capability instead - ArtifactReference ref = new ArtifactReference(); - ref.setArtifactId( artifact.getProject() ); - ref.setGroupId( artifact.getNamespace() ); - ref.setVersion( artifact.getVersion() ); - String path = repo.toPath( ref ); - path = path.substring( 0, path.lastIndexOf( "/" ) + 1 ) + artifact.getId(); - return path; - } - - private void appendLink( StringBuffer sb, String prefix, ManagedRepositoryContent repo, ArtifactMetadata artifact ) - { - String path = getPath( repo, artifact ); - String type = getType( repo, path ); - String linkText = StringUtils.capitalize( type ); - - appendLink( sb, prefix, artifact, linkText, path ); - } - - private void appendFilesize( StringBuffer sb, ArtifactMetadata artifact ) - { - sb.append( decimalFormat.format( artifact.getSize() ) ); - } - - public void setArtifactId( String artifactId ) - { - this.artifactId = artifactId; - } - - public void setGroupId( String groupId ) - { - this.groupId = groupId; - } - - public void setMini( boolean mini ) - { - this.mini = mini; - } - - public void setVersion( String version ) - { - this.version = version; - } - - public Collection getObservableRepos() - { - try - { - ActionContext context = ActionContext.getContext(); - Map session = context.getSession(); - return userRepositories.getObservableRepositoryIds( ArchivaXworkUser.getActivePrincipal( session ) ); - } - catch ( ArchivaSecurityException e ) - { - e.printStackTrace(); //TODO - return Collections.emptyList(); - } - } -} diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/DownloadArtifactTag.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/DownloadArtifactTag.java deleted file mode 100644 index 8681fa6ba..000000000 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/DownloadArtifactTag.java +++ /dev/null @@ -1,103 +0,0 @@ -package org.apache.maven.archiva.web.tags; - -/* - * 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 javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.jsp.JspException; - -import org.apache.struts2.components.Component; -import org.apache.struts2.views.jsp.ComponentTagSupport; - -import com.opensymphony.xwork2.util.ValueStack; - -/** - * DownloadArtifactTag - * - * @version $Id$ - */ -public class DownloadArtifactTag - extends ComponentTagSupport -{ - private String groupId_; // stores EL-based groupId property - - private String groupId; // stores the evaluated groupId object. - - private String artifactId_; // stores EL-based artifactId property - - private String artifactId; // stores the evaluated artifactId object. - - private String version_; // stores EL-based version property - - private String version; // stores the evaluated version object. - - private String mini_; // stores EL-based mini property - - private boolean mini; // stores the evaluated mini object. - - @Override - public Component getBean(ValueStack valueStack, HttpServletRequest request, HttpServletResponse response) { - return new DownloadArtifact(valueStack, pageContext); - } - - @Override - public int doEndTag() - throws JspException - { - evaluateExpressions(); - - DownloadArtifact download = (DownloadArtifact)component; - download.setGroupId( groupId ); - download.setArtifactId( artifactId ); - download.setVersion( version ); - download.setMini( mini ); - - return super.doEndTag(); - } - - private void evaluateExpressions() - throws JspException - { - ExpressionTool exprTool = new ExpressionTool( pageContext, this, "download" ); - - // Handle required properties. - groupId = exprTool.requiredString( "groupId", groupId_ ); - artifactId = exprTool.requiredString( "artifactId", artifactId_ ); - version = exprTool.requiredString( "version", version_ ); - - // Handle optional properties - mini = exprTool.optionalBoolean( "mini", mini_, false ); - } - - public void setArtifactId( String artifactId ) - { - this.artifactId_ = artifactId; - } - - public void setGroupId( String groupId ) - { - this.groupId_ = groupId; - } - - public void setVersion( String version ) - { - this.version_ = version; - } -} diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/resources/struts.xml b/archiva-modules/archiva-web/archiva-webapp/src/main/resources/struts.xml index 3c9a6b5fd..2f21561c6 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/resources/struts.xml +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/resources/struts.xml @@ -215,7 +215,7 @@ - /WEB-INF/jsp/artifact/dependencyTree.jsp + /WEB-INF/jsp/showArtifact.jsp diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/decorators.xml b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/decorators.xml index 638f2c53a..acb6a423a 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/decorators.xml +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/decorators.xml @@ -27,8 +27,4 @@ /* - - - /*/dependencyTree - \ No newline at end of file diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/artifact/dependencyTree.jsp b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/artifact/dependencyTree.jsp deleted file mode 100644 index 6622c3484..000000000 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/artifact/dependencyTree.jsp +++ /dev/null @@ -1,28 +0,0 @@ -<%-- - ~ 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. - --%> - -<%@ taglib prefix="page" uri="http://www.opensymphony.com/sitemesh/page" %> -<%@ taglib prefix="my" tagdir="/WEB-INF/tags" %> -<%@ taglib prefix="archiva" uri="/WEB-INF/taglib.tld" %> - - - - diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/decorators/artifactDecorator.jsp b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/decorators/artifactDecorator.jsp deleted file mode 100644 index 14ef4d9c8..000000000 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/decorators/artifactDecorator.jsp +++ /dev/null @@ -1,150 +0,0 @@ -<%-- - ~ 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. - --%> - -<%@ taglib prefix="decorator" uri="http://www.opensymphony.com/sitemesh/decorator" %> -<%@ taglib prefix="page" uri="http://www.opensymphony.com/sitemesh/page" %> -<%@ taglib prefix="s" uri="/struts-tags" %> -<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -<%@ taglib prefix="redback" uri="http://plexus.codehaus.org/redback/taglib-1.0" %> -<%@ taglib prefix="my" tagdir="/WEB-INF/tags" %> -<%@ taglib prefix="archiva" uri="/WEB-INF/taglib.tld" %> - - - - - - Browse Repository - - - - - - - - - - - Maven Plugin - - - - POM - - <%-- These types aren't usually set in the POM yet, so we fudge them for the well known ones --%> - - - Maven Archetype - - - - Maven Skin - - <%-- Must be last so that the above get picked up if possible --%> - - - JAR - - - - - - -${packageName} - -

- - - ${facet.artifactId} - - - ${model.name} - - -

- -
-
- - - - - - - - - Info - - - - - - - - Dependencies - - - - - - - - Dependency Tree - - - - - - - - Used By - - - - - - - - Mailing Lists - <%-- POSTPONED to 1.0-alpha-2 - - - - - - - - - Reports - - --%> - - -
- -
- -
- - -
- - - - -
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/include/artifactInfo.jspf b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/include/artifactInfo.jspf index 71c6220b9..206aa8a58 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/include/artifactInfo.jspf +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/include/artifactInfo.jspf @@ -91,23 +91,6 @@ - - - Other Versions - - - - - - - - - - ${snapshot} - - - - <%-- TODO: deployment timestamp Deployment Date diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/include/dependencyTree.jspf b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/include/dependencyTree.jspf index 45d8ea2f7..2e908cada 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/include/dependencyTree.jspf +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/include/dependencyTree.jspf @@ -17,15 +17,11 @@ ~ under the License. --%> -<%@ taglib prefix="s" uri="/struts-tags" %> -<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%@ taglib prefix="my" tagdir="/WEB-INF/tags" %> -<%@ taglib prefix="archiva" uri="/WEB-INF/taglib.tld" %> +<%@ taglib prefix="archiva" uri="/WEB-INF/taglib.tld" %> - - - <%-- - - --%> - \ No newline at end of file + + + diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/showArtifact.jsp b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/showArtifact.jsp index adf05e933..37df9fb6a 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/showArtifact.jsp +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/showArtifact.jsp @@ -27,6 +27,14 @@ Browse Repository + + + + @@ -134,8 +142,64 @@ -
- +
+

Download

+ +
+ +

${v}

+
+ + + + + + + Maven Plugin + + + + POM + + <%-- These types aren't usually set in the POM yet, so we fudge them for the well known ones --%> + + + Maven Archetype + + + + Maven Skin + + + + Java Sources + + + + JavaDoc Archive + + <%-- Must be last so that the above get picked up if possible --%> + + + JAR + + + + ${a.type} + + + + + + + + + + +
${packageName}${a.size}
+
+
+
<%-- TODO: perhaps using ajax? --%> @@ -145,7 +209,7 @@ <%@ include file="/WEB-INF/jsp/include/artifactDependencies.jspf" %> - + <%@ include file="/WEB-INF/jsp/include/dependencyTree.jspf" %> diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/taglib.tld b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/taglib.tld index 3208908d6..5f0a5ed1c 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/taglib.tld +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/taglib.tld @@ -37,47 +37,6 @@ - - - downloadArtifact - org.apache.maven.archiva.web.tags.DownloadArtifactTag - empty - - - - groupId - true - true - - - - - - artifactId - true - true - - - - - - version - true - true - - - - - - mini - false - true - - - - - - copy-paste-snippet diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/css/site.css b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/css/site.css index a68b439a2..f9c47eb88 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/css/site.css +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/css/site.css @@ -16,119 +16,22 @@ * specific language governing permissions and limitations * under the License. */ -.sidebar3 { - width: 10em; - float: right; - text-align: center; -} - -#sidebarb { - font-size: small; - text-align: center; - padding: 10px 10px 10px 10px; - border: 1px #DFDEDE solid; - width: 10em; -} - -#sidebar { - float: right; - font-size: small; - margin: 10px; - padding: 10px; - border: 1px #DFDEDE solid; - width: 10em; -} - -.download { - float: right; - font-size: small; - font-weight: bold; - margin: 15px auto 0px auto; - height: auto; - width: 150px; - min-width: 120px; - display: block; -} - -.download .hd .c, -.download .ft .c { - font-size: 1px; /* ensure minimum height */ - height: 10px; -} - -.download .ft .c { - height: 10px; -} - -.download .hd { - background: transparent url(../images/download.tl.gif) no-repeat 0px 0px; -} - -.download .hd .c { - background: transparent url(../images/download.tr.gif) no-repeat right 0px; -} - -.download .bd { - background: transparent url(../images/download.ml.gif) repeat-y 0px 0px; -} -.download .bd .c { - background: transparent url(../images/download.mr.gif) repeat-y right 0px; +#download { + float: right; } -.download .bd .c .s { - margin: 0px 8px 0px 4px; - background: #000 url(../images/download.ms.jpg) repeat-x 0px 0px; - padding: 1em; -} - -.download .ft { - background: transparent url(../images/download.bl.gif) no-repeat 0px 0px; -} - -.download .ft .c { - background: transparent url(../images/download.br.gif) no-repeat right 0px; -} - -.download .bd h2 { - margin: 0px; - text-align: center; - border-bottom-width: 0px !important; -} - -.download .bd p { - margin: 0px; - border: 0px; - text-align: left; - padding-left: 0px; -} - -.download a { +#download a { text-decoration: none; } -.download p.body { - font-weight: bold; -} - -.download table { - margin-left: 2px; - width: 140px; -} - -.download .icon { - width: 16px; +#download td.type { + padding-right: 1em; + white-space: nowrap; } -.download .type { - font-size: 0.9em; - text-align: center; -} - -.download .size { - font-weight: normal; - font-size: 0.8em; - text-align: right; +#download td.size { + text-align: right; } #contentArea { diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/metadata/repository/memory/TestMetadataResolver.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/metadata/repository/memory/TestMetadataResolver.java index 89698f990..71bd1fa98 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/metadata/repository/memory/TestMetadataResolver.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/metadata/repository/memory/TestMetadataResolver.java @@ -38,7 +38,7 @@ public class TestMetadataResolver { private Map projectVersions = new HashMap(); - private Map> artifactVersions = new HashMap>(); + private Map> artifacts = new HashMap>(); private Map> references = new HashMap>(); @@ -66,8 +66,7 @@ public class TestMetadataResolver public Collection getArtifactVersions( String repoId, String namespace, String projectId, String projectVersion ) { - List versions = artifactVersions.get( createMapKey( repoId, namespace, projectId, projectVersion ) ); - return ( versions != null ? versions : Collections.emptyList() ); + throw new UnsupportedOperationException(); } public Collection getProjectReferences( String repoId, String namespace, String projectId, @@ -123,7 +122,9 @@ public class TestMetadataResolver public Collection getArtifacts( String repoId, String namespace, String projectId, String projectVersion ) { - return null; //To change body of implemented methods use File | Settings | File Templates. + List artifacts = + this.artifacts.get( createMapKey( repoId, namespace, projectId, projectVersion ) ); + return ( artifacts != null ? artifacts : Collections.emptyList() ); } public void setProjectVersion( String repoId, String namespace, String projectId, @@ -149,10 +150,10 @@ public class TestMetadataResolver versions.add( versionMetadata.getId() ); } - public void setArtifactVersions( String repoId, String namespace, String projectId, String projectVersion, - List versions ) + public void setArtifacts( String repoId, String namespace, String projectId, String projectVersion, + List artifacts ) { - artifactVersions.put( createMapKey( repoId, namespace, projectId, projectVersion ), versions ); + this.artifacts.put( createMapKey( repoId, namespace, projectId, projectVersion ), artifacts ); } private String createMapKey( String repoId, String namespace, String projectId, String projectVersion ) diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/ShowArtifactActionTest.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/ShowArtifactActionTest.java index 84beb7508..196d7bb3e 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/ShowArtifactActionTest.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/ShowArtifactActionTest.java @@ -22,13 +22,21 @@ package org.apache.maven.archiva.web.action; import java.util.Arrays; import java.util.Collections; import java.util.List; +import java.util.Map; import com.opensymphony.xwork2.Action; +import org.apache.archiva.metadata.model.ArtifactMetadata; import org.apache.archiva.metadata.model.Dependency; import org.apache.archiva.metadata.model.MailingList; import org.apache.archiva.metadata.model.ProjectVersionMetadata; import org.apache.archiva.metadata.model.ProjectVersionReference; import org.apache.archiva.metadata.repository.memory.TestMetadataResolver; +import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration; +import org.apache.maven.archiva.repository.ManagedRepositoryContent; +import org.apache.maven.archiva.repository.RepositoryContentFactory; +import org.apache.maven.archiva.repository.content.ManagedDefaultRepositoryContent; +import org.easymock.MockControl; +import org.easymock.classextension.MockClassControl; public class ShowArtifactActionTest extends AbstractActionTestCase @@ -41,13 +49,18 @@ public class ShowArtifactActionTest private static final String TEST_TS_SNAPSHOT_VERSION = "1.0-20091120.111111-1"; - private static final List ALL_TEST_SNAPSHOT_VERSIONS = - Arrays.asList( TEST_TS_SNAPSHOT_VERSION, "1.0-20091120.222222-2", "1.0-20091123.333333-3" ); - private static final String OTHER_TEST_REPO = "first-repo"; private ShowArtifactAction action; + private static final List TEST_SNAPSHOT_ARTIFACTS = + Arrays.asList( createArtifact( TEST_TS_SNAPSHOT_VERSION ), createArtifact( "1.0-20091120.222222-2" ), + createArtifact( "1.0-20091123.333333-3" ) ); + + private static final long TEST_SIZE = 12345L; + + private static final String TEST_TYPE = "jar"; + public void testInstantiation() { assertFalse( action == lookup( Action.class, ACTION_HINT ) ); @@ -73,15 +86,15 @@ public class ShowArtifactActionTest assertNull( action.getDependees() ); assertNull( action.getDependencies() ); assertNull( action.getMailingLists() ); - assertTrue( action.getSnapshotVersions().isEmpty() ); + assertTrue( action.getArtifacts().isEmpty() ); } public void testGetArtifactUniqueSnapshot() { metadataResolver.setProjectVersion( TEST_REPO, TEST_GROUP_ID, TEST_ARTIFACT_ID, createProjectModel( TEST_SNAPSHOT_VERSION ) ); - metadataResolver.setArtifactVersions( TEST_REPO, TEST_GROUP_ID, TEST_ARTIFACT_ID, TEST_SNAPSHOT_VERSION, - ALL_TEST_SNAPSHOT_VERSIONS ); + metadataResolver.setArtifacts( TEST_REPO, TEST_GROUP_ID, TEST_ARTIFACT_ID, TEST_SNAPSHOT_VERSION, + TEST_SNAPSHOT_ARTIFACTS ); action.setGroupId( TEST_GROUP_ID ); action.setArtifactId( TEST_ARTIFACT_ID ); @@ -99,7 +112,7 @@ public class ShowArtifactActionTest assertEquals( TEST_REPO, action.getRepositoryId() ); - assertEquals( ALL_TEST_SNAPSHOT_VERSIONS, action.getSnapshotVersions() ); + assertArtifacts( TEST_SNAPSHOT_ARTIFACTS, action.getArtifacts() ); assertNull( action.getDependees() ); assertNull( action.getDependencies() ); @@ -109,32 +122,17 @@ public class ShowArtifactActionTest public void testGetArtifactUniqueSnapshotTimestamped() { metadataResolver.setProjectVersion( TEST_REPO, TEST_GROUP_ID, TEST_ARTIFACT_ID, - createProjectModel( TEST_TS_SNAPSHOT_VERSION ) ); - metadataResolver.setArtifactVersions( TEST_REPO, TEST_GROUP_ID, TEST_ARTIFACT_ID, TEST_TS_SNAPSHOT_VERSION, - ALL_TEST_SNAPSHOT_VERSIONS ); + createProjectModel( TEST_SNAPSHOT_VERSION ) ); + metadataResolver.setArtifacts( TEST_REPO, TEST_GROUP_ID, TEST_ARTIFACT_ID, TEST_SNAPSHOT_VERSION, + TEST_SNAPSHOT_ARTIFACTS ); action.setGroupId( TEST_GROUP_ID ); action.setArtifactId( TEST_ARTIFACT_ID ); action.setVersion( TEST_TS_SNAPSHOT_VERSION ); String result = action.artifact(); - - assertActionSuccess( action, result ); - - assertEquals( TEST_GROUP_ID, action.getGroupId() ); - assertEquals( TEST_ARTIFACT_ID, action.getArtifactId() ); - assertEquals( TEST_TS_SNAPSHOT_VERSION, action.getVersion() ); - ProjectVersionMetadata model = action.getModel(); - assertDefaultModel( model, TEST_TS_SNAPSHOT_VERSION ); - - assertEquals( TEST_REPO, action.getRepositoryId() ); - - assertEquals( Arrays.asList( ALL_TEST_SNAPSHOT_VERSIONS.get( 1 ), ALL_TEST_SNAPSHOT_VERSIONS.get( 2 ) ), - action.getSnapshotVersions() ); - - assertNull( action.getDependees() ); - assertNull( action.getDependencies() ); - assertNull( action.getMailingLists() ); + assertError( result ); + assertNoOutputFields(); } public void testGetMissingProject() @@ -197,7 +195,7 @@ public class ShowArtifactActionTest assertNull( action.getDependees() ); assertNull( action.getDependencies() ); assertNull( action.getMailingLists() ); - assertTrue( action.getSnapshotVersions().isEmpty() ); + assertTrue( action.getArtifacts().isEmpty() ); } public void testGetArtifactSeenInBothObservableRepo() @@ -223,7 +221,7 @@ public class ShowArtifactActionTest assertNull( action.getDependees() ); assertNull( action.getDependencies() ); assertNull( action.getMailingLists() ); - assertTrue( action.getSnapshotVersions().isEmpty() ); + assertTrue( action.getArtifacts().isEmpty() ); } public void testGetArtifactCanOnlyObserveInOneOfTwoRepos() @@ -249,7 +247,7 @@ public class ShowArtifactActionTest assertNull( action.getDependees() ); assertNull( action.getDependencies() ); assertNull( action.getMailingLists() ); - assertTrue( action.getSnapshotVersions().isEmpty() ); + assertTrue( action.getArtifacts().isEmpty() ); } public void testGetArtifactNoMavenFacet() @@ -280,7 +278,7 @@ public class ShowArtifactActionTest assertNull( action.getDependees() ); assertNull( action.getDependencies() ); assertNull( action.getMailingLists() ); - assertTrue( action.getSnapshotVersions().isEmpty() ); + assertTrue( action.getArtifacts().isEmpty() ); } public void testGetMailingLists() @@ -305,10 +303,10 @@ public class ShowArtifactActionTest assertMailingList( action.getMailingLists().get( 0 ), "Users List", "users" ); assertMailingList( action.getMailingLists().get( 1 ), "Developers List", "dev" ); - assertNull( action.getRepositoryId() ); + assertEquals( TEST_REPO, action.getRepositoryId() ); assertNull( action.getDependees() ); assertNull( action.getDependencies() ); - assertNull( action.getSnapshotVersions() ); + assertTrue( action.getArtifacts().isEmpty() ); } public void testGetDependencies() @@ -333,10 +331,10 @@ public class ShowArtifactActionTest assertDependencyBasic( action.getDependencies().get( 0 ), "artifactId1" ); assertDependencyExtended( action.getDependencies().get( 1 ), "artifactId2" ); - assertNull( action.getRepositoryId() ); + assertEquals( TEST_REPO, action.getRepositoryId() ); assertNull( action.getDependees() ); assertNull( action.getMailingLists() ); - assertNull( action.getSnapshotVersions() ); + assertTrue( action.getArtifacts().isEmpty() ); } public void testGetDependees() @@ -362,10 +360,45 @@ public class ShowArtifactActionTest assertCoordinate( action.getDependees().get( 0 ), "artifactId1" ); assertCoordinate( action.getDependees().get( 1 ), "artifactId2" ); - assertNull( action.getRepositoryId() ); + assertEquals( TEST_REPO, action.getRepositoryId() ); assertNull( action.getDependencies() ); assertNull( action.getMailingLists() ); - assertNull( action.getSnapshotVersions() ); + assertTrue( action.getArtifacts().isEmpty() ); + } + + private void assertArtifacts( List expectedArtifacts, + Map> artifactMap ) + { + // assuming only one of each version at this point + assertEquals( expectedArtifacts.size(), artifactMap.size() ); + for ( ArtifactMetadata artifact : expectedArtifacts ) + { + assertTrue( artifactMap.containsKey( artifact.getVersion() ) ); + List list = artifactMap.get( artifact.getVersion() ); + ShowArtifactAction.ArtifactDownloadInfo actual = list.get( 0 ); + assertEquals( artifact.getNamespace(), actual.getNamespace() ); + assertEquals( artifact.getId(), actual.getId() ); + assertEquals( artifact.getProject(), actual.getProject() ); + assertEquals( artifact.getRepositoryId(), actual.getRepositoryId() ); + assertEquals( artifact.getSize(), actual.getSize() ); + assertEquals( artifact.getVersion(), actual.getVersion() ); + assertEquals( TEST_TYPE, actual.getType() ); + assertEquals( TEST_SIZE, actual.getSize() ); + assertEquals( artifact.getNamespace() + "/" + artifact.getProject() + "/" + TEST_SNAPSHOT_VERSION + "/" + + artifact.getId(), actual.getPath() ); + } + } + + private static ArtifactMetadata createArtifact( String version ) + { + ArtifactMetadata metadata = new ArtifactMetadata(); + metadata.setProject( TEST_ARTIFACT_ID ); + metadata.setId( TEST_ARTIFACT_ID + "-" + version + ".jar" ); + metadata.setNamespace( TEST_GROUP_ID ); + metadata.setRepositoryId( TEST_REPO ); + metadata.setSize( TEST_SIZE ); + metadata.setVersion( version ); + return metadata; } private ProjectVersionReference createReference( String projectId ) @@ -452,7 +485,7 @@ public class ShowArtifactActionTest assertNull( action.getDependees() ); assertNull( action.getDependencies() ); assertNull( action.getMailingLists() ); - assertTrue( action.getSnapshotVersions().isEmpty() ); + assertTrue( action.getArtifacts().isEmpty() ); } private void assertError( String result ) @@ -493,5 +526,17 @@ public class ShowArtifactActionTest super.setUp(); action = (ShowArtifactAction) lookup( Action.class, ACTION_HINT ); metadataResolver = (TestMetadataResolver) action.getMetadataResolver(); + MockControl control = MockClassControl.createControl( RepositoryContentFactory.class ); + RepositoryContentFactory factory = (RepositoryContentFactory) control.getMock(); + action.setRepositoryFactory( factory ); + + ManagedRepositoryConfiguration config = new ManagedRepositoryConfiguration(); + config.setId( TEST_REPO ); + config.setLocation( getTestFile( "target/test-repo" ).getAbsolutePath() ); + ManagedRepositoryContent content = new ManagedDefaultRepositoryContent(); + content.setRepository( config ); + factory.getManagedRepositoryContent( TEST_REPO ); + control.setDefaultReturnValue( content ); + control.replay(); } } -- 2.39.5