[MRM-145] index skins

git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@437144 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Porter 2006-08-26 11:25:57 +00:00
parent ceef0a10fd
commit 87fef8ad23
5 changed files with 62 additions and 0 deletions

View File

@ -81,6 +81,10 @@ public class StandardArtifactIndexRecordFactory
*/
protected Digester md5Digester;
private static final String SITE_TEMPLATE_NAME = "META-INF/maven/site.vm";
private static final String SITE_CSS_NAME = "css/maven-theme.css";
private static final String PLUGIN_METADATA_NAME = "META-INF/maven/plugin.xml";
private static final String ARCHETYPE_METADATA_NAME = "META-INF/maven/archetype.xml";
@ -236,6 +240,10 @@ public class StandardArtifactIndexRecordFactory
{
populateArchetypeEntries( record );
}
else if ( SITE_TEMPLATE_NAME.equals( name ) || SITE_CSS_NAME.equals( name ) )
{
populateSkinEntries( record );
}
}
}
@ -255,6 +263,12 @@ public class StandardArtifactIndexRecordFactory
record.setType( "maven-archetype" );
}
private void populateSkinEntries( StandardArtifactIndexRecord record )
{
// Typically discovered as a JAR
record.setType( "maven-skin" );
}
private Xpp3Dom readXmlMetadataFileInJar( File file, String name )
throws RepositoryIndexException
{

View File

@ -168,6 +168,12 @@ public class MinimalArtifactIndexRecordFactoryTest
record = factory.createRecord( artifact );
assertNull( "Check no record", record );
artifact = createArtifact( "test-skin", "1.0", "pom" );
record = factory.createRecord( artifact );
assertNull( "Check no record", record );
}
public void testIndexedPlugin()

View File

@ -254,6 +254,12 @@ public class StandardArtifactIndexRecordFactoryTest
record = factory.createRecord( artifact );
assertNull( "Check no record", record );
artifact = createArtifact( "test-skin", "1.0", "pom" );
record = factory.createRecord( artifact );
assertNull( "Check no record", record );
}
public void testIndexedPlugin()
@ -316,6 +322,34 @@ public class StandardArtifactIndexRecordFactoryTest
assertEquals( "check record", expectedRecord, record );
}
public void testIndexedSkin()
throws RepositoryIndexException, IOException, XmlPullParserException
{
Artifact artifact = createArtifact( "test-skin" );
RepositoryIndexRecord record = factory.createRecord( artifact );
StandardArtifactIndexRecord expectedRecord = new StandardArtifactIndexRecord();
expectedRecord.setMd5Checksum( "ba2d8a722f763db2950ad63119585f45" );
expectedRecord.setFilename( repository.pathOf( artifact ) );
expectedRecord.setLastModified( artifact.getFile().lastModified() );
expectedRecord.setSize( artifact.getFile().length() );
expectedRecord.setArtifactId( "test-skin" );
expectedRecord.setGroupId( TEST_GROUP_ID );
expectedRecord.setBaseVersion( "1.0" );
expectedRecord.setVersion( "1.0" );
expectedRecord.setSha1Checksum( "44855e3e56c18ce766db315a2d4c114d7a8c8ab0" );
expectedRecord.setType( "maven-skin" );
expectedRecord.setRepository( "test" );
expectedRecord.setFiles( Arrays.asList( new String[]{"META-INF/MANIFEST.MF", "css/maven-theme.css",
"META-INF/maven/org.apache.maven.skins/test-skin/pom.xml",
"META-INF/maven/org.apache.maven.skins/test-skin/pom.properties"} ) );
expectedRecord.setPackaging( "jar" );
expectedRecord.setProjectName( "Skin - test-skin" );
assertEquals( "check record", expectedRecord, record );
}
public void testCorruptJar()
throws RepositoryIndexException
{

View File

@ -0,0 +1,8 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.maven.archiva.record</groupId>
<artifactId>test-skin</artifactId>
<version>1.0</version>
<name>Skin - test-skin</name>
</project>