aboutsummaryrefslogtreecommitdiffstats
path: root/archiva-indexer
diff options
context:
space:
mode:
authorBrett Porter <brett@apache.org>2006-08-26 11:25:57 +0000
committerBrett Porter <brett@apache.org>2006-08-26 11:25:57 +0000
commit87fef8ad23f6c4932e2c9a819a3d8121b9e7325e (patch)
treeaa68626427c7e85f8de03952eb6d6f31661c02ce /archiva-indexer
parentceef0a10fdc163f5ebc11cffc440cc174b04eedd (diff)
downloadarchiva-87fef8ad23f6c4932e2c9a819a3d8121b9e7325e.tar.gz
archiva-87fef8ad23f6c4932e2c9a819a3d8121b9e7325e.zip
[MRM-145] index skins
git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@437144 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-indexer')
-rw-r--r--archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/record/StandardArtifactIndexRecordFactory.java14
-rw-r--r--archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/record/MinimalArtifactIndexRecordFactoryTest.java6
-rw-r--r--archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/record/StandardArtifactIndexRecordFactoryTest.java34
-rw-r--r--archiva-indexer/src/test/managed-repository/org/apache/maven/archiva/record/test-skin/1.0/test-skin-1.0.jarbin0 -> 3475 bytes
-rw-r--r--archiva-indexer/src/test/managed-repository/org/apache/maven/archiva/record/test-skin/1.0/test-skin-1.0.pom8
5 files changed, 62 insertions, 0 deletions
diff --git a/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/record/StandardArtifactIndexRecordFactory.java b/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/record/StandardArtifactIndexRecordFactory.java
index d97a1d6cf..d4f67b3e4 100644
--- a/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/record/StandardArtifactIndexRecordFactory.java
+++ b/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/record/StandardArtifactIndexRecordFactory.java
@@ -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
{
diff --git a/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/record/MinimalArtifactIndexRecordFactoryTest.java b/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/record/MinimalArtifactIndexRecordFactoryTest.java
index a2aeba0b3..f40700f11 100644
--- a/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/record/MinimalArtifactIndexRecordFactoryTest.java
+++ b/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/record/MinimalArtifactIndexRecordFactoryTest.java
@@ -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()
diff --git a/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/record/StandardArtifactIndexRecordFactoryTest.java b/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/record/StandardArtifactIndexRecordFactoryTest.java
index 42ea5756a..3a425ca61 100644
--- a/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/record/StandardArtifactIndexRecordFactoryTest.java
+++ b/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/record/StandardArtifactIndexRecordFactoryTest.java
@@ -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
{
diff --git a/archiva-indexer/src/test/managed-repository/org/apache/maven/archiva/record/test-skin/1.0/test-skin-1.0.jar b/archiva-indexer/src/test/managed-repository/org/apache/maven/archiva/record/test-skin/1.0/test-skin-1.0.jar
new file mode 100644
index 000000000..99bd1e78b
--- /dev/null
+++ b/archiva-indexer/src/test/managed-repository/org/apache/maven/archiva/record/test-skin/1.0/test-skin-1.0.jar
Binary files differ
diff --git a/archiva-indexer/src/test/managed-repository/org/apache/maven/archiva/record/test-skin/1.0/test-skin-1.0.pom b/archiva-indexer/src/test/managed-repository/org/apache/maven/archiva/record/test-skin/1.0/test-skin-1.0.pom
new file mode 100644
index 000000000..2055446f6
--- /dev/null
+++ b/archiva-indexer/src/test/managed-repository/org/apache/maven/archiva/record/test-skin/1.0/test-skin-1.0.pom
@@ -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>