mirror of https://github.com/apache/archiva.git
[MRM-1283] handle missing Maven facet
git-svn-id: https://svn.apache.org/repos/asf/archiva/branches/MRM-1025@884147 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
f863666a3d
commit
9c2b960aea
|
@ -150,6 +150,8 @@ public class ShowArtifactAction
|
|||
// TODO: eventually, move to just use the metadata directly, with minimal JSP changes, mostly for Maven specifics
|
||||
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() );
|
||||
|
@ -161,6 +163,7 @@ public class ShowArtifactAction
|
|||
parent.setVersion( projectFacet.getParent().getVersion() );
|
||||
model.setParentProject( parent );
|
||||
}
|
||||
}
|
||||
|
||||
model.setVersion( versionMetadata.getId() );
|
||||
model.setDescription( versionMetadata.getDescription() );
|
||||
|
|
|
@ -308,6 +308,37 @@ public class ShowArtifactActionTest
|
|||
assertTrue( action.getSnapshotVersions().isEmpty() );
|
||||
}
|
||||
|
||||
public void testGetArtifactNoMavenFacet()
|
||||
{
|
||||
ProjectVersionMetadata versionMetadata = new ProjectVersionMetadata();
|
||||
versionMetadata.setId( TEST_VERSION );
|
||||
versionMetadata.setUrl( TEST_URL );
|
||||
versionMetadata.setName( TEST_NAME );
|
||||
versionMetadata.setDescription( TEST_DESCRIPTION );
|
||||
|
||||
metadataResolver.setProjectVersion( TEST_REPO, TEST_GROUP_ID, TEST_ARTIFACT_ID, versionMetadata );
|
||||
|
||||
setActionParameters();
|
||||
|
||||
String result = action.artifact();
|
||||
|
||||
assertActionSuccess( action, result );
|
||||
|
||||
assertActionParameters( action );
|
||||
ArchivaProjectModel model = action.getModel();
|
||||
assertEquals( TEST_VERSION, model.getVersion() );
|
||||
assertEquals( TEST_URL, model.getUrl() );
|
||||
assertEquals( TEST_NAME, model.getName() );
|
||||
assertEquals( TEST_DESCRIPTION, model.getDescription() );
|
||||
|
||||
assertEquals( TEST_REPO, action.getRepositoryId() );
|
||||
|
||||
assertNull( action.getDependees() );
|
||||
assertNull( action.getDependencies() );
|
||||
assertNull( action.getMailingLists() );
|
||||
assertTrue( action.getSnapshotVersions().isEmpty() );
|
||||
}
|
||||
|
||||
private void assertNoOutputFields()
|
||||
{
|
||||
assertNull( action.getModel() );
|
||||
|
|
Loading…
Reference in New Issue