import org.apache.archiva.metadata.repository.storage.maven2.MavenProjectFacet;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
-import org.apache.maven.archiva.database.browsing.BrowsingResults;
-import org.apache.maven.archiva.model.ArchivaProjectModel;
-import org.apache.maven.archiva.model.CiManagement;
-import org.apache.maven.archiva.model.Dependency;
-import org.apache.maven.archiva.model.IssueManagement;
-import org.apache.maven.archiva.model.License;
-import org.apache.maven.archiva.model.MailingList;
-import org.apache.maven.archiva.model.Organization;
-import org.apache.maven.archiva.model.Scm;
-import org.apache.maven.archiva.model.VersionedReference;
import org.apache.maven.archiva.security.AccessDeniedException;
import org.apache.maven.archiva.security.ArchivaSecurityException;
import org.apache.maven.archiva.security.PrincipalNotFoundException;
*/
private UserRepositories userRepositories;
- // TODO: eventually, move to just use the metadata directly, with minimal JSP changes
- private BrowsingResults results;
-
private String groupId;
private String artifactId;
private String repositoryId;
- // TODO: eventually, move to just use the metadata directly, with minimal JSP changes, mostly for Maven specifics
- private ArchivaProjectModel sharedModel;
+ private ProjectVersionMetadata sharedModel;
+
+ private Collection<String> namespaces;
+
+ private Collection<String> projectIds;
+
+ private Collection<String> projectVersions;
public String browse()
{
}
}
- this.results = new BrowsingResults();
- results.setGroupIds( getSortedList( namespaces ) );
- results.setSelectedRepositoryIds( selectedRepos );
+ this.namespaces = getSortedList( namespaces );
return SUCCESS;
}
projects.addAll( metadataResolver.getProjects( repoId, groupId ) );
}
- this.results = new BrowsingResults( groupId );
- results.setGroupIds( getSortedList( namespaces ) );
- results.setArtifacts( getSortedList( projects ) );
- results.setSelectedRepositoryIds( selectedRepos );
+ this.namespaces = getSortedList( namespaces );
+ this.projectIds = getSortedList( projects );
return SUCCESS;
}
versions.addAll( metadataResolver.getProjectVersions( repoId, groupId, artifactId ) );
}
- this.results = new BrowsingResults( groupId, artifactId );
// TODO: sort by known version ordering method
- results.setVersions( new ArrayList<String>( versions ) );
- results.setSelectedRepositoryIds( selectedRepos );
+ this.projectVersions = new ArrayList<String>( versions );
- populateSharedModel( selectedRepos );
+ populateSharedModel( selectedRepos, versions );
return SUCCESS;
}
- private void populateSharedModel( Collection<String> selectedRepos )
+ private void populateSharedModel( Collection<String> selectedRepos, Collection<String> projectVersions )
throws MetadataResolverException
{
- sharedModel = new ArchivaProjectModel();
- sharedModel.setGroupId( groupId );
- sharedModel.setArtifactId( artifactId );
+ sharedModel = new ProjectVersionMetadata();
+
+ MavenProjectFacet mavenFacet = new MavenProjectFacet();
+ mavenFacet.setGroupId( groupId );
+ mavenFacet.setArtifactId( artifactId );
+ sharedModel.addFacet( mavenFacet );
+
boolean isFirstVersion = true;
- for ( String version : this.results.getVersions() )
+ for ( String version : projectVersions )
{
ProjectVersionMetadata versionMetadata = null;
for ( String repoId : selectedRepos )
continue;
}
- ArchivaProjectModel model = populateLegacyModel( versionMetadata );
-
if ( isFirstVersion )
{
- sharedModel = model;
- sharedModel.setVersion( null );
+ sharedModel = versionMetadata;
+ sharedModel.setId( null );
}
else
{
- if ( sharedModel.getPackaging() != null &&
- !StringUtils.equalsIgnoreCase( sharedModel.getPackaging(), model.getPackaging() ) )
+ MavenProjectFacet versionMetadataMavenFacet =
+ (MavenProjectFacet) versionMetadata.getFacet( MavenProjectFacet.FACET_ID );
+ if ( versionMetadataMavenFacet != null )
{
- sharedModel.setPackaging( null );
+ if ( mavenFacet.getPackaging() != null && !StringUtils.equalsIgnoreCase( mavenFacet.getPackaging(),
+ versionMetadataMavenFacet.getPackaging() ) )
+ {
+ mavenFacet.setPackaging( null );
+ }
}
if ( sharedModel.getName() != null &&
- !StringUtils.equalsIgnoreCase( sharedModel.getName(), model.getName() ) )
+ !StringUtils.equalsIgnoreCase( sharedModel.getName(), versionMetadata.getName() ) )
{
sharedModel.setName( "" );
}
if ( sharedModel.getDescription() != null &&
- !StringUtils.equalsIgnoreCase( sharedModel.getDescription(), model.getDescription() ) )
+ !StringUtils.equalsIgnoreCase( sharedModel.getDescription(), versionMetadata.getDescription() ) )
{
sharedModel.setDescription( null );
}
- if ( sharedModel.getIssueManagement() != null && model.getIssueManagement() != null &&
- !StringUtils.equalsIgnoreCase( sharedModel.getIssueManagement().getIssueManagementUrl(),
- model.getIssueManagement().getIssueManagementUrl() ) )
+ if ( sharedModel.getIssueManagement() != null && versionMetadata.getIssueManagement() != null &&
+ !StringUtils.equalsIgnoreCase( sharedModel.getIssueManagement().getUrl(),
+ versionMetadata.getIssueManagement().getUrl() ) )
{
sharedModel.setIssueManagement( null );
}
- if ( sharedModel.getCiManagement() != null && model.getCiManagement() != null &&
- !StringUtils.equalsIgnoreCase( sharedModel.getCiManagement().getCiUrl(),
- model.getCiManagement().getCiUrl() ) )
+ if ( sharedModel.getCiManagement() != null && versionMetadata.getCiManagement() != null &&
+ !StringUtils.equalsIgnoreCase( sharedModel.getCiManagement().getUrl(),
+ versionMetadata.getCiManagement().getUrl() ) )
{
sharedModel.setCiManagement( null );
}
- if ( sharedModel.getOrganization() != null && model.getOrganization() != null &&
- !StringUtils.equalsIgnoreCase( sharedModel.getOrganization().getOrganizationName(),
- model.getOrganization().getOrganizationName() ) )
+ if ( sharedModel.getOrganization() != null && versionMetadata.getOrganization() != null &&
+ !StringUtils.equalsIgnoreCase( sharedModel.getOrganization().getName(),
+ versionMetadata.getOrganization().getName() ) )
{
sharedModel.setOrganization( null );
}
if ( sharedModel.getUrl() != null &&
- !StringUtils.equalsIgnoreCase( sharedModel.getUrl(), model.getUrl() ) )
+ !StringUtils.equalsIgnoreCase( sharedModel.getUrl(), versionMetadata.getUrl() ) )
{
sharedModel.setUrl( null );
}
}
}
- private ArchivaProjectModel populateLegacyModel( ProjectVersionMetadata versionMetadata )
- {
- // TODO: eventually, move to just use the metadata directly, with minimal JSP changes, mostly for Maven specifics
- ArchivaProjectModel model = new ArchivaProjectModel();
- MavenProjectFacet projectFacet = (MavenProjectFacet) versionMetadata.getFacet( MavenProjectFacet.FACET_ID );
- if ( projectFacet != null )
- {
- model.setGroupId( projectFacet.getGroupId() );
- model.setArtifactId( projectFacet.getArtifactId() );
- model.setPackaging( projectFacet.getPackaging() );
- if ( projectFacet.getParent() != null )
- {
- VersionedReference parent = new VersionedReference();
- parent.setGroupId( projectFacet.getParent().getGroupId() );
- parent.setArtifactId( projectFacet.getParent().getArtifactId() );
- parent.setVersion( projectFacet.getParent().getVersion() );
- model.setParentProject( parent );
- }
- }
-
- model.setVersion( versionMetadata.getId() );
- model.setDescription( versionMetadata.getDescription() );
- model.setName( versionMetadata.getName() );
- model.setUrl( versionMetadata.getUrl() );
- if ( versionMetadata.getOrganization() != null )
- {
- Organization organization = new Organization();
- organization.setName( versionMetadata.getOrganization().getName() );
- organization.setUrl( versionMetadata.getOrganization().getUrl() );
- model.setOrganization( organization );
- }
- if ( versionMetadata.getCiManagement() != null )
- {
- CiManagement ci = new CiManagement();
- ci.setSystem( versionMetadata.getCiManagement().getSystem() );
- ci.setUrl( versionMetadata.getCiManagement().getUrl() );
- model.setCiManagement( ci );
- }
- if ( versionMetadata.getIssueManagement() != null )
- {
- IssueManagement issueManagement = new IssueManagement();
- issueManagement.setSystem( versionMetadata.getIssueManagement().getSystem() );
- issueManagement.setUrl( versionMetadata.getIssueManagement().getUrl() );
- model.setIssueManagement( issueManagement );
- }
- if ( versionMetadata.getScm() != null )
- {
- Scm scm = new Scm();
- scm.setConnection( versionMetadata.getScm().getConnection() );
- scm.setDeveloperConnection( versionMetadata.getScm().getDeveloperConnection() );
- scm.setUrl( versionMetadata.getScm().getUrl() );
- model.setScm( scm );
- }
- if ( versionMetadata.getLicenses() != null )
- {
- for ( org.apache.archiva.metadata.model.License l : versionMetadata.getLicenses() )
- {
- License license = new License();
- license.setName( l.getName() );
- license.setUrl( l.getUrl() );
- model.addLicense( license );
- }
- }
- if ( versionMetadata.getMailingLists() != null )
- {
- for ( org.apache.archiva.metadata.model.MailingList l : versionMetadata.getMailingLists() )
- {
- MailingList mailingList = new MailingList();
- mailingList.setMainArchiveUrl( l.getMainArchiveUrl() );
- mailingList.setName( l.getName() );
- mailingList.setPostAddress( l.getPostAddress() );
- mailingList.setSubscribeAddress( l.getSubscribeAddress() );
- mailingList.setUnsubscribeAddress( l.getUnsubscribeAddress() );
- mailingList.setOtherArchives( l.getOtherArchives() );
- model.addMailingList( mailingList );
- }
- }
- if ( versionMetadata.getDependencies() != null )
- {
- for ( org.apache.archiva.metadata.model.Dependency d : versionMetadata.getDependencies() )
- {
- Dependency dependency = new Dependency();
- dependency.setScope( d.getScope() );
- dependency.setSystemPath( d.getSystemPath() );
- dependency.setType( d.getType() );
- dependency.setVersion( d.getVersion() );
- dependency.setArtifactId( d.getArtifactId() );
- dependency.setClassifier( d.getClassifier() );
- dependency.setGroupId( d.getGroupId() );
- dependency.setOptional( d.isOptional() );
- model.addDependency( dependency );
- }
- }
- return model;
- }
-
private List<String> getObservableRepos()
{
try
this.artifactId = artifactId;
}
- public BrowsingResults getResults()
+ public Collection<String> getNamespaces()
{
- return results;
+ return namespaces;
}
public String getRepositoryId()
this.repositoryId = repositoryId;
}
- public ArchivaProjectModel getSharedModel()
+ public ProjectVersionMetadata getSharedModel()
{
return sharedModel;
}
- public void setSharedModel( ArchivaProjectModel sharedModel )
+ public MetadataResolver getMetadataResolver()
+ {
+ return metadataResolver;
+ }
+
+ public Collection<String> getProjectIds()
{
- this.sharedModel = sharedModel;
+ return projectIds;
}
- public MetadataResolver getMetadataResolver()
+ public Collection<String> getProjectVersions()
{
- return metadataResolver;
+ return projectVersions;
}
}
import java.util.List;
import com.opensymphony.xwork2.Validateable;
+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.archiva.metadata.repository.MetadataResolverException;
-import org.apache.archiva.metadata.repository.storage.maven2.MavenProjectFacet;
import org.apache.commons.lang.StringUtils;
-import org.apache.maven.archiva.database.ArchivaDatabaseException;
-import org.apache.maven.archiva.database.ObjectNotFoundException;
-import org.apache.maven.archiva.model.ArchivaProjectModel;
-import org.apache.maven.archiva.model.CiManagement;
-import org.apache.maven.archiva.model.Dependency;
-import org.apache.maven.archiva.model.IssueManagement;
-import org.apache.maven.archiva.model.License;
-import org.apache.maven.archiva.model.MailingList;
-import org.apache.maven.archiva.model.Organization;
-import org.apache.maven.archiva.model.Scm;
-import org.apache.maven.archiva.model.VersionedReference;
import org.apache.maven.archiva.security.AccessDeniedException;
import org.apache.maven.archiva.security.ArchivaSecurityException;
import org.apache.maven.archiva.security.PrincipalNotFoundException;
/**
* The model of this versioned project.
*/
- private ArchivaProjectModel model;
+ private ProjectVersionMetadata model;
/**
* The list of artifacts that depend on this versioned project.
*/
- private List<ArchivaProjectModel> dependees;
+ private List<ProjectVersionReference> dependees;
private List<MailingList> mailingLists;
addActionError( "Artifact not found" );
return ERROR;
}
- model = populateLegacyModel( versionMetadata );
+ model = versionMetadata;
return SUCCESS;
}
- private ArchivaProjectModel populateLegacyModel( ProjectVersionMetadata versionMetadata )
- {
- // TODO: eventually, move to just use the metadata directly, with minimal JSP changes, mostly for Maven specifics
- ArchivaProjectModel model = new ArchivaProjectModel();
- MavenProjectFacet projectFacet = (MavenProjectFacet) versionMetadata.getFacet( MavenProjectFacet.FACET_ID );
- if ( projectFacet != null )
- {
- model.setGroupId( projectFacet.getGroupId() );
- model.setArtifactId( projectFacet.getArtifactId() );
- model.setPackaging( projectFacet.getPackaging() );
- if ( projectFacet.getParent() != null )
- {
- VersionedReference parent = new VersionedReference();
- parent.setGroupId( projectFacet.getParent().getGroupId() );
- parent.setArtifactId( projectFacet.getParent().getArtifactId() );
- parent.setVersion( projectFacet.getParent().getVersion() );
- model.setParentProject( parent );
- }
- }
-
- model.setVersion( versionMetadata.getId() );
- model.setDescription( versionMetadata.getDescription() );
- model.setName( versionMetadata.getName() );
- model.setUrl( versionMetadata.getUrl() );
- if ( versionMetadata.getOrganization() != null )
- {
- Organization organization = new Organization();
- organization.setName( versionMetadata.getOrganization().getName() );
- organization.setUrl( versionMetadata.getOrganization().getUrl() );
- model.setOrganization( organization );
- }
- if ( versionMetadata.getCiManagement() != null )
- {
- CiManagement ci = new CiManagement();
- ci.setSystem( versionMetadata.getCiManagement().getSystem() );
- ci.setUrl( versionMetadata.getCiManagement().getUrl() );
- model.setCiManagement( ci );
- }
- if ( versionMetadata.getIssueManagement() != null )
- {
- IssueManagement issueManagement = new IssueManagement();
- issueManagement.setSystem( versionMetadata.getIssueManagement().getSystem() );
- issueManagement.setUrl( versionMetadata.getIssueManagement().getUrl() );
- model.setIssueManagement( issueManagement );
- }
- if ( versionMetadata.getScm() != null )
- {
- Scm scm = new Scm();
- scm.setConnection( versionMetadata.getScm().getConnection() );
- scm.setDeveloperConnection( versionMetadata.getScm().getDeveloperConnection() );
- scm.setUrl( versionMetadata.getScm().getUrl() );
- model.setScm( scm );
- }
- if ( versionMetadata.getLicenses() != null )
- {
- for ( org.apache.archiva.metadata.model.License l : versionMetadata.getLicenses() )
- {
- License license = new License();
- license.setName( l.getName() );
- license.setUrl( l.getUrl() );
- model.addLicense( license );
- }
- }
- if ( versionMetadata.getMailingLists() != null )
- {
- for ( org.apache.archiva.metadata.model.MailingList l : versionMetadata.getMailingLists() )
- {
- MailingList mailingList = new MailingList();
- mailingList.setMainArchiveUrl( l.getMainArchiveUrl() );
- mailingList.setName( l.getName() );
- mailingList.setPostAddress( l.getPostAddress() );
- mailingList.setSubscribeAddress( l.getSubscribeAddress() );
- mailingList.setUnsubscribeAddress( l.getUnsubscribeAddress() );
- mailingList.setOtherArchives( l.getOtherArchives() );
- model.addMailingList( mailingList );
- }
- }
- if ( versionMetadata.getDependencies() != null )
- {
- for ( org.apache.archiva.metadata.model.Dependency d : versionMetadata.getDependencies() )
- {
- Dependency dependency = new Dependency();
- dependency.setScope( d.getScope() );
- dependency.setSystemPath( d.getSystemPath() );
- dependency.setType( d.getType() );
- dependency.setVersion( d.getVersion() );
- dependency.setArtifactId( d.getArtifactId() );
- dependency.setClassifier( d.getClassifier() );
- dependency.setGroupId( d.getGroupId() );
- dependency.setOptional( d.isOptional() );
- model.addDependency( dependency );
- }
- }
- return model;
- }
-
/**
* Show the artifact information tab.
*/
public String dependencies()
- throws ObjectNotFoundException, ArchivaDatabaseException
{
ProjectVersionMetadata versionMetadata = null;
for ( String repoId : getObservableRepos() )
addActionError( "Artifact not found" );
return ERROR;
}
- model = populateLegacyModel( versionMetadata );
+ model = versionMetadata;
this.dependencies = model.getDependencies();
* Show the mailing lists information tab.
*/
public String mailingLists()
- throws ObjectNotFoundException, ArchivaDatabaseException
{
ProjectVersionMetadata versionMetadata = null;
for ( String repoId : getObservableRepos() )
addActionError( "Artifact not found" );
return ERROR;
}
- model = populateLegacyModel( versionMetadata );
+ model = versionMetadata;
this.mailingLists = model.getMailingLists();
* Show the reports tab.
*/
public String reports()
- throws ObjectNotFoundException, ArchivaDatabaseException
{
// TODO: hook up reports on project - this.reports = artifactsDatabase.findArtifactResults( groupId, artifactId,
// version );
* Show the dependees (other artifacts that depend on this project) tab.
*/
public String dependees()
- throws ObjectNotFoundException, ArchivaDatabaseException
{
ProjectVersionMetadata versionMetadata = null;
for ( String repoId : getObservableRepos() )
addActionError( "Artifact not found" );
return ERROR;
}
- model = populateLegacyModel( versionMetadata );
+ model = versionMetadata;
List<ProjectVersionReference> references = new ArrayList<ProjectVersionReference>();
// TODO: what if we get duplicates across repositories?
references.addAll( metadataResolver.getProjectReferences( repoId, groupId, artifactId, version ) );
}
- this.dependees = new ArrayList<ArchivaProjectModel>();
- for ( ProjectVersionReference reference : references )
- {
- ArchivaProjectModel ref = new ArchivaProjectModel();
-
- ref.setGroupId( reference.getNamespace() );
- ref.setArtifactId( reference.getProjectId() );
- ref.setVersion( reference.getProjectVersion() );
-
- dependees.add( ref );
- }
+ this.dependees = references;
// 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)
* Show the dependencies of this versioned project tab.
*/
public String dependencyTree()
- throws ObjectNotFoundException, ArchivaDatabaseException
{
// temporarily use this as we only need the model for the tag to perform, but we should be resolving the
// graph here instead
}
}
- public ArchivaProjectModel getModel()
+ public ProjectVersionMetadata getModel()
{
return model;
}
return dependencies;
}
- public List<ArchivaProjectModel> getDependees()
+ public List<ProjectVersionReference> getDependees()
{
return dependees;
}
return snapshotVersions;
}
- public void setSnapshotVersions( List<String> snapshotVersions )
- {
- this.snapshotVersions = snapshotVersions;
- }
-
public MetadataResolver getMetadataResolver()
{
return metadataResolver;
<h1>Browse Repository</h1>
<div id="contentArea">
- <c:if test="${not empty results.selectedGroupId}">
+ <c:if test="${not empty groupId}">
<p>
- <archiva:groupIdLink var="${results.selectedGroupId}" includeTop="true" />
- <c:if test="${not empty results.selectedArtifactId}">
+ <archiva:groupIdLink var="${groupId}" includeTop="true" />
+ <c:if test="${not empty artifactId}">
<strong>${artifactId}</strong>
</c:if>
</p>
</c:if>
- <c:if test="${not empty results.groupIds}">
+ <c:if test="${not empty namespaces}">
<div id="nameColumn">
<h2>Groups</h2>
<ul>
- <c:forEach items="${results.groupIds}" var="groupId">
+ <c:forEach items="${namespaces}" var="groupId">
<c:set var="url">
<s:url action="browseGroup" namespace="/">
<s:param name="groupId" value="%{#attr.groupId}"/>
</div>
</c:if>
- <c:if test="${not empty results.artifacts}">
+ <c:if test="${not empty projectIds}">
<div id="nameColumn">
<h2>Artifacts</h2>
<ul>
<c:url var="rssFeedIconUrl" value="/images/icons/rss-feed.png"/>
- <c:forEach items="${results.artifacts}" var="artifactId">
+ <c:forEach items="${projectIds}" var="artifactId">
<c:set var="url">
<s:url action="browseArtifact" namespace="/">
- <s:param name="groupId" value="%{#attr.results.selectedGroupId}"/>
+ <s:param name="groupId" value="%{#attr.groupId}"/>
<s:param name="artifactId" value="%{#attr.artifactId}"/>
</s:url>
</c:set>
</div>
</c:if>
- <c:if test="${not empty results.versions}">
- <%-- show shared project information (MRM-1041) --%>
-
+ <c:if test="${not empty projectVersions}">
+ <%-- show shared project information (MRM-1041) TODO - share JSP code with artifactInfo.jspf --%>
+
+ <c:set var="mavenFacet" value="${sharedModel.facets['org.apache.archiva.metadata.repository.storage.maven2']}" />
<h2>Versions</h2>
<div id="nameColumn" class="versions">
<a class="expand" href="#">Artifact Info</a>
<table class="infoTable">
<tr>
<th>Group ID</th>
- <td>${sharedModel.groupId}</td>
+ <td>${mavenFacet.groupId}</td>
</tr>
<tr>
<th>Artifact ID</th>
- <td>${sharedModel.artifactId}</td>
+ <td>${mavenFacet.artifactId}</td>
</tr>
- <c:if test="${(sharedModel.packaging != null) && (!empty sharedModel.packaging)}">
+ <c:if test="${(mavenFacet.packaging != null) && (!empty mavenFacet.packaging)}">
<tr>
<th>Packaging</th>
- <td><code>${sharedModel.packaging}</code></td>
+ <td><code>${mavenFacet.packaging}</code></td>
</tr>
</c:if>
<c:if test="${(sharedModel.name != null) && (!empty sharedModel.name)}">
<td>
<c:choose>
<c:when test="${(sharedModel.organization.url != null) && (!empty sharedModel.organization.url)}">
- <a href="${sharedModel.organization.url}">${sharedModel.organization.organizationName}</a>
+ <a href="${sharedModel.organization.url}">${sharedModel.organization.name}</a>
</c:when>
<c:otherwise>
- ${sharedModel.organization.organizationName}
+ ${sharedModel.organization.name}
</c:otherwise>
</c:choose>
</td>
<th>Issue Tracker</th>
<td>
<c:choose>
- <c:when test="${!empty (sharedModel.issueManagement.issueManagementUrl)}">
- <a href="${sharedModel.issueManagement.issueManagementUrl}">${sharedModel.issueManagement.system}</a>
+ <c:when test="${!empty (sharedModel.issueManagement.url)}">
+ <a href="${sharedModel.issueManagement.url}">${sharedModel.issueManagement.system}</a>
</c:when>
<c:otherwise>
${sharedModel.issueManagement.system}
<th>Continuous Integration</th>
<td>
<c:choose>
- <c:when test="${!empty (sharedModel.ciManagement.ciUrl)}">
- <a href="${sharedModel.ciManagement.ciUrl}">${sharedModel.ciManagement.system}</a>
+ <c:when test="${!empty (sharedModel.ciManagement.url)}">
+ <a href="${sharedModel.ciManagement.url}">${sharedModel.ciManagement.system}</a>
</c:when>
<c:otherwise>
${sharedModel.ciManagement.system}
</div>
<ul>
- <c:forEach items="${results.versions}" var="version">
+ <c:forEach items="${projectVersions}" var="version">
<c:set var="url">
<s:url action="showArtifact" namespace="/">
- <s:param name="groupId" value="%{#attr.results.selectedGroupId}"/>
- <s:param name="artifactId" value="%{#attr.results.selectedArtifactId}"/>
+ <s:param name="groupId" value="%{#attr.groupId}"/>
+ <s:param name="artifactId" value="%{#attr.artifactId}"/>
<s:param name="version" value="%{#attr.version}"/>
</s:url>
</c:set>
+++ /dev/null
-<%--
- ~ 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="s" uri="/struts-tags" %>
-<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
-<%@ taglib prefix="archiva" uri="/WEB-INF/taglib.tld" %>
-
-<html>
-<head>
- <title>Browse Repository</title>
- <s:head/>
-</head>
-
-<body>
-
-<h1>Browse Repository</h1>
-
-<div id="contentArea">
- <div id="nameColumn">
- <p>
- <archiva:groupIdLink var="${groupId}" includeTop="true" />
- <strong>${artifactId}</strong>
- </p>
-
- <h2>Versions</h2>
- <ul>
- <s:set name="versions" value="versions"/>
- <c:forEach items="${versions}" var="version">
- <c:set var="url">
- <s:url action="showArtifact" namespace="/">
- <s:param name="groupId" value="%{#attr.groupId}"/>
- <s:param name="artifactId" value="%{#attr.artifactId}"/>
- <s:param name="version" value="%{'#attr.version}"/>
- </s:url>
- </c:set>
- <li><a href="${url}">${version}/</a></li>
- </c:forEach>
- </ul>
- </div>
-</div>
-
-</body>
-</html>
+++ /dev/null
-<%--
- ~ 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="s" uri="/struts-tags" %>
-<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
-<%@ taglib prefix="archiva" uri="/WEB-INF/taglib.tld" %>
-
-<html>
-<head>
- <title>Browse Repository</title>
- <s:head/>
-</head>
-
-<body>
-
-<h1>Browse Repository</h1>
-
-<div id="contentArea">
- <p>
- <archiva:groupIdLink var="${results.selectedGroupId}" includeTop="true" />
- </p>
-
- <div id="nameColumn">
- <h2>Groups</h2>
- <ul>
- <c:forEach items="${results.groupIds}" var="groupId">
- <c:set var="url">
- <s:url action="browseGroup" namespace="/">
- <s:param name="groupId" value="%{#attr.groupId}"/>
- </s:url>
- </c:set>
- <li><a href="${url}">${groupId}/</a></li>
- </c:forEach>
- </ul>
- </div>
-
- <c:if test="${not empty results.versions}">
- <div id="nameColumn">
- <h2>Versions</h2>
- <ul>
- <c:forEach items="${results.versions}" var="version">
- <c:set var="url">
- <s:url action="browseVersion" namespace="/">
- <s:param name="groupId" value="%{#attr.results.selectedGroupId}"/>
- <s:param name="version" value="%{#attr.version}"/>
- </s:url>
- </c:set>
- <li><a href="${url}">${version}/</a></li>
- </c:forEach>
- </ul>
- </div>
- </c:if>
-
- <c:if test="${not empty results.artifacts}">
- <div id="nameColumn">
- <h2>Artifacts</h2>
- <ul>
- <c:forEach items="${results.artifacts}" var="artifactId">
- <c:set var="url">
- <s:url action="browseArtifact" namespace="/">
- <s:param name="groupId" value="%{#attr.groupId}"/>
- <s:param name="artifactId" value="%{#attr.artifactId}"/>
- </s:url>
- </c:set>
- <li><a href="${url}">${artifactId}/</a></li>
- </c:forEach>
- </ul>
- </div>
- </c:if>
-
-
-</div>
-
-</body>
-</html>
<%@ taglib prefix="archiva" uri="/WEB-INF/taglib.tld" %>
<p>
- <archiva:groupIdLink var="${model.groupId}" includeTop="true" />
+ <archiva:groupIdLink var="${groupId}" includeTop="true" />
<c:set var="url">
<s:url action="browseArtifact" namespace="/">
- <s:param name="groupId" value="%{#attr.model.groupId}"/>
- <s:param name="artifactId" value="%{#attr.model.artifactId}"/>
+ <s:param name="groupId" value="%{#attr.groupId}"/>
+ <s:param name="artifactId" value="%{#attr.artifactId}"/>
</s:url>
</c:set>
- <a href="${url}">${model.artifactId}</a> /
+ <a href="${url}">${artifactId}</a> /
<strong>${version}</strong>
<%-- TODO: new versions?
<blockquote>${model.description}</blockquote>
</c:if>
+<c:set var="mavenFacet" value="${model.facets['org.apache.archiva.metadata.repository.storage.maven2']}" />
<table class="infoTable">
<tr>
<th>Repository</th>
</tr>
<tr>
<th>Group ID</th>
- <td>${model.groupId}</td>
+ <td>${mavenFacet.groupId}</td>
</tr>
<tr>
<th>Artifact ID</th>
- <td>${model.artifactId}</td>
+ <td>${mavenFacet.artifactId}</td>
</tr>
<tr>
<th>Version</th>
</tr>
<tr>
<th>Packaging</th>
- <td><code>${model.packaging}</code></td>
+ <td><code>${mavenFacet.packaging}</code></td>
</tr>
<%-- TODO: derivatives
<tr>
</td>
</tr>
--%>
- <c:if test="${model.parentProject != null}">
+ <c:if test="${mavenFacet.parent != null}">
<tr>
<th>Parent</th>
<td>
- ${model.parentProject.groupId} ${model.parentProject.artifactId} ${model.parentProject.version}
+ ${mavenFacet.parent.groupId} ${mavenFacet.parent.artifactId} ${mavenFacet.parent.version}
<c:set var="url">
<s:url action="showArtifact" namespace="/">
- <s:param name="groupId" value="%{#attr.model.parentProject.groupId}"/>
- <s:param name="artifactId" value="%{#attr.model.parentProject.artifactId}"/>
- <s:param name="version" value="%{#attr.model.parentProject.version}"/>
+ <s:param name="groupId" value="%{#attr.mavenFacet.parent.groupId}"/>
+ <s:param name="artifactId" value="%{#attr.mavenFacet.parent.artifactId}"/>
+ <s:param name="version" value="%{#attr.mavenFacet.parent.version}"/>
</s:url>
</c:set>
(<a href="${url}">View</a>)
<c:forEach items="${snapshotVersions}" var="snapshot">
<c:set var="url">
<s:url action="showArtifact" namespace="/">
- <s:param name="groupId" value="%{#attr.model.groupId}"/>
- <s:param name="artifactId" value="%{#attr.model.artifactId}"/>
+ <s:param name="groupId" value="%{#attr.mavenFacet.groupId}"/>
+ <s:param name="artifactId" value="%{#attr.mavenFacet.artifactId}"/>
<s:param name="version" value="%{#attr.snapshot}"/>
</s:url>
</c:set>
--%>
</table>
-<c:if test="${model.packaging != 'pom'}">
+<c:if test="${mavenFacet.packaging != 'pom'}">
<h2>POM Snippet</h2>
<c:choose>
- <c:when test="${model.packaging == 'maven-plugin'}">
+ <c:when test="${mavenFacet.packaging == 'maven-plugin'}">
<pre class="pom">
<plugin>
- <groupId>${model.groupId}</groupId>
- <artifactId>${model.artifactId}</artifactId>
+ <groupId>${mavenFacet.groupId}</groupId>
+ <artifactId>${mavenFacet.artifactId}</artifactId>
<version>${version}</version>
</plugin>
</pre>
<c:otherwise>
<pre class="pom">
<dependency>
- <groupId>${model.groupId}</groupId>
- <artifactId>${model.artifactId}</artifactId>
- <version>${version}</version><c:if test="${model.packaging != 'jar'}">
- <type>${model.packaging}</type></c:if>
+ <groupId>${mavenFacet.groupId}</groupId>
+ <artifactId>${mavenFacet.artifactId}</artifactId>
+ <version>${version}</version><c:if test="${mavenFacet.packaging != 'jar'}">
+ <type>${mavenFacet.packaging}</type></c:if>
</dependency>
</pre>
</c:otherwise>
<th>Organisation</th>
<td>
<c:choose>
- <c:when test="${model.organization != null}">
- <a href="${model.organization.url}">${model.organization.organizationName}</a>
+ <c:when test="${model.organization.url != null}">
+ <a href="${model.organization.url}">${model.organization.name}</a>
</c:when>
<c:otherwise>
${model.organization.name}
<th>Issue Tracker</th>
<td>
<c:choose>
- <c:when test="${!empty (model.issueManagement.issueManagementUrl)}">
- <a href="${model.issueManagement.issueManagementUrl}">${model.issueManagement.system}</a>
+ <c:when test="${!empty (model.issueManagement.url)}">
+ <a href="${model.issueManagement.url}">${model.issueManagement.system}</a>
</c:when>
<c:otherwise>
${model.issueManagement.system}
<th>Continuous Integration</th>
<td>
<c:choose>
- <c:when test="${!empty (model.ciManagement.ciUrl)}">
- <a href="${model.ciManagement.ciUrl}">${model.ciManagement.system}</a>
+ <c:when test="${!empty (model.ciManagement.url)}">
+ <a href="${model.ciManagement.url}">${model.ciManagement.system}</a>
</c:when>
<c:otherwise>
${model.ciManagement.system}
<%-- TODO: paginate [MRM-491] --%>
<c:forEach items="${dependees}" var="project">
<h3 class="artifact-title">
- <my:showArtifactTitle groupId="${project.groupId}" artifactId="${project.artifactId}"
- version="${project.version}"/>
+ <my:showArtifactTitle groupId="${project.namespace}" artifactId="${project.projectId}"
+ version="${project.projectVersion}"/>
</h3>
<p>
- <my:showArtifactLink groupId="${project.groupId}" artifactId="${project.artifactId}"
- version="${project.version}"/>
+ <my:showArtifactLink groupId="${project.namespace}" artifactId="${project.projectId}"
+ version="${project.projectVersion}"/>
</p>
</c:forEach>
<c:if test="${empty (dependees)}">
<body>
<s:set name="model" value="model"/>
+<c:set var="mavenFacet" value="${model.facets['org.apache.archiva.metadata.repository.storage.maven2']}" />
+
<c:choose>
- <c:when test="${model.packaging == 'maven-plugin'}">
+ <c:when test="${mavenFacet.packaging == 'maven-plugin'}">
<c:url var="imageUrl" value="/images/mavenplugin.gif"/>
<c:set var="packageName">Maven Plugin</c:set>
</c:when>
- <c:when test="${model.packaging == 'pom'}">
+ <c:when test="${mavenFacet.packaging == 'pom'}">
<c:url var="imageUrl" value="/images/pom.gif"/>
<c:set var="packageName">POM</c:set>
</c:when>
<%-- These types aren't usually set in the POM yet, so we fudge them for the well known ones --%>
- <c:when test="${model.packaging == 'maven-archetype' or model.groupId == 'org.apache.maven.archetypes'}">
+ <c:when test="${mavenFacet.packaging == 'maven-archetype' or mavenFacet.groupId == 'org.apache.maven.archetypes'}">
<c:url var="imageUrl" value="/images/archetype.gif"/>
<c:set var="packageName">Maven Archetype</c:set>
</c:when>
- <c:when test="${model.packaging == 'maven-skin' or model.groupId == 'org.apache.maven.skins'}">
+ <c:when test="${mavenFacet.packaging == 'maven-skin' or mavenFacet.groupId == 'org.apache.maven.skins'}">
<c:url var="imageUrl" value="/images/skin.gif"/>
<c:set var="packageName">Maven Skin</c:set>
</c:when>
<%-- Must be last so that the above get picked up if possible --%>
- <c:when test="${model.packaging == 'jar'}">
+ <c:when test="${mavenFacet.packaging == 'jar'}">
<c:url var="imageUrl" value="/images/jar.gif"/>
<c:set var="packageName">JAR</c:set>
</c:when>
<h1>
<c:choose>
<c:when test="${empty (model.name)}">
- ${model.artifactId}
+ ${mavenFacet.artifactId}
</c:when>
<c:otherwise>
${model.name}
</div>
<div class="sidebar3">
- <archiva:downloadArtifact groupId="${model.groupId}" artifactId="${model.artifactId}" version="${model.version}"/>
+ <archiva:downloadArtifact groupId="${mavenFacet.groupId}" artifactId="${mavenFacet.artifactId}" version="${model.version}"/>
</div>
<%-- TODO: perhaps using ajax? --%>
import org.apache.archiva.metadata.repository.memory.TestMetadataResolver;
import org.apache.archiva.metadata.repository.storage.maven2.MavenProjectFacet;
import org.apache.archiva.metadata.repository.storage.maven2.MavenProjectParent;
-import org.apache.maven.archiva.model.ArchivaProjectModel;
import org.apache.maven.archiva.security.UserRepositories;
import org.apache.maven.archiva.security.UserRepositoriesStub;
import org.codehaus.plexus.spring.PlexusInSpringTestCase;
repos.setObservableRepositoryIds( repoIds );
}
- protected void assertDefaultModel( ArchivaProjectModel model, String version )
+ protected void assertDefaultModel( ProjectVersionMetadata model, String version )
{
assertDefaultModel( model, TEST_GROUP_ID, TEST_ARTIFACT_ID, version );
}
- protected void assertDefaultModel( ArchivaProjectModel model, String groupId, String artifactId, String version )
+ protected void assertDefaultModel( ProjectVersionMetadata model, String groupId, String artifactId, String version )
{
- assertEquals( groupId, model.getGroupId() );
- assertEquals( artifactId, model.getArtifactId() );
assertEquals( version, model.getVersion() );
assertEquals( TEST_URL, model.getUrl() );
assertEquals( TEST_NAME, model.getName() );
assertEquals( TEST_ORGANIZATION_NAME, model.getOrganization().getName() );
assertEquals( TEST_ORGANIZATION_URL, model.getOrganization().getUrl() );
assertEquals( 2, model.getLicenses().size() );
- org.apache.maven.archiva.model.License l = model.getLicenses().get( 0 );
+ License l = model.getLicenses().get( 0 );
assertEquals( TEST_LICENSE_NAME, l.getName() );
assertEquals( TEST_LICENSE_URL, l.getUrl() );
l = model.getLicenses().get( 1 );
assertEquals( TEST_SCM_DEV_CONNECTION, model.getScm().getDeveloperConnection() );
assertEquals( TEST_SCM_URL, model.getScm().getUrl() );
- assertEquals( TEST_PACKAGING, model.getPackaging() );
- assertEquals( TEST_PARENT_GROUP_ID, model.getParentProject().getGroupId() );
- assertEquals( TEST_PARENT_ARTIFACT_ID, model.getParentProject().getArtifactId() );
- assertEquals( TEST_PARENT_VERSION, model.getParentProject().getVersion() );
+ MavenProjectFacet mavenFacet = (MavenProjectFacet) model.getFacet( MavenProjectFacet.FACET_ID );
+ assertEquals( groupId, mavenFacet.getGroupId() );
+ assertEquals( artifactId, mavenFacet.getArtifactId() );
+ assertEquals( TEST_PACKAGING, mavenFacet.getPackaging() );
+ assertEquals( TEST_PARENT_GROUP_ID, mavenFacet.getParent().getGroupId() );
+ assertEquals( TEST_PARENT_ARTIFACT_ID, mavenFacet.getParent().getArtifactId() );
+ assertEquals( TEST_PARENT_VERSION, mavenFacet.getParent().getVersion() );
}
protected ProjectVersionMetadata createProjectModel( String version )
import org.apache.archiva.metadata.model.ProjectVersionMetadata;
import org.apache.archiva.metadata.repository.MetadataResolverException;
import org.apache.archiva.metadata.repository.memory.TestMetadataResolver;
-import org.apache.maven.archiva.database.ArchivaDatabaseException;
-import org.apache.maven.archiva.database.browsing.BrowsingResults;
-import org.apache.maven.archiva.model.ArchivaProjectModel;
public class BrowseActionTest
extends AbstractActionTestCase
String result = action.browse();
assertSuccessResult( result );
- BrowsingResults results = action.getResults();
- assertNotNull( results );
- assertEquals( Arrays.asList( TEST_REPO ), results.getSelectedRepositoryIds() );
- assertEquals( Arrays.asList( "com", "commons-lang", "org.apache", "repeat.repeat" ), results.getGroupIds() );
- assertNull( results.getArtifacts() );
- assertNull( results.getSelectedArtifactId() );
- assertNull( results.getSelectedGroupId() );
- assertNull( results.getVersions() );
+ assertEquals( Arrays.asList( "com", "commons-lang", "org.apache", "repeat.repeat" ), action.getNamespaces() );
+ assertNull( action.getProjectIds() );
+ assertNull( action.getProjectVersions() );
assertNull( action.getGroupId() );
assertNull( action.getArtifactId() );
assertNoAccessResult( result );
assertEquals( selectedGroupId, action.getGroupId() );
- assertNull( action.getResults() );
+ assertNull( action.getNamespaces() );
+ assertNull( action.getProjectIds() );
+ assertNull( action.getProjectVersions() );
assertNull( action.getArtifactId() );
assertNull( action.getRepositoryId() );
assertNull( action.getSharedModel() );
assertEquals( selectedGroupId, action.getGroupId() );
assertEquals( selectedArtifactId, action.getArtifactId() );
- assertNull( action.getResults() );
+ assertNull( action.getNamespaces() );
+ assertNull( action.getProjectIds() );
+ assertNull( action.getProjectVersions() );
assertNull( action.getRepositoryId() );
assertNull( action.getSharedModel() );
}
String result = action.browseGroup();
assertSuccessResult( result );
- BrowsingResults results = action.getResults();
- assertNotNull( results );
- assertEquals( Arrays.asList( TEST_REPO ), results.getSelectedRepositoryIds() );
- assertEquals( Collections.singletonList( "org.apache" ), results.getGroupIds() );
- assertEquals( Collections.<String>emptyList(), results.getArtifacts() );
- assertNull( results.getSelectedArtifactId() );
- assertEquals( selectedGroupId, results.getSelectedGroupId() );
- assertNull( results.getVersions() );
+ assertEquals( Collections.singletonList( "org.apache" ), action.getNamespaces() );
+ assertEquals( Collections.<String>emptyList(), action.getProjectIds() );
+ assertNull( action.getProjectVersions() );
assertEquals( selectedGroupId, action.getGroupId() );
assertNull( action.getArtifactId() );
String result = action.browseGroup();
assertSuccessResult( result );
- BrowsingResults results = action.getResults();
- assertNotNull( results );
- assertEquals( Arrays.asList( TEST_REPO ), results.getSelectedRepositoryIds() );
- assertEquals( groups, results.getGroupIds() );
- assertEquals( Collections.singletonList( artifacts ), results.getArtifacts() );
- assertNull( results.getSelectedArtifactId() );
- assertEquals( selectedGroupId, results.getSelectedGroupId() );
- assertNull( results.getVersions() );
+ assertEquals( groups, action.getNamespaces() );
+ assertEquals( Collections.singletonList( artifacts ), action.getProjectIds() );
+ assertNull( action.getProjectVersions() );
assertEquals( selectedGroupId, action.getGroupId() );
assertNull( action.getArtifactId() );
String result = action.browse();
assertSuccessResult( result );
- BrowsingResults results = action.getResults();
- assertNotNull( results );
- assertEquals( Arrays.asList( TEST_REPO ), results.getSelectedRepositoryIds() );
- assertEquals( Collections.singletonList( "org.apache" ), results.getGroupIds() );
- assertNull( results.getArtifacts() );
- assertNull( results.getSelectedArtifactId() );
- assertNull( results.getSelectedGroupId() );
- assertNull( results.getVersions() );
+ assertEquals( Collections.singletonList( "org.apache" ), action.getNamespaces() );
+ assertNull( action.getProjectIds() );
+ assertNull( action.getProjectVersions() );
assertNull( action.getGroupId() );
assertNull( action.getArtifactId() );
String result = action.browseGroup();
assertSuccessResult( result );
- BrowsingResults results = action.getResults();
- assertNotNull( results );
- assertEquals( Arrays.asList( TEST_REPO ), results.getSelectedRepositoryIds() );
- assertEquals( Collections.singletonList( "org.apache.archiva" ), results.getGroupIds() );
- assertEquals( Collections.singletonList( artifacts ), results.getArtifacts() );
- assertNull( results.getSelectedArtifactId() );
- assertEquals( selectedGroupId, results.getSelectedGroupId() );
- assertNull( results.getVersions() );
+ assertEquals( Collections.singletonList( "org.apache.archiva" ), action.getNamespaces() );
+ assertEquals( Collections.singletonList( artifacts ), action.getProjectIds() );
+ assertNull( action.getProjectVersions() );
assertEquals( selectedGroupId, action.getGroupId() );
assertNull( action.getArtifactId() );
String result = action.browseArtifact();
assertErrorResult( result );
- assertNull( action.getResults() );
+ assertNull( action.getNamespaces() );
+ assertNull( action.getProjectIds() );
+ assertNull( action.getProjectVersions() );
assertNull( action.getGroupId() );
assertEquals( selectedArtifactId, action.getArtifactId() );
assertNull( action.getRepositoryId() );
String result = action.browseArtifact();
assertErrorResult( result );
- assertNull( action.getResults() );
+ assertNull( action.getNamespaces() );
+ assertNull( action.getProjectIds() );
+ assertNull( action.getProjectVersions() );
assertEquals( selectedGroupId, action.getGroupId() );
assertNull( action.getArtifactId() );
assertNull( action.getRepositoryId() );
}
public void testBrowseArtifact()
- throws ArchivaDatabaseException, MetadataResolverException
+ throws MetadataResolverException
{
String selectedGroupId = "org.apache";
String selectedArtifactId = "apache";
assertEquals( selectedArtifactId, action.getArtifactId() );
assertNull( action.getRepositoryId() );
- BrowsingResults results = action.getResults();
- assertNotNull( results );
- assertEquals( Arrays.asList( TEST_REPO ), results.getSelectedRepositoryIds() );
- assertNull( results.getGroupIds() );
- assertNull( results.getArtifacts() );
- assertEquals( selectedGroupId, results.getSelectedGroupId() );
- assertEquals( selectedArtifactId, results.getSelectedArtifactId() );
- assertEquals( versions, results.getVersions() );
+ assertNull( action.getNamespaces() );
+ assertNull( action.getProjectIds() );
+ assertEquals( versions, action.getProjectVersions() );
- ArchivaProjectModel model = action.getSharedModel();
+ ProjectVersionMetadata model = action.getSharedModel();
assertDefaultModel( model, selectedGroupId, selectedArtifactId, null );
}
public void testBrowseArtifactWithSnapshots()
- throws ArchivaDatabaseException, MetadataResolverException
+ throws MetadataResolverException
{
String selectedGroupId = "org.apache";
String selectedArtifactId = "apache";
assertEquals( selectedArtifactId, action.getArtifactId() );
assertNull( action.getRepositoryId() );
- BrowsingResults results = action.getResults();
- assertNotNull( results );
- assertEquals( Arrays.asList( TEST_REPO ), results.getSelectedRepositoryIds() );
- assertNull( results.getGroupIds() );
- assertNull( results.getArtifacts() );
- assertEquals( selectedGroupId, results.getSelectedGroupId() );
- assertEquals( selectedArtifactId, results.getSelectedArtifactId() );
- assertEquals( versions, results.getVersions() );
+ assertNull( action.getNamespaces() );
+ assertNull( action.getProjectIds() );
+ assertEquals( versions, action.getProjectVersions() );
- ArchivaProjectModel model = action.getSharedModel();
+ ProjectVersionMetadata model = action.getSharedModel();
assertDefaultModel( model, selectedGroupId, selectedArtifactId, null );
}
private void assertNoOutputVariables()
{
- assertNull( action.getResults() );
+ assertNull( action.getNamespaces() );
+ assertNull( action.getProjectIds() );
+ assertNull( action.getProjectVersions() );
assertNull( action.getGroupId() );
assertNull( action.getArtifactId() );
assertNull( action.getRepositoryId() );
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.database.ArchivaDatabaseException;
-import org.apache.maven.archiva.model.ArchivaProjectModel;
public class ShowArtifactActionTest
extends AbstractActionTestCase
assertActionSuccess( action, result );
assertActionParameters( action );
- ArchivaProjectModel model = action.getModel();
+ ProjectVersionMetadata model = action.getModel();
assertDefaultModel( model );
assertEquals( TEST_REPO, action.getRepositoryId() );
assertEquals( TEST_GROUP_ID, action.getGroupId() );
assertEquals( TEST_ARTIFACT_ID, action.getArtifactId() );
assertEquals( TEST_SNAPSHOT_VERSION, action.getVersion() );
- ArchivaProjectModel model = action.getModel();
+ ProjectVersionMetadata model = action.getModel();
assertDefaultModel( model, TEST_SNAPSHOT_VERSION );
assertEquals( TEST_REPO, action.getRepositoryId() );
assertEquals( TEST_GROUP_ID, action.getGroupId() );
assertEquals( TEST_ARTIFACT_ID, action.getArtifactId() );
assertEquals( TEST_TS_SNAPSHOT_VERSION, action.getVersion() );
- ArchivaProjectModel model = action.getModel();
+ ProjectVersionMetadata model = action.getModel();
assertDefaultModel( model, TEST_TS_SNAPSHOT_VERSION );
assertEquals( TEST_REPO, action.getRepositoryId() );
assertActionSuccess( action, result );
assertActionParameters( action );
- ArchivaProjectModel model = action.getModel();
+ ProjectVersionMetadata model = action.getModel();
assertDefaultModel( model );
assertEquals( TEST_REPO, action.getRepositoryId() );
assertActionSuccess( action, result );
assertActionParameters( action );
- ArchivaProjectModel model = action.getModel();
+ ProjectVersionMetadata model = action.getModel();
assertDefaultModel( model );
assertEquals( TEST_REPO, action.getRepositoryId() );
assertActionSuccess( action, result );
assertActionParameters( action );
- ArchivaProjectModel model = action.getModel();
+ ProjectVersionMetadata model = action.getModel();
assertDefaultModel( model );
assertEquals( TEST_REPO, action.getRepositoryId() );
assertActionSuccess( action, result );
assertActionParameters( action );
- ArchivaProjectModel model = action.getModel();
+ ProjectVersionMetadata model = action.getModel();
assertEquals( TEST_VERSION, model.getVersion() );
assertEquals( TEST_URL, model.getUrl() );
assertEquals( TEST_NAME, model.getName() );
}
public void testGetMailingLists()
- throws ArchivaDatabaseException
{
ProjectVersionMetadata versionMetadata = createProjectModel( TEST_VERSION );
MailingList ml1 = createMailingList( "Users List", "users" );
assertActionSuccess( action, result );
assertActionParameters( action );
- ArchivaProjectModel model = action.getModel();
+ ProjectVersionMetadata model = action.getModel();
assertDefaultModel( model );
assertNotNull( action.getMailingLists() );
}
public void testGetDependencies()
- throws ArchivaDatabaseException
{
ProjectVersionMetadata versionMetadata = createProjectModel( TEST_VERSION );
Dependency dependency1 = createDependencyBasic( "artifactId1" );
assertActionSuccess( action, result );
assertActionParameters( action );
- ArchivaProjectModel model = action.getModel();
+ ProjectVersionMetadata model = action.getModel();
assertDefaultModel( model );
assertNotNull( action.getDependencies() );
}
public void testGetDependees()
- throws ArchivaDatabaseException
{
ProjectVersionMetadata versionMetadata = createProjectModel( TEST_VERSION );
metadataResolver.setProjectVersion( TEST_REPO, TEST_GROUP_ID, TEST_ARTIFACT_ID, versionMetadata );
assertActionSuccess( action, result );
assertActionParameters( action );
- ArchivaProjectModel model = action.getModel();
+ ProjectVersionMetadata model = action.getModel();
assertDefaultModel( model );
assertNotNull( action.getDependees() );
return reference;
}
- private void assertCoordinate( ArchivaProjectModel dependee, String artifactId )
+ private void assertCoordinate( ProjectVersionReference dependee, String artifactId )
{
- assertEquals( artifactId, dependee.getArtifactId() );
- assertEquals( "groupId", dependee.getGroupId() );
- assertEquals( "version", dependee.getVersion() );
+ assertEquals( artifactId, dependee.getProjectId() );
+ assertEquals( "groupId", dependee.getNamespace() );
+ assertEquals( "version", dependee.getProjectVersion() );
}
- private void assertDependencyBasic( org.apache.maven.archiva.model.Dependency dependency, String artifactId )
+ private void assertDependencyBasic( Dependency dependency, String artifactId )
{
assertEquals( artifactId, dependency.getArtifactId() );
assertEquals( "groupId", dependency.getGroupId() );
assertEquals( "version", dependency.getVersion() );
}
- private void assertDependencyExtended( org.apache.maven.archiva.model.Dependency dependency, String artifactId )
+ private void assertDependencyExtended( Dependency dependency, String artifactId )
{
assertDependencyBasic( dependency, artifactId );
assertEquals( true, dependency.isOptional() );
return dependency;
}
- private void assertMailingList( org.apache.maven.archiva.model.MailingList mailingList, String name, String prefix )
+ private void assertMailingList( MailingList mailingList, String name, String prefix )
{
assertEquals( name, mailingList.getName() );
assertEquals( prefix + "-post@", mailingList.getPostAddress() );
assertEquals( 1, action.getActionErrors().size() );
}
- private void assertDefaultModel( ArchivaProjectModel model )
+ private void assertDefaultModel( ProjectVersionMetadata model )
{
assertDefaultModel( model, TEST_VERSION );
}
return id;
}
+ public String getVersion()
+ {
+ return id;
+ }
+
public void setId( String id )
{
this.id = id;
this.licenses.add( license );
}
- public void addFacet( ProjectVersionFacet mavenProjectFacet )
+ public void addFacet( ProjectVersionFacet projectVersionFacet )
{
- this.facets.put( mavenProjectFacet.getFacetId(), mavenProjectFacet );
+ this.facets.put( projectVersionFacet.getFacetId(), projectVersionFacet );
}
public ProjectVersionFacet getFacet( String facetId )
return this.facets.get( facetId );
}
- public Collection<ProjectVersionFacet> getAllFacets()
+ public Map<String, ProjectVersionFacet> getFacets()
+ {
+ return facets;
+ }
+
+ public Collection<ProjectVersionFacet> getFacetList()
{
return this.facets.values();
}
- public Collection<String> getAllFacetIds()
+ public Collection<String> getFacetIds()
{
return this.facets.keySet();
}
setProperty( properties, "dependency." + i + ".type", dependency.getType() );
i++;
}
- properties.setProperty( "facetIds", join( versionMetadata.getAllFacetIds() ) );
- for ( ProjectVersionFacet facet : versionMetadata.getAllFacets() )
+ properties.setProperty( "facetIds", join( versionMetadata.getFacetIds() ) );
+ for ( ProjectVersionFacet facet : versionMetadata.getFacetList() )
{
properties.putAll( facet.toProperties() );
}
if ( issueSystem != null || issueUrl != null )
{
IssueManagement issueManagement = new IssueManagement();
- issueManagement.setSystem( ciSystem );
- issueManagement.setUrl( ciUrl );
+ issueManagement.setSystem( issueSystem );
+ issueManagement.setUrl( issueUrl );
versionMetadata.setIssueManagement( issueManagement );
}
}
}
- for ( ProjectVersionFacet facet : versionMetadata.getAllFacets() )
+ for ( ProjectVersionFacet facet : versionMetadata.getFacetList() )
{
properties.putAll( facet.toProperties() );
}