From c79221c9974357e953e8f670274eba8377b18b96 Mon Sep 17 00:00:00 2001 From: Brett Porter Date: Fri, 27 Nov 2009 23:39:42 +0000 Subject: [PATCH] [MRM-1283] remove legacy model intermediatary git-svn-id: https://svn.apache.org/repos/asf/archiva/branches/MRM-1025@885051 13f79535-47bb-0310-9956-ffa450edef68 --- .../archiva/web/action/BrowseAction.java | 208 +++++------------- .../web/action/ShowArtifactAction.java | 148 +------------ .../src/main/webapp/WEB-INF/jsp/browse.jsp | 49 +++-- .../webapp/WEB-INF/jsp/browseArtifact.jsp | 59 ----- .../main/webapp/WEB-INF/jsp/browseGroup.jsp | 91 -------- .../WEB-INF/jsp/include/artifactInfo.jspf | 57 ++--- .../WEB-INF/jsp/include/projectDependees.jspf | 8 +- .../main/webapp/WEB-INF/jsp/showArtifact.jsp | 16 +- .../web/action/AbstractActionTestCase.java | 20 +- .../archiva/web/action/BrowseActionTest.java | 108 ++++----- .../web/action/ShowArtifactActionTest.java | 41 ++-- .../model/ProjectVersionMetadata.java | 18 +- .../file/FileMetadataRepository.java | 10 +- 13 files changed, 220 insertions(+), 613 deletions(-) delete mode 100644 archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/browseArtifact.jsp delete mode 100644 archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/browseGroup.jsp diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/BrowseAction.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/BrowseAction.java index 520cc7b61..3ad7298ef 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/BrowseAction.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/BrowseAction.java @@ -32,16 +32,6 @@ import org.apache.archiva.metadata.repository.MetadataResolverException; 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; @@ -67,17 +57,19 @@ public class BrowseAction */ 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 namespaces; + + private Collection projectIds; + + private Collection projectVersions; public String browse() { @@ -101,9 +93,7 @@ public class BrowseAction } } - this.results = new BrowsingResults(); - results.setGroupIds( getSortedList( namespaces ) ); - results.setSelectedRepositoryIds( selectedRepos ); + this.namespaces = getSortedList( namespaces ); return SUCCESS; } @@ -160,10 +150,8 @@ public class BrowseAction 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; } @@ -203,25 +191,27 @@ public class BrowseAction versions.addAll( metadataResolver.getProjectVersions( repoId, groupId, artifactId ) ); } - this.results = new BrowsingResults( groupId, artifactId ); // TODO: sort by known version ordering method - results.setVersions( new ArrayList( versions ) ); - results.setSelectedRepositoryIds( selectedRepos ); + this.projectVersions = new ArrayList( versions ); - populateSharedModel( selectedRepos ); + populateSharedModel( selectedRepos, versions ); return SUCCESS; } - private void populateSharedModel( Collection selectedRepos ) + private void populateSharedModel( Collection selectedRepos, Collection 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 ) @@ -237,56 +227,59 @@ public class BrowseAction 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 ); } @@ -296,102 +289,6 @@ public class BrowseAction } } - 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 getObservableRepos() { try @@ -434,9 +331,9 @@ public class BrowseAction this.artifactId = artifactId; } - public BrowsingResults getResults() + public Collection getNamespaces() { - return results; + return namespaces; } public String getRepositoryId() @@ -451,18 +348,23 @@ public class BrowseAction this.repositoryId = repositoryId; } - public ArchivaProjectModel getSharedModel() + public ProjectVersionMetadata getSharedModel() { return sharedModel; } - public void setSharedModel( ArchivaProjectModel sharedModel ) + public MetadataResolver getMetadataResolver() + { + return metadataResolver; + } + + public Collection getProjectIds() { - this.sharedModel = sharedModel; + return projectIds; } - public MetadataResolver getMetadataResolver() + public Collection getProjectVersions() { - return metadataResolver; + return projectVersions; } } 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 921c7a56e..6cdf233bf 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 @@ -24,23 +24,13 @@ import java.util.Collections; 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; @@ -82,12 +72,12 @@ public class ShowArtifactAction /** * The model of this versioned project. */ - private ArchivaProjectModel model; + private ProjectVersionMetadata model; /** * The list of artifacts that depend on this versioned project. */ - private List dependees; + private List dependees; private List mailingLists; @@ -141,112 +131,15 @@ public class ShowArtifactAction 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() ) @@ -270,7 +163,7 @@ public class ShowArtifactAction addActionError( "Artifact not found" ); return ERROR; } - model = populateLegacyModel( versionMetadata ); + model = versionMetadata; this.dependencies = model.getDependencies(); @@ -281,7 +174,6 @@ public class ShowArtifactAction * Show the mailing lists information tab. */ public String mailingLists() - throws ObjectNotFoundException, ArchivaDatabaseException { ProjectVersionMetadata versionMetadata = null; for ( String repoId : getObservableRepos() ) @@ -305,7 +197,7 @@ public class ShowArtifactAction addActionError( "Artifact not found" ); return ERROR; } - model = populateLegacyModel( versionMetadata ); + model = versionMetadata; this.mailingLists = model.getMailingLists(); @@ -316,7 +208,6 @@ public class ShowArtifactAction * Show the reports tab. */ public String reports() - throws ObjectNotFoundException, ArchivaDatabaseException { // TODO: hook up reports on project - this.reports = artifactsDatabase.findArtifactResults( groupId, artifactId, // version ); @@ -328,7 +219,6 @@ public class ShowArtifactAction * Show the dependees (other artifacts that depend on this project) tab. */ public String dependees() - throws ObjectNotFoundException, ArchivaDatabaseException { ProjectVersionMetadata versionMetadata = null; for ( String repoId : getObservableRepos() ) @@ -352,7 +242,7 @@ public class ShowArtifactAction addActionError( "Artifact not found" ); return ERROR; } - model = populateLegacyModel( versionMetadata ); + model = versionMetadata; List references = new ArrayList(); // TODO: what if we get duplicates across repositories? @@ -362,17 +252,7 @@ public class ShowArtifactAction references.addAll( metadataResolver.getProjectReferences( repoId, groupId, artifactId, version ) ); } - this.dependees = new ArrayList(); - 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) @@ -384,7 +264,6 @@ public class ShowArtifactAction * 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 @@ -436,7 +315,7 @@ public class ShowArtifactAction } } - public ArchivaProjectModel getModel() + public ProjectVersionMetadata getModel() { return model; } @@ -481,7 +360,7 @@ public class ShowArtifactAction return dependencies; } - public List getDependees() + public List getDependees() { return dependees; } @@ -501,11 +380,6 @@ public class ShowArtifactAction return snapshotVersions; } - public void setSnapshotVersions( List snapshotVersions ) - { - this.snapshotVersions = snapshotVersions; - } - public MetadataResolver getMetadataResolver() { return metadataResolver; diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/browse.jsp b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/browse.jsp index 54cb15da1..7348617d3 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/browse.jsp +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/browse.jsp @@ -46,20 +46,20 @@

Browse Repository

- +

- - + + ${artifactId}

- +

Groups

    - + @@ -71,15 +71,15 @@
- +

Artifacts

    - + - + @@ -95,25 +95,26 @@
- - <%-- show shared project information (MRM-1041) --%> - + + <%-- show shared project information (MRM-1041) TODO - share JSP code with artifactInfo.jspf --%> + +

Versions

Artifact Info - + - + - + - + @@ -128,10 +129,10 @@ @@ -142,8 +143,8 @@
Group ID${sharedModel.groupId}${mavenFacet.groupId}
Artifact ID${sharedModel.artifactId}${mavenFacet.artifactId}
Packaging${sharedModel.packaging}${mavenFacet.packaging}
- ${sharedModel.organization.organizationName} + ${sharedModel.organization.name} - ${sharedModel.organization.organizationName} + ${sharedModel.organization.name} Issue Tracker - - ${sharedModel.issueManagement.system} + + ${sharedModel.issueManagement.system} ${sharedModel.issueManagement.system} @@ -157,8 +158,8 @@ Continuous Integration - - ${sharedModel.ciManagement.system} + + ${sharedModel.ciManagement.system} ${sharedModel.ciManagement.system} @@ -171,11 +172,11 @@
    - + - - + + diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/browseArtifact.jsp b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/browseArtifact.jsp deleted file mode 100644 index 8cc91c0ca..000000000 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/browseArtifact.jsp +++ /dev/null @@ -1,59 +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="s" uri="/struts-tags" %> -<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -<%@ taglib prefix="archiva" uri="/WEB-INF/taglib.tld" %> - - - - Browse Repository - - - - - -

    Browse Repository

    - -
    -
    -

    - - ${artifactId} -

    - -

    Versions

    - -
    -
    - - - diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/browseGroup.jsp b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/browseGroup.jsp deleted file mode 100644 index 113d55815..000000000 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/browseGroup.jsp +++ /dev/null @@ -1,91 +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="s" uri="/struts-tags" %> -<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -<%@ taglib prefix="archiva" uri="/WEB-INF/taglib.tld" %> - - - - Browse Repository - - - - - -

    Browse Repository

    - -
    -

    - -

    - -
    -

    Groups

    - -
    - - -
    -

    Versions

    - -
    -
    - - -
    -

    Artifacts

    - -
    -
    - - -
    - - - 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 981a98002..71c6220b9 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 @@ -22,15 +22,15 @@ <%@ taglib prefix="archiva" uri="/WEB-INF/taglib.tld" %>

    - + - - + + - ${model.artifactId} / + ${artifactId} / ${version} <%-- TODO: new versions? @@ -43,6 +43,7 @@

    ${model.description}
    + @@ -50,11 +51,11 @@ - + - + @@ -62,7 +63,7 @@ - + <%-- TODO: derivatives @@ -74,16 +75,16 @@ --%> - +
    Repository
    Group ID${model.groupId}${mavenFacet.groupId}
    Artifact ID${model.artifactId}${mavenFacet.artifactId}
    Version
    Packaging${model.packaging}${mavenFacet.packaging}
    Parent - ${model.parentProject.groupId} ${model.parentProject.artifactId} ${model.parentProject.version} + ${mavenFacet.parent.groupId} ${mavenFacet.parent.artifactId} ${mavenFacet.parent.version} - - - + + + (View) @@ -97,8 +98,8 @@ - - + + @@ -125,14 +126,14 @@ --%>
    - +

    POM Snippet

    - +
         <plugin>
    -      <groupId>${model.groupId}</groupId>
    -      <artifactId>${model.artifactId}</artifactId>
    +      <groupId>${mavenFacet.groupId}</groupId>
    +      <artifactId>${mavenFacet.artifactId}</artifactId>
           <version>${version}</version>
         </plugin>
     
    @@ -140,10 +141,10 @@
         <dependency>
    -      <groupId>${model.groupId}</groupId>
    -      <artifactId>${model.artifactId}</artifactId>
    -      <version>${version}</version>
    -      <type>${model.packaging}</type>
    +      <groupId>${mavenFacet.groupId}</groupId>
    +      <artifactId>${mavenFacet.artifactId}</artifactId>
    +      <version>${version}</version>
    +      <type>${mavenFacet.packaging}</type>
         </dependency>
     
    @@ -168,8 +169,8 @@
Organisation - - ${model.organization.organizationName} + + ${model.organization.name} ${model.organization.name} @@ -200,8 +201,8 @@ Issue Tracker - - ${model.issueManagement.system} + + ${model.issueManagement.system} ${model.issueManagement.system} @@ -215,8 +216,8 @@ Continuous Integration - - ${model.ciManagement.system} + + ${model.ciManagement.system} ${model.ciManagement.system} diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/include/projectDependees.jspf b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/include/projectDependees.jspf index fbf3ac074..aaefeb2e6 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/include/projectDependees.jspf +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/include/projectDependees.jspf @@ -24,14 +24,14 @@ <%-- TODO: paginate [MRM-491] --%>

- +

- +

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 e7b3e9600..adf05e933 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 @@ -32,26 +32,28 @@ + + - + 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 @@ -65,7 +67,7 @@

- ${model.artifactId} + ${mavenFacet.artifactId} ${model.name} @@ -133,7 +135,7 @@
- +
<%-- TODO: perhaps using ajax? --%> diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/AbstractActionTestCase.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/AbstractActionTestCase.java index aa9f9a840..73ba58bca 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/AbstractActionTestCase.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/AbstractActionTestCase.java @@ -30,7 +30,6 @@ import org.apache.archiva.metadata.model.Scm; 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; @@ -92,15 +91,13 @@ public abstract class AbstractActionTestCase 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() ); @@ -108,7 +105,7 @@ public abstract class AbstractActionTestCase 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 ); @@ -122,10 +119,13 @@ public abstract class AbstractActionTestCase 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 ) diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/BrowseActionTest.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/BrowseActionTest.java index 72a1811ae..427d9f689 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/BrowseActionTest.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/BrowseActionTest.java @@ -27,9 +27,6 @@ import com.opensymphony.xwork2.Action; 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 @@ -54,14 +51,9 @@ public class BrowseActionTest 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() ); @@ -89,7 +81,9 @@ public class BrowseActionTest 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() ); @@ -109,7 +103,9 @@ public class BrowseActionTest 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() ); } @@ -131,14 +127,9 @@ public class BrowseActionTest 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.emptyList(), results.getArtifacts() ); - assertNull( results.getSelectedArtifactId() ); - assertEquals( selectedGroupId, results.getSelectedGroupId() ); - assertNull( results.getVersions() ); + assertEquals( Collections.singletonList( "org.apache" ), action.getNamespaces() ); + assertEquals( Collections.emptyList(), action.getProjectIds() ); + assertNull( action.getProjectVersions() ); assertEquals( selectedGroupId, action.getGroupId() ); assertNull( action.getArtifactId() ); @@ -158,14 +149,9 @@ public class BrowseActionTest 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() ); @@ -184,14 +170,9 @@ public class BrowseActionTest 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() ); @@ -213,14 +194,9 @@ public class BrowseActionTest 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() ); @@ -237,7 +213,9 @@ public class BrowseActionTest 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() ); @@ -253,7 +231,9 @@ public class BrowseActionTest 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() ); @@ -261,7 +241,7 @@ public class BrowseActionTest } public void testBrowseArtifact() - throws ArchivaDatabaseException, MetadataResolverException + throws MetadataResolverException { String selectedGroupId = "org.apache"; String selectedArtifactId = "apache"; @@ -285,21 +265,16 @@ public class BrowseActionTest 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"; @@ -327,16 +302,11 @@ public class BrowseActionTest 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 ); } @@ -368,7 +338,9 @@ public class BrowseActionTest private void assertNoOutputVariables() { - assertNull( action.getResults() ); + assertNull( action.getNamespaces() ); + assertNull( action.getProjectIds() ); + assertNull( action.getProjectVersions() ); assertNull( action.getGroupId() ); assertNull( action.getArtifactId() ); assertNull( action.getRepositoryId() ); 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 8c8139f9b..84beb7508 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 @@ -29,8 +29,6 @@ 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.database.ArchivaDatabaseException; -import org.apache.maven.archiva.model.ArchivaProjectModel; public class ShowArtifactActionTest extends AbstractActionTestCase @@ -67,7 +65,7 @@ public class ShowArtifactActionTest assertActionSuccess( action, result ); assertActionParameters( action ); - ArchivaProjectModel model = action.getModel(); + ProjectVersionMetadata model = action.getModel(); assertDefaultModel( model ); assertEquals( TEST_REPO, action.getRepositoryId() ); @@ -96,7 +94,7 @@ public class ShowArtifactActionTest 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() ); @@ -126,7 +124,7 @@ public class ShowArtifactActionTest 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() ); @@ -191,7 +189,7 @@ public class ShowArtifactActionTest assertActionSuccess( action, result ); assertActionParameters( action ); - ArchivaProjectModel model = action.getModel(); + ProjectVersionMetadata model = action.getModel(); assertDefaultModel( model ); assertEquals( TEST_REPO, action.getRepositoryId() ); @@ -217,7 +215,7 @@ public class ShowArtifactActionTest assertActionSuccess( action, result ); assertActionParameters( action ); - ArchivaProjectModel model = action.getModel(); + ProjectVersionMetadata model = action.getModel(); assertDefaultModel( model ); assertEquals( TEST_REPO, action.getRepositoryId() ); @@ -243,7 +241,7 @@ public class ShowArtifactActionTest assertActionSuccess( action, result ); assertActionParameters( action ); - ArchivaProjectModel model = action.getModel(); + ProjectVersionMetadata model = action.getModel(); assertDefaultModel( model ); assertEquals( TEST_REPO, action.getRepositoryId() ); @@ -271,7 +269,7 @@ public class ShowArtifactActionTest 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() ); @@ -286,7 +284,6 @@ public class ShowArtifactActionTest } public void testGetMailingLists() - throws ArchivaDatabaseException { ProjectVersionMetadata versionMetadata = createProjectModel( TEST_VERSION ); MailingList ml1 = createMailingList( "Users List", "users" ); @@ -301,7 +298,7 @@ public class ShowArtifactActionTest assertActionSuccess( action, result ); assertActionParameters( action ); - ArchivaProjectModel model = action.getModel(); + ProjectVersionMetadata model = action.getModel(); assertDefaultModel( model ); assertNotNull( action.getMailingLists() ); @@ -315,7 +312,6 @@ public class ShowArtifactActionTest } public void testGetDependencies() - throws ArchivaDatabaseException { ProjectVersionMetadata versionMetadata = createProjectModel( TEST_VERSION ); Dependency dependency1 = createDependencyBasic( "artifactId1" ); @@ -330,7 +326,7 @@ public class ShowArtifactActionTest assertActionSuccess( action, result ); assertActionParameters( action ); - ArchivaProjectModel model = action.getModel(); + ProjectVersionMetadata model = action.getModel(); assertDefaultModel( model ); assertNotNull( action.getDependencies() ); @@ -344,7 +340,6 @@ public class ShowArtifactActionTest } public void testGetDependees() - throws ArchivaDatabaseException { ProjectVersionMetadata versionMetadata = createProjectModel( TEST_VERSION ); metadataResolver.setProjectVersion( TEST_REPO, TEST_GROUP_ID, TEST_ARTIFACT_ID, versionMetadata ); @@ -360,7 +355,7 @@ public class ShowArtifactActionTest assertActionSuccess( action, result ); assertActionParameters( action ); - ArchivaProjectModel model = action.getModel(); + ProjectVersionMetadata model = action.getModel(); assertDefaultModel( model ); assertNotNull( action.getDependees() ); @@ -383,21 +378,21 @@ public class ShowArtifactActionTest 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() ); @@ -427,7 +422,7 @@ public class ShowArtifactActionTest 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() ); @@ -466,7 +461,7 @@ public class ShowArtifactActionTest assertEquals( 1, action.getActionErrors().size() ); } - private void assertDefaultModel( ArchivaProjectModel model ) + private void assertDefaultModel( ProjectVersionMetadata model ) { assertDefaultModel( model, TEST_VERSION ); } diff --git a/archiva-modules/metadata/metadata-model/src/main/java/org/apache/archiva/metadata/model/ProjectVersionMetadata.java b/archiva-modules/metadata/metadata-model/src/main/java/org/apache/archiva/metadata/model/ProjectVersionMetadata.java index 5e4626f94..f6a2bfb95 100644 --- a/archiva-modules/metadata/metadata-model/src/main/java/org/apache/archiva/metadata/model/ProjectVersionMetadata.java +++ b/archiva-modules/metadata/metadata-model/src/main/java/org/apache/archiva/metadata/model/ProjectVersionMetadata.java @@ -56,6 +56,11 @@ public class ProjectVersionMetadata return id; } + public String getVersion() + { + return id; + } + public void setId( String id ) { this.id = id; @@ -146,9 +151,9 @@ public class ProjectVersionMetadata 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 ) @@ -156,12 +161,17 @@ public class ProjectVersionMetadata return this.facets.get( facetId ); } - public Collection getAllFacets() + public Map getFacets() + { + return facets; + } + + public Collection getFacetList() { return this.facets.values(); } - public Collection getAllFacetIds() + public Collection getFacetIds() { return this.facets.keySet(); } diff --git a/archiva-modules/plugins/metadata-repository-file/src/main/java/org/apache/archiva/metadata/repository/file/FileMetadataRepository.java b/archiva-modules/plugins/metadata-repository-file/src/main/java/org/apache/archiva/metadata/repository/file/FileMetadataRepository.java index bec509ae4..04fdf6915 100644 --- a/archiva-modules/plugins/metadata-repository-file/src/main/java/org/apache/archiva/metadata/repository/file/FileMetadataRepository.java +++ b/archiva-modules/plugins/metadata-repository-file/src/main/java/org/apache/archiva/metadata/repository/file/FileMetadataRepository.java @@ -176,8 +176,8 @@ public class FileMetadataRepository 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() ); } @@ -343,8 +343,8 @@ public class FileMetadataRepository if ( issueSystem != null || issueUrl != null ) { IssueManagement issueManagement = new IssueManagement(); - issueManagement.setSystem( ciSystem ); - issueManagement.setUrl( ciUrl ); + issueManagement.setSystem( issueSystem ); + issueManagement.setUrl( issueUrl ); versionMetadata.setIssueManagement( issueManagement ); } @@ -451,7 +451,7 @@ public class FileMetadataRepository } } - for ( ProjectVersionFacet facet : versionMetadata.getAllFacets() ) + for ( ProjectVersionFacet facet : versionMetadata.getFacetList() ) { properties.putAll( facet.toProperties() ); } -- 2.39.5