summaryrefslogtreecommitdiffstats
path: root/archiva-indexer
diff options
context:
space:
mode:
authorJoakim Erdfelt <joakime@apache.org>2007-03-22 21:12:12 +0000
committerJoakim Erdfelt <joakime@apache.org>2007-03-22 21:12:12 +0000
commit0314ca95cbd0580114688cb26179e47e7edb19a7 (patch)
treeb4ad7622fecffd7ea19691cefcd5da5727f70c34 /archiva-indexer
parentb2332f00ba4bcdc76aebaf03d93916faf132cbd8 (diff)
downloadarchiva-0314ca95cbd0580114688cb26179e47e7edb19a7.tar.gz
archiva-0314ca95cbd0580114688cb26179e47e7edb19a7.zip
More directory moves
git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/branches/archiva-jpox-database-refactor@521472 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-indexer')
-rw-r--r--archiva-indexer/pom.xml99
-rw-r--r--archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/RepositoryArtifactIndex.java152
-rw-r--r--archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/RepositoryArtifactIndexFactory.java51
-rw-r--r--archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/RepositoryIndexException.java37
-rw-r--r--archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/RepositoryIndexSearchException.java32
-rw-r--r--archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/lucene/LuceneIndexRecordConverter.java51
-rw-r--r--archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/lucene/LuceneMinimalIndexRecordConverter.java87
-rw-r--r--archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/lucene/LuceneQuery.java43
-rw-r--r--archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/lucene/LuceneRepositoryArtifactIndex.java604
-rw-r--r--archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/lucene/LuceneRepositoryArtifactIndexFactory.java45
-rw-r--r--archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/lucene/LuceneStandardIndexRecordConverter.java167
-rw-r--r--archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/query/CompoundQuery.java108
-rw-r--r--archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/query/CompoundQueryTerm.java103
-rw-r--r--archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/query/Query.java29
-rw-r--r--archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/query/QueryTerm.java64
-rw-r--r--archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/query/RangeQuery.java153
-rw-r--r--archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/query/SingleTermQuery.java65
-rw-r--r--archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/record/AbstractArtifactIndexRecordFactory.java101
-rw-r--r--archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/record/IndexRecordExistsArtifactFilter.java47
-rw-r--r--archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/record/MinimalArtifactIndexRecord.java173
-rw-r--r--archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/record/MinimalArtifactIndexRecordFactory.java105
-rw-r--r--archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/record/MinimalIndexRecordFields.java44
-rw-r--r--archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/record/RepositoryIndexRecord.java35
-rw-r--r--archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/record/RepositoryIndexRecordFactory.java47
-rw-r--r--archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/record/StandardArtifactIndexRecord.java412
-rw-r--r--archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/record/StandardArtifactIndexRecordFactory.java373
-rw-r--r--archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/record/StandardIndexRecordFields.java84
-rw-r--r--archiva-indexer/src/site/apt/design.apt153
-rw-r--r--archiva-indexer/src/site/site.xml27
-rw-r--r--archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/lucene/LuceneMinimalArtifactIndexSearchTest.java231
-rw-r--r--archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/lucene/LuceneMinimalArtifactIndexTest.java353
-rw-r--r--archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/lucene/LuceneStandardArtifactIndexSearchTest.java790
-rw-r--r--archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/lucene/LuceneStandardArtifactIndexTest.java409
-rw-r--r--archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/query/QueryTest.java159
-rw-r--r--archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/record/MinimalArtifactIndexRecordFactoryTest.java249
-rw-r--r--archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/record/StandardArtifactIndexRecordFactoryTest.java446
-rw-r--r--archiva-indexer/src/test/managed-repository/org/apache/maven/archiva/record/parent-pom/1/parent-pom-1.pom41
-rw-r--r--archiva-indexer/src/test/managed-repository/org/apache/maven/archiva/record/test-archetype/1.0/test-archetype-1.0.jarbin4371 -> 0 bytes
-rw-r--r--archiva-indexer/src/test/managed-repository/org/apache/maven/archiva/record/test-archetype/1.0/test-archetype-1.0.pom27
-rw-r--r--archiva-indexer/src/test/managed-repository/org/apache/maven/archiva/record/test-child-pom/1.0-SNAPSHOT/test-child-pom-1.0-20060728.121314-1.jarbin1408 -> 0 bytes
-rw-r--r--archiva-indexer/src/test/managed-repository/org/apache/maven/archiva/record/test-child-pom/1.0-SNAPSHOT/test-child-pom-1.0-20060728.121314-1.pom31
-rw-r--r--archiva-indexer/src/test/managed-repository/org/apache/maven/archiva/record/test-corrupt-jar/1.0/test-corrupt-jar-1.0.jar0
-rw-r--r--archiva-indexer/src/test/managed-repository/org/apache/maven/archiva/record/test-dll/1.0.1.34/test-dll-1.0.1.34.dll0
-rw-r--r--archiva-indexer/src/test/managed-repository/org/apache/maven/archiva/record/test-jar-and-pom/1.0-alpha-1/test-jar-and-pom-1.0-alpha-1-jdk14.jarbin1408 -> 0 bytes
-rw-r--r--archiva-indexer/src/test/managed-repository/org/apache/maven/archiva/record/test-jar-and-pom/1.0-alpha-1/test-jar-and-pom-1.0-alpha-1.jarbin1408 -> 0 bytes
-rw-r--r--archiva-indexer/src/test/managed-repository/org/apache/maven/archiva/record/test-jar-and-pom/1.0-alpha-1/test-jar-and-pom-1.0-alpha-1.pom50
-rw-r--r--archiva-indexer/src/test/managed-repository/org/apache/maven/archiva/record/test-jar/1.0/test-jar-1.0-jdk14.jarbin1408 -> 0 bytes
-rw-r--r--archiva-indexer/src/test/managed-repository/org/apache/maven/archiva/record/test-jar/1.0/test-jar-1.0.jarbin1408 -> 0 bytes
-rw-r--r--archiva-indexer/src/test/managed-repository/org/apache/maven/archiva/record/test-plugin/1.0/test-plugin-1.0.jarbin4402 -> 0 bytes
-rw-r--r--archiva-indexer/src/test/managed-repository/org/apache/maven/archiva/record/test-plugin/1.0/test-plugin-1.0.pom41
-rw-r--r--archiva-indexer/src/test/managed-repository/org/apache/maven/archiva/record/test-pom/1.0/test-pom-1.0.pom30
-rw-r--r--archiva-indexer/src/test/managed-repository/org/apache/maven/archiva/record/test-skin/1.0/test-skin-1.0.jarbin3475 -> 0 bytes
-rw-r--r--archiva-indexer/src/test/managed-repository/org/apache/maven/archiva/record/test-skin/1.0/test-skin-1.0.pom27
-rw-r--r--archiva-indexer/src/test/repository/org/apache/maven/maven-artifact/2.0.1/maven-artifact-2.0.1.jarbin78377 -> 0 bytes
-rw-r--r--archiva-indexer/src/test/repository/org/apache/maven/maven-artifact/2.0.1/maven-artifact-2.0.1.pom64
-rw-r--r--archiva-indexer/src/test/repository/org/apache/maven/maven-artifact/2.0.1/maven-metadata.xml25
-rw-r--r--archiva-indexer/src/test/repository/org/apache/maven/maven-artifact/maven-metadata.xml32
-rw-r--r--archiva-indexer/src/test/repository/org/apache/maven/maven-corrupt-jar/2.0/maven-corrupt-jar-2.0.jar0
-rw-r--r--archiva-indexer/src/test/repository/org/apache/maven/maven-corrupt-jar/2.0/maven-corrupt-jar-2.0.pom114
-rw-r--r--archiva-indexer/src/test/repository/org/apache/maven/maven-metadata.xml29
-rw-r--r--archiva-indexer/src/test/repository/org/apache/maven/maven-model/2.0/maven-model-2.0.jarbin78476 -> 0 bytes
-rw-r--r--archiva-indexer/src/test/repository/org/apache/maven/maven-model/2.0/maven-model-2.0.pom114
-rw-r--r--archiva-indexer/src/test/repository/test/inherited/test-inherited/1.0.15/test-inherited-1.0.15.pom30
-rw-r--r--archiva-indexer/src/test/repository/test/maven-metadata.xml29
-rw-r--r--archiva-indexer/src/test/repository/test/test-artifactId/1.0/test-artifactId-1.0.jarbin2467 -> 0 bytes
-rw-r--r--archiva-indexer/src/test/repository/test/test-artifactId/1.0/test-artifactId-1.0.pom25
66 files changed, 0 insertions, 6837 deletions
diff --git a/archiva-indexer/pom.xml b/archiva-indexer/pom.xml
deleted file mode 100644
index 10d2c366e..000000000
--- a/archiva-indexer/pom.xml
+++ /dev/null
@@ -1,99 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ 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.
- -->
-
-<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">
- <parent>
- <groupId>org.apache.maven.archiva</groupId>
- <artifactId>archiva</artifactId>
- <version>1.0-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>archiva-indexer</artifactId>
- <name>Archiva Indexer</name>
- <dependencies>
- <dependency>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-artifact</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-artifact-manager</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-project</artifactId>
- <exclusions>
- <exclusion>
- <groupId>org.codehaus.plexus.cache</groupId>
- <artifactId>plexus-cache-hashmap</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-model</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.lucene</groupId>
- <artifactId>lucene-core</artifactId>
- <version>2.0.0</version>
- </dependency>
- <dependency>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-utils</artifactId>
- </dependency>
- <dependency>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-container-default</artifactId>
- </dependency>
- <dependency>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-digest</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-repository-metadata</artifactId>
- </dependency>
- <dependency>
- <groupId>commons-lang</groupId>
- <artifactId>commons-lang</artifactId>
- </dependency>
- <dependency>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- </dependency>
- </dependencies>
- <build>
- <plugins>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>cobertura-maven-plugin</artifactId>
- <configuration>
- <check>
- <!-- TODO: increase coverage -->
- <totalLineRate>80</totalLineRate>
- <totalBranchRate>80</totalBranchRate>
- </check>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git a/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/RepositoryArtifactIndex.java b/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/RepositoryArtifactIndex.java
deleted file mode 100644
index b4bdbd4f7..000000000
--- a/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/RepositoryArtifactIndex.java
+++ /dev/null
@@ -1,152 +0,0 @@
-package org.apache.maven.archiva.indexer;
-
-/*
- * 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.
- */
-
-import org.apache.maven.archiva.indexer.query.Query;
-import org.apache.maven.archiva.indexer.record.RepositoryIndexRecordFactory;
-import org.apache.maven.artifact.Artifact;
-
-import java.util.Collection;
-import java.util.List;
-
-/**
- * Maintain an artifact index on the repository.
- *
- * @author <a href="mailto:brett@apache.org">Brett Porter</a>
- */
-public interface RepositoryArtifactIndex
-{
- /**
- * Indexes the artifacts found within the specified list of index records. If the artifacts are already in the
- * repository they are updated.
- *
- * @param records the records to index
- * @throws RepositoryIndexException if there is a problem indexing the records
- */
- void indexRecords( Collection records )
- throws RepositoryIndexException;
-
- /**
- * Search the index based on the search criteria specified. Returns a list of index records.
- *
- * @param query The query that contains the search criteria
- * @return the index records found
- * @throws RepositoryIndexSearchException if there is a problem searching
- * @todo should it return "SearchResult" instances that contain the index record and other search data (like score?)
- */
- List search( Query query )
- throws RepositoryIndexSearchException;
-
- /**
- * Check if the index already exists.
- *
- * @return true if the index already exists
- * @throws RepositoryIndexException if the index location is not valid
- */
- boolean exists()
- throws RepositoryIndexException;
-
- /**
- * Delete records from the index. Simply ignore the request any did not exist.
- *
- * @param records the records to delete
- * @throws RepositoryIndexException if there is a problem removing the record
- */
- void deleteRecords( Collection records )
- throws RepositoryIndexException;
-
- /**
- * Retrieve all records in the index.
- *
- * @return the records
- * @throws RepositoryIndexSearchException if there was an error searching the index
- */
- Collection getAllRecords()
- throws RepositoryIndexSearchException;
-
- /**
- * Retrieve all primary keys of records in the index.
- *
- * @return the keys
- * @throws RepositoryIndexException if there was an error searching the index
- */
- Collection getAllRecordKeys()
- throws RepositoryIndexException;
-
- /**
- * Indexes the artifact specified. If the artifact is already in the repository they it is updated.
- * This method should use less memory than indexRecords as the records can be created and disposed of on the fly.
- *
- * @param artifact the artifact to index
- * @param factory the artifact to record factory
- * @throws RepositoryIndexException if there is a problem indexing the artifacts
- */
- void indexArtifact( Artifact artifact, RepositoryIndexRecordFactory factory )
- throws RepositoryIndexException;
-
- /**
- * Indexes the artifacts found within the specified list. If the artifacts are already in the
- * repository they are updated. This method should use less memory than indexRecords as the records can be
- * created and disposed of on the fly.
- *
- * @param artifacts the artifacts to index
- * @param factory the artifact to record factory
- * @throws RepositoryIndexException if there is a problem indexing the artifacts
- */
- void indexArtifacts( List artifacts, RepositoryIndexRecordFactory factory )
- throws RepositoryIndexException;
-
- /**
- * Get all the group IDs in the index.
- *
- * @return list of groups as strings
- * @throws RepositoryIndexException if there is a problem searching for the group ID
- */
- List getAllGroupIds()
- throws RepositoryIndexException;
-
- /**
- * Get the list of artifact IDs in a group in the index.
- *
- * @param groupId the group ID to search
- * @return the list of artifact ID strings
- * @throws RepositoryIndexSearchException if there is a problem searching for the group ID
- */
- List getArtifactIds( String groupId )
- throws RepositoryIndexSearchException;
-
- /**
- * Get the list of available versions for a given artifact.
- *
- * @param groupId the group ID to search for
- * @param artifactId the artifact ID to search for
- * @return the list of version strings
- * @throws RepositoryIndexSearchException if there is a problem searching for the artifact
- */
- List getVersions( String groupId, String artifactId )
- throws RepositoryIndexSearchException;
-
- /**
- * Get the time when the index was last updated. Note that this does not monitor external processes.
- *
- * @return the last updated time, or 0 if it has not been updated since the class was instantiated.
- */
- long getLastUpdatedTime();
-}
diff --git a/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/RepositoryArtifactIndexFactory.java b/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/RepositoryArtifactIndexFactory.java
deleted file mode 100644
index e57604104..000000000
--- a/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/RepositoryArtifactIndexFactory.java
+++ /dev/null
@@ -1,51 +0,0 @@
-package org.apache.maven.archiva.indexer;
-
-/*
- * 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.
- */
-
-import java.io.File;
-
-/**
- * Obtain an index instance.
- *
- * @author <a href="mailto:brett@apache.org">Brett Porter</a>
- */
-public interface RepositoryArtifactIndexFactory
-{
- /**
- * Plexus role.
- */
- String ROLE = RepositoryArtifactIndexFactory.class.getName();
-
- /**
- * Method to create an instance of the standard index.
- *
- * @param indexPath the path where the index will be created/updated
- * @return the index instance
- */
- RepositoryArtifactIndex createStandardIndex( File indexPath );
-
- /**
- * Method to create an instance of the minimal index.
- *
- * @param indexPath the path where the index will be created/updated
- * @return the index instance
- */
- RepositoryArtifactIndex createMinimalIndex( File indexPath );
-}
diff --git a/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/RepositoryIndexException.java b/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/RepositoryIndexException.java
deleted file mode 100644
index bca043991..000000000
--- a/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/RepositoryIndexException.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package org.apache.maven.archiva.indexer;
-
-/*
- * 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.
- */
-
-/**
- * @author Edwin Punzalan
- */
-public class RepositoryIndexException
- extends Exception
-{
- public RepositoryIndexException( String message, Throwable cause )
- {
- super( message, cause );
- }
-
- public RepositoryIndexException( String message )
- {
- super( message );
- }
-}
diff --git a/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/RepositoryIndexSearchException.java b/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/RepositoryIndexSearchException.java
deleted file mode 100644
index c8be03b9c..000000000
--- a/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/RepositoryIndexSearchException.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package org.apache.maven.archiva.indexer;
-
-/*
- * 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.
- */
-
-/**
- * @author Brett Porter
- */
-public class RepositoryIndexSearchException
- extends Exception
-{
- public RepositoryIndexSearchException( String message, Throwable cause )
- {
- super( message, cause );
- }
-}
diff --git a/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/lucene/LuceneIndexRecordConverter.java b/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/lucene/LuceneIndexRecordConverter.java
deleted file mode 100644
index 4f67b7006..000000000
--- a/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/lucene/LuceneIndexRecordConverter.java
+++ /dev/null
@@ -1,51 +0,0 @@
-package org.apache.maven.archiva.indexer.lucene;
-
-/*
- * 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.
- */
-
-import org.apache.lucene.document.Document;
-import org.apache.maven.archiva.indexer.record.RepositoryIndexRecord;
-
-import java.text.ParseException;
-
-/**
- * Converts repository records to Lucene documents.
- *
- * @author <a href="mailto:brett@apache.org">Brett Porter</a>
- */
-public interface LuceneIndexRecordConverter
-{
- /**
- * Convert an index record to a Lucene document.
- *
- * @param record the record
- * @return the document
- */
- Document convert( RepositoryIndexRecord record );
-
- /**
- * Convert a Lucene document to an index record.
- *
- * @param document the document
- * @return the record
- * @throws java.text.ParseException if there is a problem parsing a field (specifically, dates)
- */
- RepositoryIndexRecord convert( Document document )
- throws ParseException;
-}
diff --git a/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/lucene/LuceneMinimalIndexRecordConverter.java b/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/lucene/LuceneMinimalIndexRecordConverter.java
deleted file mode 100644
index 6130e888e..000000000
--- a/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/lucene/LuceneMinimalIndexRecordConverter.java
+++ /dev/null
@@ -1,87 +0,0 @@
-package org.apache.maven.archiva.indexer.lucene;
-
-/*
- * 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.
- */
-
-import org.apache.commons.lang.StringUtils;
-import org.apache.lucene.document.DateTools;
-import org.apache.lucene.document.Document;
-import org.apache.lucene.document.Field;
-import org.apache.lucene.document.NumberTools;
-import org.apache.maven.archiva.indexer.record.MinimalArtifactIndexRecord;
-import org.apache.maven.archiva.indexer.record.MinimalIndexRecordFields;
-import org.apache.maven.archiva.indexer.record.RepositoryIndexRecord;
-
-import java.text.ParseException;
-import java.util.Arrays;
-
-/**
- * Convert the minimal index record to a Lucene document.
- *
- * @author <a href="mailto:brett@apache.org">Brett Porter</a>
- */
-public class LuceneMinimalIndexRecordConverter
- implements LuceneIndexRecordConverter
-{
- public Document convert( RepositoryIndexRecord record )
- {
- MinimalArtifactIndexRecord rec = (MinimalArtifactIndexRecord) record;
-
- Document document = new Document();
- addTokenizedField( document, MinimalIndexRecordFields.FILENAME, rec.getFilename() );
- addUntokenizedField( document, MinimalIndexRecordFields.LAST_MODIFIED,
- DateTools.timeToString( rec.getLastModified(), DateTools.Resolution.SECOND ) );
- addUntokenizedField( document, MinimalIndexRecordFields.FILE_SIZE, NumberTools.longToString( rec.getSize() ) );
- addUntokenizedField( document, MinimalIndexRecordFields.MD5, rec.getMd5Checksum() );
- addTokenizedField( document, MinimalIndexRecordFields.CLASSES,
- StringUtils.join( rec.getClasses().iterator(), "\n" ) );
-
- return document;
- }
-
- public RepositoryIndexRecord convert( Document document )
- throws ParseException
- {
- MinimalArtifactIndexRecord record = new MinimalArtifactIndexRecord();
-
- record.setFilename( document.get( MinimalIndexRecordFields.FILENAME ) );
- record.setLastModified( DateTools.stringToTime( document.get( MinimalIndexRecordFields.LAST_MODIFIED ) ) );
- record.setSize( NumberTools.stringToLong( document.get( MinimalIndexRecordFields.FILE_SIZE ) ) );
- record.setMd5Checksum( document.get( MinimalIndexRecordFields.MD5 ) );
- record.setClasses( Arrays.asList( document.get( MinimalIndexRecordFields.CLASSES ).split( "\n" ) ) );
-
- return record;
- }
-
- private static void addUntokenizedField( Document document, String name, String value )
- {
- if ( value != null )
- {
- document.add( new Field( name, value, Field.Store.YES, Field.Index.UN_TOKENIZED ) );
- }
- }
-
- private static void addTokenizedField( Document document, String name, String value )
- {
- if ( value != null )
- {
- document.add( new Field( name, value, Field.Store.YES, Field.Index.TOKENIZED ) );
- }
- }
-}
diff --git a/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/lucene/LuceneQuery.java b/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/lucene/LuceneQuery.java
deleted file mode 100644
index 3c23fecc1..000000000
--- a/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/lucene/LuceneQuery.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package org.apache.maven.archiva.indexer.lucene;
-
-/*
- * 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.
- */
-
-import org.apache.maven.archiva.indexer.query.Query;
-
-/**
- * A holder for a lucene query to pass to the indexer API.
- *
- * @author <a href="mailto:brett@apache.org">Brett Porter</a>
- */
-public class LuceneQuery
- implements Query
-{
- private final org.apache.lucene.search.Query query;
-
- public LuceneQuery( org.apache.lucene.search.Query query )
- {
- this.query = query;
- }
-
- org.apache.lucene.search.Query getLuceneQuery()
- {
- return query;
- }
-}
diff --git a/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/lucene/LuceneRepositoryArtifactIndex.java b/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/lucene/LuceneRepositoryArtifactIndex.java
deleted file mode 100644
index c0a02935d..000000000
--- a/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/lucene/LuceneRepositoryArtifactIndex.java
+++ /dev/null
@@ -1,604 +0,0 @@
-package org.apache.maven.archiva.indexer.lucene;
-
-/*
- * 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.
- */
-
-import org.apache.lucene.analysis.Analyzer;
-import org.apache.lucene.analysis.CharTokenizer;
-import org.apache.lucene.analysis.TokenStream;
-import org.apache.lucene.analysis.standard.StandardAnalyzer;
-import org.apache.lucene.document.Document;
-import org.apache.lucene.document.Field;
-import org.apache.lucene.index.IndexModifier;
-import org.apache.lucene.index.IndexReader;
-import org.apache.lucene.index.IndexWriter;
-import org.apache.lucene.index.Term;
-import org.apache.lucene.index.TermEnum;
-import org.apache.lucene.search.BooleanClause;
-import org.apache.lucene.search.BooleanQuery;
-import org.apache.lucene.search.Hits;
-import org.apache.lucene.search.IndexSearcher;
-import org.apache.lucene.search.MatchAllDocsQuery;
-import org.apache.lucene.search.TermQuery;
-import org.apache.maven.archiva.indexer.RepositoryArtifactIndex;
-import org.apache.maven.archiva.indexer.RepositoryIndexException;
-import org.apache.maven.archiva.indexer.RepositoryIndexSearchException;
-import org.apache.maven.archiva.indexer.query.Query;
-import org.apache.maven.archiva.indexer.record.MinimalIndexRecordFields;
-import org.apache.maven.archiva.indexer.record.RepositoryIndexRecord;
-import org.apache.maven.archiva.indexer.record.RepositoryIndexRecordFactory;
-import org.apache.maven.archiva.indexer.record.StandardIndexRecordFields;
-import org.apache.maven.artifact.Artifact;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.Reader;
-import java.text.ParseException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Set;
-
-/**
- * Lucene implementation of a repository index.
- *
- * @author <a href="mailto:brett@apache.org">Brett Porter</a>
- */
-public class LuceneRepositoryArtifactIndex
- implements RepositoryArtifactIndex
-{
- /**
- * The location of the index on the file system.
- */
- private File indexLocation;
-
- /**
- * Convert repository records to Lucene documents.
- */
- private LuceneIndexRecordConverter converter;
-
- private static final String FLD_PK = "pk";
-
- private static Analyzer luceneAnalyzer = new LuceneAnalyzer();
-
- private static long lastUpdatedTime = 0;
-
- public LuceneRepositoryArtifactIndex( File indexPath, LuceneIndexRecordConverter converter )
- {
- this.indexLocation = indexPath;
- this.converter = converter;
- }
-
- public void indexRecords( Collection records )
- throws RepositoryIndexException
- {
- deleteRecords( records );
-
- addRecords( records );
- }
-
- private void addRecords( Collection records )
- throws RepositoryIndexException
- {
- IndexWriter indexWriter;
- try
- {
- indexWriter = new IndexWriter( indexLocation, getAnalyzer(), !exists() );
- }
- catch ( IOException e )
- {
- throw new RepositoryIndexException( "Unable to open index", e );
- }
-
- try
- {
- for ( Iterator i = records.iterator(); i.hasNext(); )
- {
- RepositoryIndexRecord record = (RepositoryIndexRecord) i.next();
-
- if ( record != null )
- {
- Document document = converter.convert( record );
- document.add(
- new Field( FLD_PK, record.getPrimaryKey(), Field.Store.NO, Field.Index.UN_TOKENIZED ) );
-
- indexWriter.addDocument( document );
- }
- }
-
- indexWriter.optimize();
- }
- catch ( IOException e )
- {
- throw new RepositoryIndexException( "Failed to add an index document", e );
- }
- finally
- {
- closeQuietly( indexWriter );
- lastUpdatedTime = System.currentTimeMillis();
- }
- }
-
- public static Analyzer getAnalyzer()
- {
- return luceneAnalyzer;
- }
-
- private static class LuceneAnalyzer
- extends Analyzer
- {
- private static final Analyzer STANDARD = new StandardAnalyzer();
-
- public TokenStream tokenStream( String field, final Reader reader )
- {
- // do not tokenize field called 'element'
- if ( StandardIndexRecordFields.DEPENDENCIES.equals( field ) )
- {
- return new CharTokenizer( reader )
- {
- protected boolean isTokenChar( char c )
- {
- return c != '\n';
- }
- };
- }
- else if ( StandardIndexRecordFields.FILES.equals( field ) )
- {
- return new CharTokenizer( reader )
- {
- protected boolean isTokenChar( char c )
- {
- return c != '\n' && c != '/';
- }
- };
- }
- else
- if ( StandardIndexRecordFields.CLASSES.equals( field ) || MinimalIndexRecordFields.CLASSES.equals( field ) )
- {
- return new CharTokenizer( reader )
- {
- protected boolean isTokenChar( char c )
- {
- return c != '\n' && c != '.';
- }
-
- protected char normalize( char c )
- {
- return Character.toLowerCase( c );
- }
- };
- }
- else if ( StandardIndexRecordFields.GROUPID.equals( field ) )
- {
- return new CharTokenizer( reader )
- {
- protected boolean isTokenChar( char c )
- {
- return c != '.';
- }
-
- protected char normalize( char c )
- {
- return Character.toLowerCase( c );
- }
- };
- }
- else if ( StandardIndexRecordFields.VERSION.equals( field ) ||
- StandardIndexRecordFields.BASE_VERSION.equals( field ) )
- {
- return new CharTokenizer( reader )
- {
- protected boolean isTokenChar( char c )
- {
- return c != '-';
- }
- };
- }
- else if ( StandardIndexRecordFields.FILENAME.equals( field ) ||
- MinimalIndexRecordFields.FILENAME.equals( field ) )
- {
- return new CharTokenizer( reader )
- {
- protected boolean isTokenChar( char c )
- {
- return c != '-' && c != '.' && c != '/';
- }
- };
- }
- else
- {
- // use standard analyzer
- return STANDARD.tokenStream( field, reader );
- }
- }
- }
-
- public void deleteRecords( Collection records )
- throws RepositoryIndexException
- {
- if ( exists() )
- {
- IndexReader indexReader = null;
- try
- {
- indexReader = IndexReader.open( indexLocation );
-
- for ( Iterator i = records.iterator(); i.hasNext(); )
- {
- RepositoryIndexRecord record = (RepositoryIndexRecord) i.next();
-
- if ( record != null )
- {
- Term term = new Term( FLD_PK, record.getPrimaryKey() );
-
- indexReader.deleteDocuments( term );
- }
- }
- }
- catch ( IOException e )
- {
- throw new RepositoryIndexException( "Error deleting document: " + e.getMessage(), e );
- }
- finally
- {
- closeQuietly( indexReader );
- }
- }
- }
-
- public Collection getAllRecords()
- throws RepositoryIndexSearchException
- {
- return search( new LuceneQuery( new MatchAllDocsQuery() ) );
- }
-
- public Collection getAllRecordKeys()
- throws RepositoryIndexException
- {
- return getAllFieldValues( FLD_PK );
- }
-
- private List getAllFieldValues( String fieldName )
- throws RepositoryIndexException
- {
- List keys = new ArrayList();
-
- if ( exists() )
- {
- IndexReader indexReader = null;
- TermEnum terms = null;
- try
- {
- indexReader = IndexReader.open( indexLocation );
-
- terms = indexReader.terms( new Term( fieldName, "" ) );
- while ( fieldName.equals( terms.term().field() ) )
- {
- keys.add( terms.term().text() );
-
- if ( !terms.next() )
- {
- break;
- }
- }
- }
- catch ( IOException e )
- {
- throw new RepositoryIndexException( "Error deleting document: " + e.getMessage(), e );
- }
- finally
- {
- closeQuietly( indexReader );
- closeQuietly( terms );
- }
- }
- return keys;
- }
-
- public void indexArtifacts( List artifacts, RepositoryIndexRecordFactory factory )
- throws RepositoryIndexException
- {
- IndexModifier indexModifier = null;
- try
- {
- indexModifier = new IndexModifier( indexLocation, getAnalyzer(), !exists() );
-
- for ( Iterator i = artifacts.iterator(); i.hasNext(); )
- {
- Artifact artifact = (Artifact) i.next();
- RepositoryIndexRecord record = factory.createRecord( artifact );
-
- if ( record != null )
- {
- Term term = new Term( FLD_PK, record.getPrimaryKey() );
-
- indexModifier.deleteDocuments( term );
-
- Document document = converter.convert( record );
- document.add(
- new Field( FLD_PK, record.getPrimaryKey(), Field.Store.NO, Field.Index.UN_TOKENIZED ) );
-
- indexModifier.addDocument( document );
- }
- }
- indexModifier.optimize();
- }
- catch ( IOException e )
- {
- throw new RepositoryIndexException( "Error updating index: " + e.getMessage(), e );
- }
- finally
- {
- closeQuietly( indexModifier );
- lastUpdatedTime = System.currentTimeMillis();
- }
- }
-
- public void indexArtifact( Artifact artifact, RepositoryIndexRecordFactory factory )
- throws RepositoryIndexException
- {
- IndexModifier indexModifier = null;
- try
- {
- indexModifier = new IndexModifier( indexLocation, getAnalyzer(), !exists() );
-
- RepositoryIndexRecord record = factory.createRecord( artifact );
-
- if ( record != null )
- {
- Term term = new Term( FLD_PK, record.getPrimaryKey() );
-
- indexModifier.deleteDocuments( term );
-
- Document document = converter.convert( record );
- document.add( new Field( FLD_PK, record.getPrimaryKey(), Field.Store.NO, Field.Index.UN_TOKENIZED ) );
-
- indexModifier.addDocument( document );
- }
- indexModifier.optimize();
- }
- catch ( IOException e )
- {
- throw new RepositoryIndexException( "Error updating index: " + e.getMessage(), e );
- }
- finally
- {
- closeQuietly( indexModifier );
- lastUpdatedTime = System.currentTimeMillis();
- }
- }
-
- public List getAllGroupIds()
- throws RepositoryIndexException
- {
- return getAllFieldValues( StandardIndexRecordFields.GROUPID_EXACT );
- }
-
- public List getArtifactIds( String groupId )
- throws RepositoryIndexSearchException
- {
- return searchField( new TermQuery( new Term( StandardIndexRecordFields.GROUPID_EXACT, groupId ) ),
- StandardIndexRecordFields.ARTIFACTID );
- }
-
- public List getVersions( String groupId, String artifactId )
- throws RepositoryIndexSearchException
- {
- BooleanQuery query = new BooleanQuery();
- query.add( new TermQuery( new Term( StandardIndexRecordFields.GROUPID_EXACT, groupId ) ),
- BooleanClause.Occur.MUST );
- query.add( new TermQuery( new Term( StandardIndexRecordFields.ARTIFACTID_EXACT, artifactId ) ),
- BooleanClause.Occur.MUST );
-
- return searchField( query, StandardIndexRecordFields.VERSION );
- }
-
- public long getLastUpdatedTime()
- {
- return lastUpdatedTime;
- }
-
- private List searchField( org.apache.lucene.search.Query luceneQuery, String fieldName )
- throws RepositoryIndexSearchException
- {
- Set results = new LinkedHashSet();
-
- IndexSearcher searcher;
- try
- {
- searcher = new IndexSearcher( indexLocation.getAbsolutePath() );
- }
- catch ( IOException e )
- {
- throw new RepositoryIndexSearchException( "Unable to open index: " + e.getMessage(), e );
- }
-
- try
- {
- Hits hits = searcher.search( luceneQuery );
- for ( int i = 0; i < hits.length(); i++ )
- {
- Document doc = hits.doc( i );
-
- results.add( doc.get( fieldName ) );
- }
- }
- catch ( IOException e )
- {
- throw new RepositoryIndexSearchException( "Unable to search index: " + e.getMessage(), e );
- }
- finally
- {
- closeQuietly( searcher );
- }
- return new ArrayList( results );
- }
-
- public boolean exists()
- throws RepositoryIndexException
- {
- if ( IndexReader.indexExists( indexLocation ) )
- {
- return true;
- }
- else if ( !indexLocation.exists() )
- {
- return false;
- }
- else if ( indexLocation.isDirectory() )
- {
- if ( indexLocation.listFiles().length > 1 )
- {
- throw new RepositoryIndexException( indexLocation + " is not a valid index directory." );
- }
- else
- {
- return false;
- }
- }
- else
- {
- throw new RepositoryIndexException( indexLocation + " is not a directory." );
- }
- }
-
- public List search( Query query )
- throws RepositoryIndexSearchException
- {
- LuceneQuery lQuery = (LuceneQuery) query;
-
- org.apache.lucene.search.Query luceneQuery = lQuery.getLuceneQuery();
-
- IndexSearcher searcher;
- try
- {
- searcher = new IndexSearcher( indexLocation.getAbsolutePath() );
- }
- catch ( IOException e )
- {
- throw new RepositoryIndexSearchException( "Unable to open index: " + e.getMessage(), e );
- }
-
- List records = new ArrayList();
- try
- {
- Hits hits = searcher.search( luceneQuery );
- for ( int i = 0; i < hits.length(); i++ )
- {
- Document doc = hits.doc( i );
-
- records.add( converter.convert( doc ) );
- }
- }
- catch ( IOException e )
- {
- throw new RepositoryIndexSearchException( "Unable to search index: " + e.getMessage(), e );
- }
- catch ( ParseException e )
- {
- throw new RepositoryIndexSearchException( "Unable to search index: " + e.getMessage(), e );
- }
- finally
- {
- closeQuietly( searcher );
- }
-
- return records;
- }
-
- private static void closeQuietly( IndexSearcher searcher )
- {
- try
- {
- if ( searcher != null )
- {
- searcher.close();
- }
- }
- catch ( IOException e )
- {
- // ignore
- }
- }
-
- private static void closeQuietly( TermEnum terms )
- throws RepositoryIndexException
- {
- if ( terms != null )
- {
- try
- {
- terms.close();
- }
- catch ( IOException e )
- {
- // ignore
- }
- }
- }
-
- private static void closeQuietly( IndexWriter indexWriter )
- throws RepositoryIndexException
- {
- try
- {
- if ( indexWriter != null )
- {
- indexWriter.close();
- }
- }
- catch ( IOException e )
- {
- // write should compain if it can't be closed, data probably not persisted
- throw new RepositoryIndexException( e.getMessage(), e );
- }
- }
-
- private static void closeQuietly( IndexModifier indexModifier )
- {
- if ( indexModifier != null )
- {
- try
- {
- indexModifier.close();
- }
- catch ( IOException e )
- {
- // ignore
- }
- }
- }
-
- private static void closeQuietly( IndexReader reader )
- {
- try
- {
- if ( reader != null )
- {
- reader.close();
- }
- }
- catch ( IOException e )
- {
- // ignore
- }
- }
-}
diff --git a/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/lucene/LuceneRepositoryArtifactIndexFactory.java b/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/lucene/LuceneRepositoryArtifactIndexFactory.java
deleted file mode 100644
index fae73a535..000000000
--- a/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/lucene/LuceneRepositoryArtifactIndexFactory.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package org.apache.maven.archiva.indexer.lucene;
-
-/*
- * 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.
- */
-
-import org.apache.maven.archiva.indexer.RepositoryArtifactIndex;
-import org.apache.maven.archiva.indexer.RepositoryArtifactIndexFactory;
-
-import java.io.File;
-
-/**
- * Factory for Lucene artifact index instances.
- *
- * @author <a href="mailto:brett@apache.org">Brett Porter</a>
- * @plexus.component role="org.apache.maven.archiva.indexer.RepositoryArtifactIndexFactory" role-hint="lucene"
- */
-public class LuceneRepositoryArtifactIndexFactory
- implements RepositoryArtifactIndexFactory
-{
- public RepositoryArtifactIndex createStandardIndex( File indexPath )
- {
- return new LuceneRepositoryArtifactIndex( indexPath, new LuceneStandardIndexRecordConverter() );
- }
-
- public RepositoryArtifactIndex createMinimalIndex( File indexPath )
- {
- return new LuceneRepositoryArtifactIndex( indexPath, new LuceneMinimalIndexRecordConverter() );
- }
-}
diff --git a/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/lucene/LuceneStandardIndexRecordConverter.java b/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/lucene/LuceneStandardIndexRecordConverter.java
deleted file mode 100644
index 34b1214c7..000000000
--- a/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/lucene/LuceneStandardIndexRecordConverter.java
+++ /dev/null
@@ -1,167 +0,0 @@
-package org.apache.maven.archiva.indexer.lucene;
-
-/*
- * 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.
- */
-
-import org.apache.commons.lang.StringUtils;
-import org.apache.lucene.document.DateTools;
-import org.apache.lucene.document.Document;
-import org.apache.lucene.document.Field;
-import org.apache.lucene.document.NumberTools;
-import org.apache.maven.archiva.indexer.record.RepositoryIndexRecord;
-import org.apache.maven.archiva.indexer.record.StandardArtifactIndexRecord;
-import org.apache.maven.archiva.indexer.record.StandardIndexRecordFields;
-
-import java.text.ParseException;
-import java.util.Arrays;
-
-/**
- * Convert the standard index record to a Lucene document.
- *
- * @author <a href="mailto:brett@apache.org">Brett Porter</a>
- */
-public class LuceneStandardIndexRecordConverter
- implements LuceneIndexRecordConverter
-{
- public Document convert( RepositoryIndexRecord record )
- {
- StandardArtifactIndexRecord rec = (StandardArtifactIndexRecord) record;
-
- Document document = new Document();
- addTokenizedField( document, StandardIndexRecordFields.FILENAME, rec.getFilename() );
- addTokenizedField( document, StandardIndexRecordFields.GROUPID, rec.getGroupId() );
- addExactField( document, StandardIndexRecordFields.GROUPID_EXACT, rec.getGroupId() );
- addTokenizedField( document, StandardIndexRecordFields.ARTIFACTID, rec.getArtifactId() );
- addExactField( document, StandardIndexRecordFields.ARTIFACTID_EXACT, rec.getArtifactId() );
- addTokenizedField( document, StandardIndexRecordFields.VERSION, rec.getVersion() );
- addExactField( document, StandardIndexRecordFields.VERSION_EXACT, rec.getVersion() );
- addTokenizedField( document, StandardIndexRecordFields.BASE_VERSION, rec.getBaseVersion() );
- addExactField( document, StandardIndexRecordFields.BASE_VERSION_EXACT, rec.getBaseVersion() );
- addUntokenizedField( document, StandardIndexRecordFields.TYPE, rec.getType() );
- addTokenizedField( document, StandardIndexRecordFields.CLASSIFIER, rec.getClassifier() );
- addUntokenizedField( document, StandardIndexRecordFields.PACKAGING, rec.getPackaging() );
- addUntokenizedField( document, StandardIndexRecordFields.REPOSITORY, rec.getRepository() );
- addUntokenizedField( document, StandardIndexRecordFields.LAST_MODIFIED,
- DateTools.timeToString( rec.getLastModified(), DateTools.Resolution.SECOND ) );
- addUntokenizedField( document, StandardIndexRecordFields.FILE_SIZE, NumberTools.longToString( rec.getSize() ) );
- addUntokenizedField( document, StandardIndexRecordFields.MD5, rec.getMd5Checksum() );
- addUntokenizedField( document, StandardIndexRecordFields.SHA1, rec.getSha1Checksum() );
- if ( rec.getClasses() != null )
- {
- addTokenizedField( document, StandardIndexRecordFields.CLASSES,
- StringUtils.join( rec.getClasses().iterator(), "\n" ) );
- }
- if ( rec.getFiles() != null )
- {
- addTokenizedField( document, StandardIndexRecordFields.FILES,
- StringUtils.join( rec.getFiles().iterator(), "\n" ) );
- }
- addUntokenizedField( document, StandardIndexRecordFields.PLUGIN_PREFIX, rec.getPluginPrefix() );
- addUntokenizedField( document, StandardIndexRecordFields.INCEPTION_YEAR, rec.getInceptionYear() );
- addTokenizedField( document, StandardIndexRecordFields.PROJECT_NAME, rec.getProjectName() );
- addTokenizedField( document, StandardIndexRecordFields.PROJECT_DESCRIPTION, rec.getProjectDescription() );
- if ( rec.getDependencies() != null )
- {
- addTokenizedField( document, StandardIndexRecordFields.DEPENDENCIES,
- StringUtils.join( rec.getDependencies().iterator(), "\n" ) );
- }
- if ( rec.getDevelopers() != null )
- {
- addTokenizedField( document, StandardIndexRecordFields.DEVELOPERS,
- StringUtils.join( rec.getDevelopers().iterator(), "\n" ) );
- }
-/* TODO: add later
- document.add( Field.Keyword( StandardIndexRecordFields.FLD_LICENSE_URLS, "" ) );
- document.add( Field.Keyword( StandardIndexRecordFields.FLD_PLUGINS_REPORT, "" ) );
- document.add( Field.Keyword( StandardIndexRecordFields.FLD_PLUGINS_BUILD, "" ) );
-*/
-
- return document;
- }
-
- public RepositoryIndexRecord convert( Document document )
- throws ParseException
- {
- StandardArtifactIndexRecord record = new StandardArtifactIndexRecord();
-
- record.setFilename( document.get( StandardIndexRecordFields.FILENAME ) );
- record.setGroupId( document.get( StandardIndexRecordFields.GROUPID ) );
- record.setArtifactId( document.get( StandardIndexRecordFields.ARTIFACTID ) );
- record.setVersion( document.get( StandardIndexRecordFields.VERSION ) );
- record.setBaseVersion( document.get( StandardIndexRecordFields.BASE_VERSION ) );
- record.setType( document.get( StandardIndexRecordFields.TYPE ) );
- record.setClassifier( document.get( StandardIndexRecordFields.CLASSIFIER ) );
- record.setPackaging( document.get( StandardIndexRecordFields.PACKAGING ) );
- record.setRepository( document.get( StandardIndexRecordFields.REPOSITORY ) );
- record.setLastModified( DateTools.stringToTime( document.get( StandardIndexRecordFields.LAST_MODIFIED ) ) );
- record.setSize( NumberTools.stringToLong( document.get( StandardIndexRecordFields.FILE_SIZE ) ) );
- record.setMd5Checksum( document.get( StandardIndexRecordFields.MD5 ) );
- record.setSha1Checksum( document.get( StandardIndexRecordFields.SHA1 ) );
- String classes = document.get( StandardIndexRecordFields.CLASSES );
- if ( classes != null )
- {
- record.setClasses( Arrays.asList( classes.split( "\n" ) ) );
- }
- String files = document.get( StandardIndexRecordFields.FILES );
- if ( files != null )
- {
- record.setFiles( Arrays.asList( files.split( "\n" ) ) );
- }
- String dependencies = document.get( StandardIndexRecordFields.DEPENDENCIES );
- if ( dependencies != null )
- {
- record.setDependencies( Arrays.asList( dependencies.split( "\n" ) ) );
- }
- String developers = document.get( StandardIndexRecordFields.DEVELOPERS );
- if ( developers != null )
- {
- record.setDevelopers( Arrays.asList( developers.split( "\n" ) ) );
- }
- record.setPluginPrefix( document.get( StandardIndexRecordFields.PLUGIN_PREFIX ) );
- record.setInceptionYear( document.get( StandardIndexRecordFields.INCEPTION_YEAR ) );
- record.setProjectName( document.get( StandardIndexRecordFields.PROJECT_NAME ) );
- record.setProjectDescription( document.get( StandardIndexRecordFields.PROJECT_DESCRIPTION ) );
-
- return record;
- }
-
- private static void addUntokenizedField( Document document, String name, String value )
- {
- if ( value != null )
- {
- document.add( new Field( name, value, Field.Store.YES, Field.Index.UN_TOKENIZED ) );
- }
- }
-
- private static void addExactField( Document document, String name, String value )
- {
- if ( value != null )
- {
- document.add( new Field( name, value, Field.Store.NO, Field.Index.UN_TOKENIZED ) );
- }
- }
-
- private static void addTokenizedField( Document document, String name, String value )
- {
- if ( value != null )
- {
- document.add( new Field( name, value, Field.Store.YES, Field.Index.TOKENIZED ) );
- }
- }
-}
diff --git a/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/query/CompoundQuery.java b/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/query/CompoundQuery.java
deleted file mode 100644
index b3fb6ce1a..000000000
--- a/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/query/CompoundQuery.java
+++ /dev/null
@@ -1,108 +0,0 @@
-package org.apache.maven.archiva.indexer.query;
-
-/*
- * 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.
- */
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Class to hold multiple SinglePhraseQueries and/or other CompoundQueries.
- *
- * @author Edwin Punzalan
- */
-public class CompoundQuery
- implements Query
-{
- /**
- * The query terms.
- */
- private final List compoundQueryTerms = new ArrayList();
-
- /**
- * Appends a required term to this query.
- *
- * @param term the term to be appended to this query
- */
- public void and( QueryTerm term )
- {
- compoundQueryTerms.add( CompoundQueryTerm.and( new SingleTermQuery( term ) ) );
- }
-
- /**
- * Appends an optional term to this query.
- *
- * @param term the term to be appended to this query
- */
- public void or( QueryTerm term )
- {
- compoundQueryTerms.add( CompoundQueryTerm.or( new SingleTermQuery( term ) ) );
- }
-
- /**
- * Appends a prohibited term to this query.
- *
- * @param term the term to be appended to this query
- */
- public void not( QueryTerm term )
- {
- compoundQueryTerms.add( CompoundQueryTerm.not( new SingleTermQuery( term ) ) );
- }
-
- /**
- * Appends a required subquery to this query.
- *
- * @param query the subquery to be appended to this query
- */
- public void and( Query query )
- {
- compoundQueryTerms.add( CompoundQueryTerm.and( query ) );
- }
-
- /**
- * Appends an optional subquery to this query.
- *
- * @param query the subquery to be appended to this query
- */
- public void or( Query query )
- {
- compoundQueryTerms.add( CompoundQueryTerm.or( query ) );
- }
-
- /**
- * Appends a prohibited subquery to this query.
- *
- * @param query the subquery to be appended to this query
- */
- public void not( Query query )
- {
- compoundQueryTerms.add( CompoundQueryTerm.not( query ) );
- }
-
- /**
- * Method to get the List of Queries appended into this
- *
- * @return List of all Queries added to this Query
- */
- public List getCompoundQueryTerms()
- {
- return compoundQueryTerms;
- }
-
-}
diff --git a/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/query/CompoundQueryTerm.java b/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/query/CompoundQueryTerm.java
deleted file mode 100644
index 434e487a2..000000000
--- a/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/query/CompoundQueryTerm.java
+++ /dev/null
@@ -1,103 +0,0 @@
-package org.apache.maven.archiva.indexer.query;
-
-/*
- * 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.
- */
-
-/**
- * Base of all query terms.
- *
- * @author <a href="mailto:brett@apache.org">Brett Porter</a>
- */
-public class CompoundQueryTerm
-{
- /**
- * The query to add to the compound query.
- */
- private final Query query;
-
- /**
- * Whether the term is required (an AND).
- */
- private final boolean required;
-
- /**
- * Whether the term is prohibited (a NOT).
- */
- private final boolean prohibited;
-
- /**
- * Class constructor
- *
- * @param query the subquery to add
- * @param required whether the term is required (an AND)
- * @param prohibited whether the term is prohibited (a NOT)
- */
- private CompoundQueryTerm( Query query, boolean required, boolean prohibited )
- {
- this.query = query;
- this.prohibited = prohibited;
- this.required = required;
- }
-
- /**
- * Method to test if the Query is a search requirement
- *
- * @return true if this Query is a search requirement, otherwise returns false
- */
- public boolean isRequired()
- {
- return required;
- }
-
- /**
- * Method to test if the Query is prohibited in the search result
- *
- * @return true if this Query is prohibited in the search result
- */
- public boolean isProhibited()
- {
- return prohibited;
- }
-
-
- /**
- * The subquery to execute.
- *
- * @return the query
- */
- public Query getQuery()
- {
- return query;
- }
-
- static CompoundQueryTerm and( Query query )
- {
- return new CompoundQueryTerm( query, true, false );
- }
-
- static CompoundQueryTerm or( Query query )
- {
- return new CompoundQueryTerm( query, false, false );
- }
-
- static CompoundQueryTerm not( Query query )
- {
- return new CompoundQueryTerm( query, false, true );
- }
-}
diff --git a/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/query/Query.java b/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/query/Query.java
deleted file mode 100644
index 9c0c608dd..000000000
--- a/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/query/Query.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package org.apache.maven.archiva.indexer.query;
-
-/*
- * 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.
- */
-
-/**
- * Interface to label the query classes
- *
- * @author Edwin Punzalan
- */
-public interface Query
-{
-}
diff --git a/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/query/QueryTerm.java b/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/query/QueryTerm.java
deleted file mode 100644
index 259729e87..000000000
--- a/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/query/QueryTerm.java
+++ /dev/null
@@ -1,64 +0,0 @@
-package org.apache.maven.archiva.indexer.query;
-
-/*
- * 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.
- */
-
-/**
- * Class to hold a single field search condition
- *
- * @author Edwin Punzalan
- */
-public class QueryTerm
-{
- private String field;
-
- private String value;
-
- /**
- * Class constructor
- *
- * @param field the index field to search
- * @param value the index value requirement
- */
- public QueryTerm( String field, String value )
- {
- this.field = field;
- this.value = value;
- }
-
- /**
- * Method to retrieve the name of the index field searched
- *
- * @return the name of the index field
- */
- public String getField()
- {
- return field;
- }
-
- /**
- * Method to retrieve the value used in searching the index field
- *
- * @return the value to corresspond the index field
- */
- public String getValue()
- {
- return value;
- }
-}
diff --git a/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/query/RangeQuery.java b/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/query/RangeQuery.java
deleted file mode 100644
index 1e455d5f0..000000000
--- a/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/query/RangeQuery.java
+++ /dev/null
@@ -1,153 +0,0 @@
-package org.apache.maven.archiva.indexer.query;
-
-/*
- * 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.
- */
-
-/**
- * Query object that handles range queries (presently used for dates).
- *
- * @author Maria Odea Ching
- * @author Brett Porter
- */
-public class RangeQuery
- implements Query
-{
- /**
- * Whether values equal to the boundaries are included in the query results.
- */
- private final boolean inclusive;
-
- /**
- * The lower bound.
- */
- private final QueryTerm begin;
-
- /**
- * The upper bound.
- */
- private final QueryTerm end;
-
- /**
- * Constructor.
- *
- * @param begin the lower bound
- * @param end the upper bound
- * @param inclusive whether to include the boundaries in the query
- */
- private RangeQuery( QueryTerm begin, QueryTerm end, boolean inclusive )
- {
- this.begin = begin;
- this.end = end;
- this.inclusive = inclusive;
- }
-
- /**
- * Create an open range, including all results.
- *
- * @return the query object
- */
- public static RangeQuery createOpenRange()
- {
- return new RangeQuery( null, null, false );
- }
-
- /**
- * Create a bounded range, excluding the endpoints.
- *
- * @param begin the lower bound value to compare to
- * @param end the upper bound value to compare to
- * @return the query object
- */
- public static RangeQuery createExclusiveRange( QueryTerm begin, QueryTerm end )
- {
- return new RangeQuery( begin, end, false );
- }
-
- /**
- * Create a bounded range, including the endpoints.
- *
- * @param begin the lower bound value to compare to
- * @param end the upper bound value to compare to
- * @return the query object
- */
- public static RangeQuery createInclusiveRange( QueryTerm begin, QueryTerm end )
- {
- return new RangeQuery( begin, end, true );
- }
-
- /**
- * Create a range that is greater than or equal to a given term.
- *
- * @param begin the value to compare to
- * @return the query object
- */
- public static RangeQuery createGreaterThanOrEqualToRange( QueryTerm begin )
- {
- return new RangeQuery( begin, null, true );
- }
-
- /**
- * Create a range that is greater than a given term.
- *
- * @param begin the value to compare to
- * @return the query object
- */
- public static RangeQuery createGreaterThanRange( QueryTerm begin )
- {
- return new RangeQuery( begin, null, false );
- }
-
- /**
- * Create a range that is less than or equal to a given term.
- *
- * @param end the value to compare to
- * @return the query object
- */
- public static RangeQuery createLessThanOrEqualToRange( QueryTerm end )
- {
- return new RangeQuery( null, end, true );
- }
-
- /**
- * Create a range that is less than a given term.
- *
- * @param end the value to compare to
- * @return the query object
- */
- public static RangeQuery createLessThanRange( QueryTerm end )
- {
- return new RangeQuery( null, end, false );
- }
-
- public QueryTerm getBegin()
- {
- return begin;
- }
-
- public QueryTerm getEnd()
- {
- return end;
- }
-
- public boolean isInclusive()
- {
- return inclusive;
- }
-
-}
diff --git a/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/query/SingleTermQuery.java b/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/query/SingleTermQuery.java
deleted file mode 100644
index 587fcf5c0..000000000
--- a/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/query/SingleTermQuery.java
+++ /dev/null
@@ -1,65 +0,0 @@
-package org.apache.maven.archiva.indexer.query;
-
-/*
- * 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.
- */
-
-/**
- * Query for a single term.
- *
- * @author <a href="mailto:brett@apache.org">Brett Porter</a>
- */
-public class SingleTermQuery
- implements Query
-{
- /**
- * The term to query for.
- */
- private final QueryTerm term;
-
- /**
- * Constructor.
- *
- * @param term the term to query
- */
- public SingleTermQuery( QueryTerm term )
- {
- this.term = term;
- }
-
- /**
- * Shorthand constructor - create a single term query from a field and value
- *
- * @param field the field name
- * @param value the value to check for
- */
- public SingleTermQuery( String field, String value )
- {
- this.term = new QueryTerm( field, value );
- }
-
- public String getField()
- {
- return term.getField();
- }
-
- public String getValue()
- {
- return term.getValue();
- }
-}
diff --git a/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/record/AbstractArtifactIndexRecordFactory.java b/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/record/AbstractArtifactIndexRecordFactory.java
deleted file mode 100644
index 80ba7bf1d..000000000
--- a/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/record/AbstractArtifactIndexRecordFactory.java
+++ /dev/null
@@ -1,101 +0,0 @@
-package org.apache.maven.archiva.indexer.record;
-
-/*
- * 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.
- */
-
-import org.codehaus.plexus.digest.Digester;
-import org.codehaus.plexus.digest.DigesterException;
-import org.codehaus.plexus.logging.AbstractLogEnabled;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.List;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipFile;
-
-/**
- * Base class for the index record factories.
- *
- * @author <a href="mailto:brett@apache.org">Brett Porter</a>
- */
-public abstract class AbstractArtifactIndexRecordFactory
- extends AbstractLogEnabled
- implements RepositoryIndexRecordFactory
-{
- protected String readChecksum( File file, Digester digester )
- {
- String checksum;
- try
- {
- checksum = digester.calc( file ).toLowerCase();
- }
- catch ( DigesterException e )
- {
- getLogger().error( "Error getting checksum for artifact file, leaving empty in index: " + e.getMessage() );
- checksum = null;
- }
- return checksum;
- }
-
- protected List readFilesInArchive( File file )
- throws IOException
- {
- ZipFile zipFile = new ZipFile( file );
- List files;
- try
- {
- files = new ArrayList( zipFile.size() );
-
- for ( Enumeration entries = zipFile.entries(); entries.hasMoreElements(); )
- {
- ZipEntry entry = (ZipEntry) entries.nextElement();
-
- files.add( entry.getName() );
- }
- }
- finally
- {
- closeQuietly( zipFile );
- }
- return files;
- }
-
- protected static boolean isClass( String name )
- {
- // TODO: verify if class is public or protected (this might require the original ZipEntry)
- return name.endsWith( ".class" ) && name.lastIndexOf( "$" ) < 0;
- }
-
- protected static void closeQuietly( ZipFile zipFile )
- {
- try
- {
- if ( zipFile != null )
- {
- zipFile.close();
- }
- }
- catch ( IOException e )
- {
- // ignored
- }
- }
-}
diff --git a/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/record/IndexRecordExistsArtifactFilter.java b/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/record/IndexRecordExistsArtifactFilter.java
deleted file mode 100644
index 717be53c1..000000000
--- a/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/record/IndexRecordExistsArtifactFilter.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package org.apache.maven.archiva.indexer.record;
-
-/*
- * 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.
- */
-
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
-
-import java.util.Collection;
-
-/**
- * Filter that removes artifacts already in the index.
- * TODO: we could do timestamp comparisons here
- */
-public class IndexRecordExistsArtifactFilter
- implements ArtifactFilter
-{
- private final Collection keys;
-
- public IndexRecordExistsArtifactFilter( Collection keys )
- {
- this.keys = keys;
- }
-
- public boolean include( Artifact artifact )
- {
- String artifactKey = artifact.getGroupId() + ":" + artifact.getArtifactId() + ":" + artifact.getVersion() +
- ( artifact.getClassifier() != null ? ":" + artifact.getClassifier() : "" );
- return !keys.contains( artifactKey );
- }
-}
diff --git a/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/record/MinimalArtifactIndexRecord.java b/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/record/MinimalArtifactIndexRecord.java
deleted file mode 100644
index 3bde1daa3..000000000
--- a/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/record/MinimalArtifactIndexRecord.java
+++ /dev/null
@@ -1,173 +0,0 @@
-package org.apache.maven.archiva.indexer.record;
-
-/*
- * 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.
- */
-
-import java.util.Date;
-import java.util.List;
-
-/**
- * The a record with the fields in the minimal index.
- *
- * @author <a href="mailto:brett@apache.org">Brett Porter</a>
- */
-public class MinimalArtifactIndexRecord
- implements RepositoryIndexRecord
-{
- /**
- * The classes in the archive for the artifact, if it is a JAR.
- */
- private List classes;
-
- /**
- * The MD5 checksum of the artifact file.
- */
- private String md5Checksum;
-
- /**
- * The filename of the artifact file (no path).
- */
- private String filename;
-
- /**
- * The timestamp that the artifact file was last modified. Granularity is seconds.
- */
- private long lastModified;
-
- /**
- * The size of the artifact file in bytes.
- */
- private long size;
-
- private static final int MS_PER_SEC = 1000;
-
- public void setClasses( List classes )
- {
- this.classes = classes;
- }
-
- public void setMd5Checksum( String md5Checksum )
- {
- this.md5Checksum = md5Checksum;
- }
-
- public void setFilename( String filename )
- {
- this.filename = filename;
- }
-
- public void setLastModified( long lastModified )
- {
- this.lastModified = lastModified - lastModified % MS_PER_SEC;
- }
-
- public void setSize( long size )
- {
- this.size = size;
- }
-
- public List getClasses()
- {
- return classes;
- }
-
- public String getMd5Checksum()
- {
- return md5Checksum;
- }
-
- public String getFilename()
- {
- return filename;
- }
-
- public long getLastModified()
- {
- return lastModified;
- }
-
- public long getSize()
- {
- return size;
- }
-
- /**
- * @noinspection RedundantIfStatement
- */
- public boolean equals( Object obj )
- {
- if ( this == obj )
- {
- return true;
- }
- if ( obj == null || getClass() != obj.getClass() )
- {
- return false;
- }
-
- MinimalArtifactIndexRecord that = (MinimalArtifactIndexRecord) obj;
-
- if ( lastModified != that.lastModified )
- {
- return false;
- }
- if ( size != that.size )
- {
- return false;
- }
- if ( classes != null ? !classes.equals( that.classes ) : that.classes != null )
- {
- return false;
- }
- if ( !filename.equals( that.filename ) )
- {
- return false;
- }
- if ( md5Checksum != null ? !md5Checksum.equals( that.md5Checksum ) : that.md5Checksum != null )
- {
- return false;
- }
-
- return true;
- }
-
- /**
- * @noinspection UnnecessaryParentheses
- */
- public int hashCode()
- {
- int result = classes != null ? classes.hashCode() : 0;
- result = 31 * result + ( md5Checksum != null ? md5Checksum.hashCode() : 0 );
- result = 31 * result + filename.hashCode();
- result = 31 * result + (int) ( lastModified ^ ( lastModified >>> 32 ) );
- result = 31 * result + (int) ( size ^ ( size >>> 32 ) );
- return result;
- }
-
- public String toString()
- {
- return "Filename: " + filename + "; checksum: " + md5Checksum + "; size: " + size + "; lastModified: " +
- new Date( lastModified ) + "; classes: " + classes;
- }
-
- public String getPrimaryKey()
- {
- return filename;
- }
-}
diff --git a/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/record/MinimalArtifactIndexRecordFactory.java b/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/record/MinimalArtifactIndexRecordFactory.java
deleted file mode 100644
index e22d03abf..000000000
--- a/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/record/MinimalArtifactIndexRecordFactory.java
+++ /dev/null
@@ -1,105 +0,0 @@
-package org.apache.maven.archiva.indexer.record;
-
-/*
- * 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.
- */
-
-import org.apache.maven.artifact.Artifact;
-import org.codehaus.plexus.digest.Digester;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-/**
- * An index record type for the minimal index.
- *
- * @author Edwin Punzalan
- * @author Brett Porter
- * @plexus.component role="org.apache.maven.archiva.indexer.record.RepositoryIndexRecordFactory" role-hint="minimal"
- */
-public class MinimalArtifactIndexRecordFactory
- extends AbstractArtifactIndexRecordFactory
-{
- /* List of types to index. */
- private static final Set INDEXED_TYPES = new HashSet( Arrays.asList( new String[]{"jar", "maven-plugin"} ) );
-
- /**
- * @plexus.requirement role-hint="sha1"
- */
- protected Digester sha1Digester;
-
- /**
- * @plexus.requirement role-hint="md5"
- */
- protected Digester md5Digester;
-
- public RepositoryIndexRecord createRecord( Artifact artifact )
- {
- MinimalArtifactIndexRecord record = null;
-
- File file = artifact.getFile();
- if ( file != null && INDEXED_TYPES.contains( artifact.getType() ) && file.exists() )
- {
- String md5 = readChecksum( file, md5Digester );
-
- List files = null;
- try
- {
- files = readFilesInArchive( file );
- }
- catch ( IOException e )
- {
- getLogger().error( "Error reading artifact file, omitting from index: " + e.getMessage() );
- }
-
- if ( files != null )
- {
- record = new MinimalArtifactIndexRecord();
- record.setMd5Checksum( md5 );
- record.setFilename( artifact.getRepository().pathOf( artifact ) );
- record.setLastModified( file.lastModified() );
- record.setSize( file.length() );
- record.setClasses( getClassesFromFiles( files ) );
- }
- }
- return record;
- }
-
- private List getClassesFromFiles( List files )
- {
- List classes = new ArrayList();
-
- for ( Iterator i = files.iterator(); i.hasNext(); )
- {
- String name = (String) i.next();
-
- if ( isClass( name ) )
- {
- classes.add( name.substring( 0, name.length() - 6 ).replace( '/', '.' ) );
- }
- }
-
- return classes;
- }
-}
diff --git a/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/record/MinimalIndexRecordFields.java b/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/record/MinimalIndexRecordFields.java
deleted file mode 100644
index ae3104c57..000000000
--- a/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/record/MinimalIndexRecordFields.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package org.apache.maven.archiva.indexer.record;
-
-/*
- * 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.
- */
-
-/**
- * The fields in a minimal artifact index record.
- *
- * @author <a href="mailto:brett@apache.org">Brett Porter</a>
- * @todo should be an enum
- */
-public class MinimalIndexRecordFields
-{
- public static final String FILENAME = "j";
-
- public static final String LAST_MODIFIED = "d";
-
- public static final String FILE_SIZE = "s";
-
- public static final String MD5 = "m";
-
- public static final String CLASSES = "c";
-
- private MinimalIndexRecordFields()
- {
- // No touchy!
- }
-}
diff --git a/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/record/RepositoryIndexRecord.java b/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/record/RepositoryIndexRecord.java
deleted file mode 100644
index f7d61a6b7..000000000
--- a/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/record/RepositoryIndexRecord.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package org.apache.maven.archiva.indexer.record;
-
-/*
- * 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.
- */
-
-/**
- * A repository index record.
- *
- * @author <a href="mailto:brett@apache.org">Brett Porter</a>
- */
-public interface RepositoryIndexRecord
-{
- /**
- * Get the primary key used to identify the record uniquely in the index.
- *
- * @return the primary key
- */
- String getPrimaryKey();
-}
diff --git a/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/record/RepositoryIndexRecordFactory.java b/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/record/RepositoryIndexRecordFactory.java
deleted file mode 100644
index e7474a159..000000000
--- a/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/record/RepositoryIndexRecordFactory.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package org.apache.maven.archiva.indexer.record;
-
-/*
- * 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.
- */
-
-import org.apache.maven.archiva.indexer.RepositoryIndexException;
-import org.apache.maven.artifact.Artifact;
-
-/**
- * The layout of a record in a repository index.
- *
- * @author <a href="mailto:brett@apache.org">Brett Porter</a>
- */
-public interface RepositoryIndexRecordFactory
-{
- /**
- * The Plexus role.
- */
- String ROLE = RepositoryIndexRecordFactory.class.getName();
-
- /**
- * Create an index record from an artifact.
- *
- * @param artifact the artifact
- * @return the index record
- * @throws RepositoryIndexException if there is a problem constructing the record (due to not being able to read the artifact file as a POM)
- */
- RepositoryIndexRecord createRecord( Artifact artifact )
- throws RepositoryIndexException;
-
-}
diff --git a/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/record/StandardArtifactIndexRecord.java b/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/record/StandardArtifactIndexRecord.java
deleted file mode 100644
index 5395c419b..000000000
--- a/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/record/StandardArtifactIndexRecord.java
+++ /dev/null
@@ -1,412 +0,0 @@
-package org.apache.maven.archiva.indexer.record;
-
-/*
- * 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.
- */
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-/**
- * The a record with the fields in the standard index.
- *
- * @author <a href="mailto:brett@apache.org">Brett Porter</a>
- */
-public class StandardArtifactIndexRecord
- extends MinimalArtifactIndexRecord
-{
- /**
- * The SHA-1 checksum of the artifact file.
- */
- private String sha1Checksum;
-
- /**
- * The artifact's group.
- */
- private String groupId;
-
- /**
- * The artifact's identifier within the group.
- */
- private String artifactId;
-
- /**
- * The artifact's version.
- */
- private String version;
-
- /**
- * The classifier, if there is one.
- */
- private String classifier;
-
- /**
- * The artifact type (from the file).
- */
- private String type;
-
- /**
- * A list of files (separated by '\n') in the artifact if it is an archive.
- */
- private List files;
-
- /**
- * The identifier of the repository that the artifact came from.
- */
- private String repository;
-
- /**
- * The packaging specified in the POM for this artifact.
- */
- private String packaging;
-
- /**
- * The plugin prefix specified in the metadata if the artifact is a plugin.
- */
- private String pluginPrefix;
-
- /**
- * The year the project was started.
- */
- private String inceptionYear;
-
- /**
- * The description of the project.
- */
- private String projectDescription;
-
- /**
- * The name of the project.
- */
- private String projectName;
-
- /**
- * The base version (before the snapshot is determined).
- */
- private String baseVersion;
-
- /**
- * A list of dependencies for the artifact, each a string of the form <code>groupId:artifactId:version</code>.
- */
- private List dependencies;
-
- /**
- * A list of developers in the POM, each a string of the form <code>id:name:email</code>.
- */
- private List developers;
-
- public void setSha1Checksum( String sha1Checksum )
- {
- this.sha1Checksum = sha1Checksum;
- }
-
- public void setGroupId( String groupId )
- {
- this.groupId = groupId;
- }
-
- public void setArtifactId( String artifactId )
- {
- this.artifactId = artifactId;
- }
-
- public void setVersion( String version )
- {
- this.version = version;
- }
-
- public void setClassifier( String classifier )
- {
- this.classifier = classifier;
- }
-
- public void setType( String type )
- {
- this.type = type;
- }
-
- public void setFiles( List files )
- {
- this.files = files;
- }
-
- public void setRepository( String repository )
- {
- this.repository = repository;
- }
-
- /**
- * @noinspection RedundantIfStatement
- */
- public boolean equals( Object obj )
- {
- if ( this == obj )
- {
- return true;
- }
- if ( obj == null || getClass() != obj.getClass() )
- {
- return false;
- }
- if ( !super.equals( obj ) )
- {
- return false;
- }
-
- StandardArtifactIndexRecord that = (StandardArtifactIndexRecord) obj;
-
- if ( !artifactId.equals( that.artifactId ) )
- {
- return false;
- }
- if ( classifier != null ? !classifier.equals( that.classifier ) : that.classifier != null )
- {
- return false;
- }
-
- if ( dependencies != null && that.dependencies != null )
- {
- List sorted = new ArrayList( dependencies );
- Collections.sort( sorted );
-
- List sortedOther = new ArrayList( that.dependencies );
- Collections.sort( sortedOther );
-
- if ( !sorted.equals( sortedOther ) )
- {
- return false;
- }
- }
- else if ( !( dependencies == null && that.dependencies == null ) )
- {
- return false;
- }
-
- if ( developers != null ? !developers.equals( that.developers ) : that.developers != null )
- {
- return false;
- }
- if ( files != null ? !files.equals( that.files ) : that.files != null )
- {
- return false;
- }
- if ( !groupId.equals( that.groupId ) )
- {
- return false;
- }
- if ( repository != null ? !repository.equals( that.repository ) : that.repository != null )
- {
- return false;
- }
- if ( sha1Checksum != null ? !sha1Checksum.equals( that.sha1Checksum ) : that.sha1Checksum != null )
- {
- return false;
- }
- if ( type != null ? !type.equals( that.type ) : that.type != null )
- {
- return false;
- }
- if ( !version.equals( that.version ) )
- {
- return false;
- }
- if ( !baseVersion.equals( that.baseVersion ) )
- {
- return false;
- }
- if ( packaging != null ? !packaging.equals( that.packaging ) : that.packaging != null )
- {
- return false;
- }
- if ( pluginPrefix != null ? !pluginPrefix.equals( that.pluginPrefix ) : that.pluginPrefix != null )
- {
- return false;
- }
- if ( projectName != null ? !projectName.equals( that.projectName ) : that.projectName != null )
- {
- return false;
- }
- if ( inceptionYear != null ? !inceptionYear.equals( that.inceptionYear ) : that.inceptionYear != null )
- {
- return false;
- }
- if ( projectDescription != null ? !projectDescription.equals( that.projectDescription )
- : that.projectDescription != null )
- {
- return false;
- }
-
- return true;
- }
-
- public int hashCode()
- {
- int result = super.hashCode();
- result = 31 * result + ( sha1Checksum != null ? sha1Checksum.hashCode() : 0 );
- result = 31 * result + groupId.hashCode();
- result = 31 * result + artifactId.hashCode();
- result = 31 * result + version.hashCode();
- result = 31 * result + baseVersion.hashCode();
- result = 31 * result + ( classifier != null ? classifier.hashCode() : 0 );
- result = 31 * result + ( type != null ? type.hashCode() : 0 );
- result = 31 * result + ( files != null ? files.hashCode() : 0 );
- result = 31 * result + ( developers != null ? developers.hashCode() : 0 );
-
- if ( dependencies != null )
- {
- List sorted = new ArrayList( dependencies );
- Collections.sort( sorted );
-
- result = 31 * result + sorted.hashCode();
- }
-
- result = 31 * result + ( repository != null ? repository.hashCode() : 0 );
- result = 31 * result + ( packaging != null ? packaging.hashCode() : 0 );
- result = 31 * result + ( pluginPrefix != null ? pluginPrefix.hashCode() : 0 );
- result = 31 * result + ( inceptionYear != null ? inceptionYear.hashCode() : 0 );
- result = 31 * result + ( projectName != null ? projectName.hashCode() : 0 );
- result = 31 * result + ( projectDescription != null ? projectDescription.hashCode() : 0 );
- return result;
- }
-
- public String getSha1Checksum()
- {
- return sha1Checksum;
- }
-
- public String getGroupId()
- {
- return groupId;
- }
-
- public String getArtifactId()
- {
- return artifactId;
- }
-
- public String getVersion()
- {
- return version;
- }
-
- public String getClassifier()
- {
- return classifier;
- }
-
- public String getType()
- {
- return type;
- }
-
- public List getFiles()
- {
- return files;
- }
-
- public String getRepository()
- {
- return repository;
- }
-
- public String getPackaging()
- {
- return packaging;
- }
-
- public String getPluginPrefix()
- {
- return pluginPrefix;
- }
-
- public void setPackaging( String packaging )
- {
- this.packaging = packaging;
- }
-
- public void setPluginPrefix( String pluginPrefix )
- {
- this.pluginPrefix = pluginPrefix;
- }
-
- public void setInceptionYear( String inceptionYear )
- {
- this.inceptionYear = inceptionYear;
- }
-
- public void setProjectDescription( String description )
- {
- this.projectDescription = description;
- }
-
- public void setProjectName( String projectName )
- {
- this.projectName = projectName;
- }
-
- public String getInceptionYear()
- {
- return inceptionYear;
- }
-
- public String getProjectDescription()
- {
- return projectDescription;
- }
-
- public String getProjectName()
- {
- return projectName;
- }
-
- public void setBaseVersion( String baseVersion )
- {
- this.baseVersion = baseVersion;
- }
-
- public String getBaseVersion()
- {
- return baseVersion;
- }
-
- public void setDependencies( List dependencies )
- {
- this.dependencies = dependencies;
- }
-
- public void setDevelopers( List developers )
- {
- this.developers = developers;
- }
-
- public List getDevelopers()
- {
- return developers;
- }
-
- public List getDependencies()
- {
- return dependencies;
- }
-
- public String getPrimaryKey()
- {
- return groupId + ":" + artifactId + ":" + version + ( classifier != null ? ":" + classifier : "" );
- }
-}
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
deleted file mode 100644
index 219b6691e..000000000
--- a/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/record/StandardArtifactIndexRecordFactory.java
+++ /dev/null
@@ -1,373 +0,0 @@
-package org.apache.maven.archiva.indexer.record;
-
-/*
- * 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.
- */
-
-import org.apache.maven.archiva.indexer.RepositoryIndexException;
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.InvalidArtifactRTException;
-import org.apache.maven.artifact.factory.ArtifactFactory;
-import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.model.Dependency;
-import org.apache.maven.model.Developer;
-import org.apache.maven.model.Model;
-import org.apache.maven.project.MavenProject;
-import org.apache.maven.project.MavenProjectBuilder;
-import org.apache.maven.project.ProjectBuildingException;
-import org.codehaus.plexus.digest.Digester;
-import org.codehaus.plexus.util.xml.Xpp3Dom;
-import org.codehaus.plexus.util.xml.Xpp3DomBuilder;
-import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipException;
-import java.util.zip.ZipFile;
-
-/**
- * An index record type for the standard index.
- *
- * @author Edwin Punzalan
- * @author Brett Porter
- * @plexus.component role="org.apache.maven.archiva.indexer.record.RepositoryIndexRecordFactory" role-hint="standard"
- */
-public class StandardArtifactIndexRecordFactory
- extends AbstractArtifactIndexRecordFactory
-{
- /**
- * A list of artifact types to treat as a zip archive.
- *
- * @todo this should be smarter (perhaps use plexus archiver to look for an unarchiver, and make the ones for zip configurable since sar, par, etc can be added at random.
- */
- private static final Set ARCHIVE_TYPES =
- new HashSet( Arrays.asList( new String[]{"jar", "ejb", "par", "sar", "war", "ear", "rar"} ) );
-
- /**
- * @plexus.requirement
- */
- private ArtifactFactory artifactFactory;
-
- /**
- * @plexus.requirement
- */
- private MavenProjectBuilder projectBuilder;
-
- /**
- * @plexus.requirement role-hint="sha1"
- */
- protected Digester sha1Digester;
-
- /**
- * @plexus.requirement role-hint="md5"
- */
- 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";
-
- // some current/old archetypes have the archetype.xml at different location.
- private static final String ARCHETYPE_METADATA_NAME_OLD = "META-INF/archetype.xml";
-
- public RepositoryIndexRecord createRecord( Artifact artifact )
- throws RepositoryIndexException
- {
- StandardArtifactIndexRecord record = null;
-
- File file = artifact.getFile();
-
- // TODO: is this condition really a possibility?
- if ( file != null && file.exists() )
- {
- String md5 = readChecksum( file, md5Digester );
- String sha1 = readChecksum( file, sha1Digester );
-
- List files = null;
- boolean archive = ARCHIVE_TYPES.contains( artifact.getType() );
- try
- {
- if ( archive )
- {
- files = readFilesInArchive( file );
- }
- }
- catch ( IOException e )
- {
- getLogger().error( "Error reading artifact file, omitting from index: " + e.getMessage() );
- }
-
- // If it's an archive with no files, don't create a record
- if ( !archive || files != null )
- {
- record = new StandardArtifactIndexRecord();
-
- record.setGroupId( artifact.getGroupId() );
- record.setArtifactId( artifact.getArtifactId() );
- record.setBaseVersion( artifact.getBaseVersion() );
- record.setVersion( artifact.getVersion() );
- record.setClassifier( artifact.getClassifier() );
- record.setType( artifact.getType() );
- record.setMd5Checksum( md5 );
- record.setSha1Checksum( sha1 );
- record.setFilename( artifact.getRepository().pathOf( artifact ) );
- record.setLastModified( file.lastModified() );
- record.setSize( file.length() );
- record.setRepository( artifact.getRepository().getId() );
-
- if ( files != null )
- {
- populateArchiveEntries( files, record, artifact.getFile() );
- }
-
- if ( !"pom".equals( artifact.getType() ) )
- {
- Artifact pomArtifact = artifactFactory.createProjectArtifact( artifact.getGroupId(),
- artifact.getArtifactId(),
- artifact.getVersion() );
- pomArtifact.isSnapshot(); // gross hack around bug in maven-artifact
- File pomFile = new File( artifact.getRepository().getBasedir(),
- artifact.getRepository().pathOf( pomArtifact ) );
- if ( pomFile.exists() )
- {
- try
- {
- populatePomEntries( readPom( pomArtifact, artifact.getRepository() ), record );
- }
- catch ( ProjectBuildingException e )
- {
- getLogger().error( "Error reading POM file [" + pomFile + "] for " + artifact +
- ", not populating in index: " + e.getMessage() );
- }
- }
- }
- else
- {
- Model model;
- try
- {
- model = readPom( artifact, artifact.getRepository() );
-
- if ( !"pom".equals( model.getPackaging() ) )
- {
- // Don't return a record for a POM that is does not belong on its own
- record = null;
- }
- else
- {
- populatePomEntries( model, record );
- }
- }
- catch ( ProjectBuildingException e )
- {
- getLogger().error(
- "Error reading POM file for " + artifact + ", not populating in index: " + e.getMessage() );
- }
- }
- }
- }
-
- return record;
- }
-
- private void populatePomEntries( Model pom, StandardArtifactIndexRecord record )
- {
- record.setPackaging( pom.getPackaging() );
- record.setProjectName( pom.getName() );
- record.setProjectDescription( pom.getDescription() );
- record.setInceptionYear( pom.getInceptionYear() );
-
- List dependencies = populateDependencies( pom.getDependencies() );
- if ( !dependencies.isEmpty() )
- {
- record.setDependencies( dependencies );
- }
- List developers = populateDevelopers( pom.getDevelopers() );
- if ( !developers.isEmpty() )
- {
- record.setDevelopers( developers );
- }
-
-/* TODO: fields for later
- indexPlugins( doc, FLD_PLUGINS_BUILD, pom.getBuild().getPlugins().iterator() );
- indexReportPlugins( doc, FLD_PLUGINS_REPORT, pom.getReporting().getPlugins().iterator() );
- record.setLicenses( licenses );
-*/
- }
-
- private List populateDependencies( List dependencies )
- {
- List convertedDependencies = new ArrayList();
-
- for ( Iterator i = dependencies.iterator(); i.hasNext(); )
- {
- Dependency dependency = (Dependency) i.next();
-
- convertedDependencies.add(
- dependency.getGroupId() + ":" + dependency.getArtifactId() + ":" + dependency.getVersion() );
- }
-
- return convertedDependencies;
- }
-
- private List populateDevelopers( List developers )
- {
- List convertedDevelopers = new ArrayList();
-
- for ( Iterator i = developers.iterator(); i.hasNext(); )
- {
- Developer developer = (Developer) i.next();
-
- convertedDevelopers.add( developer.getId() + ":" + developer.getName() + ":" + developer.getEmail() );
- }
-
- return convertedDevelopers;
- }
-
- private Model readPom( Artifact artifact, ArtifactRepository repository )
- throws RepositoryIndexException, ProjectBuildingException
- {
- // TODO: this can create a -SNAPSHOT.pom when it didn't exist and a timestamped one did. This is harmless, but should be avoided
- // TODO: will this pollute with local repo metadata?
-
- try
- {
- MavenProject project = projectBuilder.buildFromRepository( artifact, Collections.EMPTY_LIST, repository );
- return project.getModel();
- }
- catch ( InvalidArtifactRTException e )
- {
- throw new ProjectBuildingException( artifact.getId(),
- "Unable to build project from invalid artifact [" + artifact + "]", e );
- }
- }
-
- private void populateArchiveEntries( List files, StandardArtifactIndexRecord record, File artifactFile )
- throws RepositoryIndexException
- {
- List classes = new ArrayList();
- List fileList = new ArrayList();
-
- for ( Iterator i = files.iterator(); i.hasNext(); )
- {
- String name = (String) i.next();
-
- // ignore directories
- if ( !name.endsWith( "/" ) )
- {
- fileList.add( name );
-
- if ( isClass( name ) )
- {
- classes.add( name.substring( 0, name.length() - 6 ).replace( '/', '.' ) );
- }
- else if ( PLUGIN_METADATA_NAME.equals( name ) )
- {
- populatePluginEntries( readXmlMetadataFileInJar( artifactFile, PLUGIN_METADATA_NAME ), record );
- }
- else if ( ARCHETYPE_METADATA_NAME.equals( name ) || ARCHETYPE_METADATA_NAME_OLD.equals( name ) )
- {
- populateArchetypeEntries( record );
- }
- else if ( SITE_TEMPLATE_NAME.equals( name ) || SITE_CSS_NAME.equals( name ) )
- {
- populateSkinEntries( record );
- }
- }
- }
-
- if ( !classes.isEmpty() )
- {
- record.setClasses( classes );
- }
- if ( !fileList.isEmpty() )
- {
- record.setFiles( fileList );
- }
- }
-
- private void populateArchetypeEntries( StandardArtifactIndexRecord record )
- {
- // Typically discovered as a JAR
- 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
- {
- // TODO: would be more efficient with original ZipEntry still around
-
- Xpp3Dom xpp3Dom;
- ZipFile zipFile = null;
- try
- {
- zipFile = new ZipFile( file );
- ZipEntry entry = zipFile.getEntry( name );
- xpp3Dom = Xpp3DomBuilder.build( new InputStreamReader( zipFile.getInputStream( entry ) ) );
- }
- catch ( ZipException e )
- {
- throw new RepositoryIndexException( "Unable to read plugin metadata: " + e.getMessage(), e );
- }
- catch ( IOException e )
- {
- throw new RepositoryIndexException( "Unable to read plugin metadata: " + e.getMessage(), e );
- }
- catch ( XmlPullParserException e )
- {
- throw new RepositoryIndexException( "Unable to read plugin metadata: " + e.getMessage(), e );
- }
- finally
- {
- closeQuietly( zipFile );
- }
- return xpp3Dom;
- }
-
- public void populatePluginEntries( Xpp3Dom metadata, StandardArtifactIndexRecord record )
- {
- // Typically discovered as a JAR
- record.setType( "maven-plugin" );
-
- Xpp3Dom prefix = metadata.getChild( "goalPrefix" );
-
- if ( prefix != null )
- {
- record.setPluginPrefix( prefix.getValue() );
- }
- }
-}
diff --git a/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/record/StandardIndexRecordFields.java b/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/record/StandardIndexRecordFields.java
deleted file mode 100644
index d80e60cfc..000000000
--- a/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/record/StandardIndexRecordFields.java
+++ /dev/null
@@ -1,84 +0,0 @@
-package org.apache.maven.archiva.indexer.record;
-
-/*
- * 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.
- */
-
-/**
- * The fields in a minimal artifact index record.
- *
- * @author <a href="mailto:brett@apache.org">Brett Porter</a>
- * @todo should be an enum
- */
-public class StandardIndexRecordFields
-{
- public static final String FILENAME = "filename";
-
- public static final String GROUPID = "groupId";
-
- public static final String GROUPID_EXACT = GROUPID + "_u";
-
- public static final String ARTIFACTID = "artifactId";
-
- public static final String ARTIFACTID_EXACT = ARTIFACTID + "_u";
-
- public static final String VERSION = "version";
-
- public static final String VERSION_EXACT = VERSION + "_u";
-
- public static final String BASE_VERSION = "baseVersion";
-
- public static final String BASE_VERSION_EXACT = BASE_VERSION + "_u";
-
- public static final String TYPE = "type";
-
- public static final String CLASSIFIER = "classifier";
-
- public static final String PACKAGING = "packaging";
-
- public static final String REPOSITORY = "repo";
-
- public static final String LAST_MODIFIED = "lastModified";
-
- public static final String FILE_SIZE = "fileSize";
-
- public static final String MD5 = "md5";
-
- public static final String SHA1 = "sha1";
-
- public static final String CLASSES = "classes";
-
- public static final String PLUGIN_PREFIX = "pluginPrefix";
-
- public static final String FILES = "files";
-
- public static final String INCEPTION_YEAR = "inceptionYear";
-
- public static final String PROJECT_NAME = "projectName";
-
- public static final String PROJECT_DESCRIPTION = "projectDesc";
-
- public static final String DEVELOPERS = "developers";
-
- public static final String DEPENDENCIES = "dependencies";
-
- private StandardIndexRecordFields()
- {
- // No touchy!
- }
-}
diff --git a/archiva-indexer/src/site/apt/design.apt b/archiva-indexer/src/site/apt/design.apt
deleted file mode 100644
index aea3f9634..000000000
--- a/archiva-indexer/src/site/apt/design.apt
+++ /dev/null
@@ -1,153 +0,0 @@
- -----
- Indexer Design
- -----
- Brett Porter
- -----
- 25 July 2006
- -----
-
-~~ Copyright 2006 The Apache Software Foundation.
-~~
-~~ Licensed 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.
-
-~~ NOTE: For help with the syntax of this file, see:
-~~ http://maven.apache.org/guides/mini/guide-apt-format.html
-
-Indexer Design
-
- <<Note: The current indexer design is under review. This document will grow into what it should be, and the code and
- tests refactored to match>>
-
- ~~TODO: separate API design from Lucene implementation design
-
-* Standard Artifact Index
-
- We currently want to index these elements from the repository:
-
- * for each artifact file: the artifact ID, version, group ID, classifier, type (extension), filename (including path
- from the repository base), checksums (md5, sha1) and size
-
- * for each artifact POM: the packaging, licenses, dependencies, build plugins, reporting plugins
-
- * plugin prefix
-
- * Java classes within a JAR artifact (delimited by \n)
-
- * filenames within an archive (delimited by \n)
-
- * the identifier of the source repository
-
- Each record in the index refers to an artifact. Since the content for a record can come from various sources, the
- record may need to be updated when different files that are related to the same artifact are discovered (ie, the
- POM, or for plugins the metadata that contains their prefix).
-
- To simplify this, the process for discovery is as follows:
-
- * Discovered artifacts will read the related POM and metadata from the repository to index, rather than relying on
- it being discovered. This ensures that partial discovery still yields correct results in all cases, and it is
- possible to construct the entire record without having to read back from the index.
-
- * POMs that do not have a packaging of POM are not sent to the indexer.
-
- The result of this process is that updates to a POM or repository metadata and not the corresponding artifact(s) will
- not update the index. As POMs should not be modified, this will not be a major concern. Likewise, updates to metadata
- will only accompany updates to the artifact itself, so will not cause a problem.
-
- The above case may have a problem if the discovery happens during the middle of a deployment outside of the
- repository manager (where the artifact is present, but the metadata or POM is not). To avoid such cases, the
- discoverer should only detect changes more than a minute old (this blackout should be configurable).
-
- Other techniques were considered:
-
- * Processing each artifact file individually, updating each record as needed. This would result in having to read
- back each index record before writing. This is quite costly in Lucene as it would be "read, delete, add". You
- must have a reader and writer open for that process, and it greatly complicates the code.
-
- * Have three indices, one for each. This would complicate searching (and may affect ranking of results, though this
- was not analysed). While Lucene is
- {{{http://wiki.apache.org/jakarta-lucene/LuceneFAQ#head-b11296f9e7b2a5e7496d67118d0a5898f2fd9823} capable of
- searching multiple indices}}, it is expected that the results would be in the form of a list of separate records
- rather than the "table join" this effectively is. A similar derivative of this technique would be to store
- everything in one index, using a field (previously, doctype) to identify each record.
-
- Records in the index are keyed by their path from the repository root. While this is longer than using the
- dependency conflict ID, Lucene cannot delete by a combination of terms, so would require storing an additional
- field in the index where the file already exists.
-
- The plugin prefix could be found either from inside the plugin JAR (<<<META-INF/maven/plugin.xml>>>), or from the
- repository metadata for the plugin's group. For simplicity, the first approach will be used. This means at present
- there is no need to index the repository metadata, however that may be considered in future.
-
- Note that archetypes currently don't have a packaging associated with them in Maven, so it is not recorded in the POM.
- However, to be able to search by this type, the indexer will look for a <<<META-INF/maven/archetype.xml>>> file, and
- if found set its packaging to <<<maven-archetype>>>. In the future, this handling will be deprecated as the POMs
- can start using the appropriate packaging.
-
- The index is shared among multiple repositories. The source repository is recorded in the index record. The
- discovery/conversion/reporting mechanisms are expected to deal with duplicates before reaching the indexer, so if the
- indexer encounters an artifact from a different repository than it was already added, it will simply replace the
- record.
-
- When indexing metadata from a POM, the POM should be loaded using the Maven project builder so that inheritance and
- interpolation are performed. This ensures that the record is as complete as possible, and that searching by
- fields that are inherited will reveal both the parent and the children in the search results.
-
-* Reduced Size Index
-
- An additional index is maintained by the repository manager in the
- {{{../apidocs/org/apache/maven/archiva/indexing/MinimalArtifactIndexRecord.html} MinimalIndex}} class. This
- indexes all of the same artifacts as the first index, but stores them with shorter field names and less information to
- maintain a smaller size. This index is appropriate for use by certain clients such as IDE integration for fast
- searching. For a fuller interface to the repository information, the integration should use the XMLRPC interface.
-
- The following fields are in the reduced index:
-
- * <<<j>>>: The JAR filename
-
- * <<<s>>>: The JAR size
-
- * <<<d>>>: The last modified timestamp
-
- * <<<c>>>: A list of classes in the JAR (\n delimited)
-
- * <<<m>>>: md5 checksum of the JAR
-
- * <<<pk>>>: the primary key of the artifact
-
- Only JARs are indexed at present. The JAR filename is used as the key for later deleting entries.
-
-* Searching
-
- Searching will be reasonably flexible, though the general use case will be to enter a single parsed query that is
- applied to all fields in the index.
-
- Some features that will be available:
-
- * <Search through most fields for a particular keyword>: the general case described above.
-
- * <Search by a particular field (exact match)>: This would be needed for search by checksum.
-
- * <Search in a range of field values>: This would be needed for searching based on update time. Note that in
- Lucene it may be better to search by other fields (or return all), and then filter the results by dates rather
- than making dates part of a search query.
-
- * <Limit search to particular fields>: It will be useful to only search Java classes and packages, for example
-
- Another thing to note is that the search results should be able to be composed entirely from the index for performance
- reasons. It should not have to read any metadata files or properties of files such as size and checksum from the disk.
- This enables searching a repository remotely without having the physical repository available, which is useful for
- IDE integration among other things.
-
- Note that to be able to do an exact match search, a field must be stored untokenized. For fields where it makes sense
- to search both tokenized and untokenized, they will be stored twice. This currently includes: artifact ID, group ID,
- and version.
diff --git a/archiva-indexer/src/site/site.xml b/archiva-indexer/src/site/site.xml
deleted file mode 100644
index 7b39b50d6..000000000
--- a/archiva-indexer/src/site/site.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
- ~ 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.
- -->
-
-<project>
- <body>
- <menu name="Design Documentation">
- <item name="Indexing Design" href="/design.html"/>
- </menu>
- </body>
-</project>
diff --git a/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/lucene/LuceneMinimalArtifactIndexSearchTest.java b/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/lucene/LuceneMinimalArtifactIndexSearchTest.java
deleted file mode 100644
index 48c959f93..000000000
--- a/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/lucene/LuceneMinimalArtifactIndexSearchTest.java
+++ /dev/null
@@ -1,231 +0,0 @@
-package org.apache.maven.archiva.indexer.lucene;
-
-/*
- * 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.
- */
-
-import org.apache.commons.io.FileUtils;
-import org.apache.lucene.index.Term;
-import org.apache.lucene.queryParser.ParseException;
-import org.apache.lucene.queryParser.QueryParser;
-import org.apache.lucene.search.Query;
-import org.apache.lucene.search.TermQuery;
-import org.apache.maven.archiva.indexer.RepositoryArtifactIndex;
-import org.apache.maven.archiva.indexer.RepositoryArtifactIndexFactory;
-import org.apache.maven.archiva.indexer.RepositoryIndexSearchException;
-import org.apache.maven.archiva.indexer.record.MinimalIndexRecordFields;
-import org.apache.maven.archiva.indexer.record.RepositoryIndexRecordFactory;
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.factory.ArtifactFactory;
-import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
-import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
-import org.apache.maven.artifact.versioning.VersionRange;
-import org.codehaus.plexus.PlexusTestCase;
-
-import java.io.File;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Test the Lucene implementation of the artifact index search.
- *
- * @author <a href="mailto:brett@apache.org">Brett Porter</a>
- * @todo would be nice to abstract some of the query away, but for now passing in a Lucene query directly is good enough
- */
-public class LuceneMinimalArtifactIndexSearchTest
- extends PlexusTestCase
-{
- private RepositoryArtifactIndex index;
-
- private ArtifactRepository repository;
-
- private ArtifactFactory artifactFactory;
-
- private File indexLocation;
-
- private RepositoryIndexRecordFactory recordFactory;
-
- private Map records = new HashMap();
-
- protected void setUp()
- throws Exception
- {
- super.setUp();
-
- recordFactory = (RepositoryIndexRecordFactory) lookup( RepositoryIndexRecordFactory.ROLE, "minimal" );
-
- artifactFactory = (ArtifactFactory) lookup( ArtifactFactory.ROLE );
-
- ArtifactRepositoryFactory repositoryFactory =
- (ArtifactRepositoryFactory) lookup( ArtifactRepositoryFactory.ROLE );
-
- ArtifactRepositoryLayout layout = (ArtifactRepositoryLayout) lookup( ArtifactRepositoryLayout.ROLE, "default" );
-
- File file = getTestFile( "src/test/managed-repository" );
- repository =
- repositoryFactory.createArtifactRepository( "test", file.toURI().toURL().toString(), layout, null, null );
-
- RepositoryArtifactIndexFactory factory =
- (RepositoryArtifactIndexFactory) lookup( RepositoryArtifactIndexFactory.ROLE, "lucene" );
-
- indexLocation = getTestFile( "target/test-index" );
-
- FileUtils.deleteDirectory( indexLocation );
-
- index = factory.createMinimalIndex( indexLocation );
-
- records.put( "test-jar", recordFactory.createRecord( createArtifact( "test-jar" ) ) );
- records.put( "test-jar-jdk14",
- recordFactory.createRecord( createArtifact( "test-jar", "1.0", "jar", "jdk14" ) ) );
- records.put( "test-jar-and-pom",
- recordFactory.createRecord( createArtifact( "test-jar-and-pom", "1.0-alpha-1", "jar" ) ) );
- records.put( "test-jar-and-pom-jdk14", recordFactory.createRecord(
- createArtifact( "test-jar-and-pom", "1.0-alpha-1", "jar", "jdk14" ) ) );
- records.put( "test-child-pom",
- recordFactory.createRecord( createArtifact( "test-child-pom", "1.0-20060728.121314-1", "jar" ) ) );
- records.put( "test-archetype", recordFactory.createRecord( createArtifact( "test-archetype" ) ) );
- records.put( "test-plugin", recordFactory.createRecord( createArtifact( "test-plugin" ) ) );
- records.put( "test-pom", recordFactory.createRecord( createArtifact( "test-pom", "1.0", "pom" ) ) );
- records.put( "parent-pom", recordFactory.createRecord( createArtifact( "parent-pom", "1", "pom" ) ) );
- records.put( "test-dll", recordFactory.createRecord( createArtifact( "test-dll", "1.0.1.34", "dll" ) ) );
-
- index.indexRecords( records.values() );
- }
-
- public void testExactMatchMd5()
- throws RepositoryIndexSearchException
- {
- Query query = createExactMatchQuery( MinimalIndexRecordFields.MD5, "3a0adc365f849366cd8b633cad155cb7" );
- List results = index.search( new LuceneQuery( query ) );
-
- assertTrue( "Check result", results.contains( records.get( "test-jar" ) ) );
- assertTrue( "Check result", results.contains( records.get( "test-jar-jdk14" ) ) );
- assertTrue( "Check result", results.contains( records.get( "test-jar-and-pom" ) ) );
- assertTrue( "Check result", results.contains( records.get( "test-jar-and-pom-jdk14" ) ) );
- assertTrue( "Check result", results.contains( records.get( "test-child-pom" ) ) );
- assertEquals( "Check results size", 5, results.size() );
-
- // test non-match fails
- query = createExactMatchQuery( MinimalIndexRecordFields.MD5, "foo" );
- results = index.search( new LuceneQuery( query ) );
-
- assertTrue( "Check results size", results.isEmpty() );
- }
-
- public void testMatchFilename()
- throws RepositoryIndexSearchException, ParseException
- {
- Query query = createMatchQuery( MinimalIndexRecordFields.FILENAME, "maven" );
- List results = index.search( new LuceneQuery( query ) );
-
- assertFalse( "Check result", results.contains( records.get( "test-pom" ) ) );
- assertFalse( "Check result", results.contains( records.get( "parent-pom" ) ) );
- assertFalse( "Check result", results.contains( records.get( "test-dll" ) ) );
- assertEquals( "Check results size", 7, results.size() );
-
- query = createMatchQuery( MinimalIndexRecordFields.FILENAME, "plugin" );
- results = index.search( new LuceneQuery( query ) );
-
- assertTrue( "Check result", results.contains( records.get( "test-plugin" ) ) );
- assertEquals( "Check results size", 1, results.size() );
-
- query = createMatchQuery( MinimalIndexRecordFields.FILENAME, "test" );
- results = index.search( new LuceneQuery( query ) );
-
- assertFalse( "Check result", results.contains( records.get( "parent-pom" ) ) );
- assertFalse( "Check result", results.contains( records.get( "test-pom" ) ) );
- assertFalse( "Check result", results.contains( records.get( "test-dll" ) ) );
- assertEquals( "Check results size", 7, results.size() );
-
- // test non-match fails
- query = createMatchQuery( MinimalIndexRecordFields.FILENAME, "foo" );
- results = index.search( new LuceneQuery( query ) );
-
- assertTrue( "Check results size", results.isEmpty() );
- }
-
- public void testMatchClass()
- throws RepositoryIndexSearchException, ParseException
- {
- Query query = createMatchQuery( MinimalIndexRecordFields.CLASSES, "b.c.C" );
- List results = index.search( new LuceneQuery( query ) );
-
- assertTrue( "Check result", results.contains( records.get( "test-child-pom" ) ) );
- assertTrue( "Check result", results.contains( records.get( "test-jar" ) ) );
- assertTrue( "Check result", results.contains( records.get( "test-jar-jdk14" ) ) );
- assertTrue( "Check result", results.contains( records.get( "test-jar-and-pom" ) ) );
- assertTrue( "Check result", results.contains( records.get( "test-jar-and-pom-jdk14" ) ) );
- assertEquals( "Check results size", 5, results.size() );
-
- query = createMatchQuery( MinimalIndexRecordFields.CLASSES, "C" );
- results = index.search( new LuceneQuery( query ) );
-
- assertTrue( "Check result", results.contains( records.get( "test-child-pom" ) ) );
- assertTrue( "Check result", results.contains( records.get( "test-jar" ) ) );
- assertTrue( "Check result", results.contains( records.get( "test-jar-jdk14" ) ) );
- assertTrue( "Check result", results.contains( records.get( "test-jar-and-pom" ) ) );
- assertTrue( "Check result", results.contains( records.get( "test-jar-and-pom-jdk14" ) ) );
- assertEquals( "Check results size", 5, results.size() );
-
- query = createMatchQuery( MinimalIndexRecordFields.CLASSES, "MyMojo" );
- results = index.search( new LuceneQuery( query ) );
-
- assertTrue( "Check result", results.contains( records.get( "test-plugin" ) ) );
- assertEquals( "Check results size", 1, results.size() );
-
- // test non-match fails
- query = createMatchQuery( MinimalIndexRecordFields.CLASSES, "foo" );
- results = index.search( new LuceneQuery( query ) );
-
- assertTrue( "Check results size", results.isEmpty() );
- }
-
- private static Query createExactMatchQuery( String field, String value )
- {
- return new TermQuery( new Term( field, value ) );
- }
-
- private static Query createMatchQuery( String field, String value )
- throws ParseException
- {
- return new QueryParser( field, LuceneRepositoryArtifactIndex.getAnalyzer() ).parse( value );
- }
-
- private Artifact createArtifact( String artifactId )
- {
- return createArtifact( artifactId, "1.0", "jar", null );
- }
-
- private Artifact createArtifact( String artifactId, String version, String type )
- {
- return createArtifact( artifactId, version, type, null );
- }
-
- private Artifact createArtifact( String artifactId, String version, String type, String classifier )
- {
- Artifact artifact = artifactFactory.createDependencyArtifact( "org.apache.maven.archiva.record", artifactId,
- VersionRange.createFromVersion( version ), type,
- classifier, Artifact.SCOPE_RUNTIME );
- artifact.isSnapshot();
- artifact.setFile( new File( repository.getBasedir(), repository.pathOf( artifact ) ) );
- artifact.setRepository( repository );
- return artifact;
- }
-}
diff --git a/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/lucene/LuceneMinimalArtifactIndexTest.java b/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/lucene/LuceneMinimalArtifactIndexTest.java
deleted file mode 100644
index c3b8c77f6..000000000
--- a/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/lucene/LuceneMinimalArtifactIndexTest.java
+++ /dev/null
@@ -1,353 +0,0 @@
-package org.apache.maven.archiva.indexer.lucene;
-
-/*
- * 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.
- */
-
-import org.apache.commons.io.FileUtils;
-import org.apache.lucene.document.Document;
-import org.apache.lucene.document.NumberTools;
-import org.apache.lucene.index.IndexReader;
-import org.apache.lucene.index.IndexWriter;
-import org.apache.maven.archiva.indexer.RepositoryArtifactIndex;
-import org.apache.maven.archiva.indexer.RepositoryArtifactIndexFactory;
-import org.apache.maven.archiva.indexer.RepositoryIndexException;
-import org.apache.maven.archiva.indexer.record.MinimalIndexRecordFields;
-import org.apache.maven.archiva.indexer.record.RepositoryIndexRecord;
-import org.apache.maven.archiva.indexer.record.RepositoryIndexRecordFactory;
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.factory.ArtifactFactory;
-import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
-import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
-import org.codehaus.plexus.PlexusTestCase;
-import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
-
-import java.io.File;
-import java.io.IOException;
-import java.text.SimpleDateFormat;
-import java.util.Collections;
-import java.util.Date;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Locale;
-import java.util.TimeZone;
-
-/**
- * Test the Lucene implementation of the artifact index.
- *
- * @author <a href="mailto:brett@apache.org">Brett Porter</a>
- */
-public class LuceneMinimalArtifactIndexTest
- extends PlexusTestCase
-{
- private RepositoryArtifactIndex index;
-
- private ArtifactRepository repository;
-
- private ArtifactFactory artifactFactory;
-
- private File indexLocation;
-
- private RepositoryIndexRecordFactory recordFactory;
-
- protected void setUp()
- throws Exception
- {
- super.setUp();
-
- recordFactory = (RepositoryIndexRecordFactory) lookup( RepositoryIndexRecordFactory.ROLE, "minimal" );
-
- artifactFactory = (ArtifactFactory) lookup( ArtifactFactory.ROLE );
-
- ArtifactRepositoryFactory repositoryFactory =
- (ArtifactRepositoryFactory) lookup( ArtifactRepositoryFactory.ROLE );
-
- ArtifactRepositoryLayout layout = (ArtifactRepositoryLayout) lookup( ArtifactRepositoryLayout.ROLE, "default" );
-
- File file = getTestFile( "src/test/managed-repository" );
- repository =
- repositoryFactory.createArtifactRepository( "test", file.toURI().toURL().toString(), layout, null, null );
-
- RepositoryArtifactIndexFactory factory =
- (RepositoryArtifactIndexFactory) lookup( RepositoryArtifactIndexFactory.ROLE, "lucene" );
-
- indexLocation = getTestFile( "target/test-index" );
-
- FileUtils.deleteDirectory( indexLocation );
-
- index = factory.createMinimalIndex( indexLocation );
- }
-
- public void testIndexExists()
- throws IOException, RepositoryIndexException
- {
- assertFalse( "check index doesn't exist", index.exists() );
-
- // create empty directory
- indexLocation.mkdirs();
- assertFalse( "check index doesn't exist even if directory does", index.exists() );
-
- // create index, with no records
- createEmptyIndex();
- assertTrue( "check index is considered to exist", index.exists() );
-
- // Test non-directory
- FileUtils.deleteDirectory( indexLocation );
- indexLocation.createNewFile();
- try
- {
- index.exists();
- fail( "Index operation should fail as the location is not valid" );
- }
- catch ( RepositoryIndexException e )
- {
- // great
- }
- finally
- {
- indexLocation.delete();
- }
- }
-
- public void testAddRecordNoIndex()
- throws IOException, RepositoryIndexException
- {
- Artifact artifact = createArtifact( "test-jar" );
-
- RepositoryIndexRecord record = recordFactory.createRecord( artifact );
- index.indexRecords( Collections.singletonList( record ) );
-
- IndexReader reader = IndexReader.open( indexLocation );
- try
- {
- Document document = reader.document( 0 );
- assertEquals( "Check document", repository.pathOf( artifact ),
- document.get( MinimalIndexRecordFields.FILENAME ) );
- assertEquals( "Check index size", 1, reader.numDocs() );
- }
- finally
- {
- reader.close();
- }
- }
-
- public void testAddRecordExistingEmptyIndex()
- throws IOException, RepositoryIndexException
- {
- createEmptyIndex();
-
- Artifact artifact = createArtifact( "test-jar" );
-
- RepositoryIndexRecord record = recordFactory.createRecord( artifact );
- index.indexRecords( Collections.singletonList( record ) );
-
- IndexReader reader = IndexReader.open( indexLocation );
- try
- {
- Document document = reader.document( 0 );
- assertRecord( document, artifact, "3a0adc365f849366cd8b633cad155cb7", "A\nb.B\nb.c.C" );
- assertEquals( "Check index size", 1, reader.numDocs() );
- }
- finally
- {
- reader.close();
- }
- }
-
- public void testAddRecordInIndex()
- throws IOException, RepositoryIndexException
- {
- createEmptyIndex();
-
- Artifact artifact = createArtifact( "test-jar" );
-
- RepositoryIndexRecord record = recordFactory.createRecord( artifact );
- index.indexRecords( Collections.singletonList( record ) );
-
- // Do it again
- record = recordFactory.createRecord( artifact );
- index.indexRecords( Collections.singletonList( record ) );
-
- IndexReader reader = IndexReader.open( indexLocation );
- try
- {
- Document document = reader.document( 0 );
- assertRecord( document, artifact, "3a0adc365f849366cd8b633cad155cb7", "A\nb.B\nb.c.C" );
- assertEquals( "Check index size", 1, reader.numDocs() );
- }
- finally
- {
- reader.close();
- }
- }
-
- public void testDeleteRecordInIndex()
- throws IOException, RepositoryIndexException
- {
- createEmptyIndex();
-
- Artifact artifact = createArtifact( "test-jar" );
-
- RepositoryIndexRecord record = recordFactory.createRecord( artifact );
- index.indexRecords( Collections.singletonList( record ) );
-
- index.deleteRecords( Collections.singletonList( record ) );
-
- IndexReader reader = IndexReader.open( indexLocation );
- try
- {
- assertEquals( "No documents", 0, reader.numDocs() );
- }
- finally
- {
- reader.close();
- }
- }
-
- public void testDeleteRecordNotInIndex()
- throws IOException, RepositoryIndexException
- {
- createEmptyIndex();
-
- Artifact artifact = createArtifact( "test-jar" );
-
- RepositoryIndexRecord record = recordFactory.createRecord( artifact );
-
- index.deleteRecords( Collections.singletonList( record ) );
-
- IndexReader reader = IndexReader.open( indexLocation );
- try
- {
- assertEquals( "No documents", 0, reader.numDocs() );
- }
- finally
- {
- reader.close();
- }
- }
-
- public void testDeleteRecordNoIndex()
- throws IOException, RepositoryIndexException
- {
- Artifact artifact = createArtifact( "test-jar" );
-
- RepositoryIndexRecord record = recordFactory.createRecord( artifact );
- index.deleteRecords( Collections.singleton( record ) );
-
- assertFalse( index.exists() );
- }
-
- public void testAddPomRecord()
- throws IOException, RepositoryIndexException
- {
- createEmptyIndex();
-
- Artifact artifact = createArtifact( "test-pom", "1.0", "pom" );
-
- RepositoryIndexRecord record = recordFactory.createRecord( artifact );
- index.indexRecords( Collections.singletonList( record ) );
-
- IndexReader reader = IndexReader.open( indexLocation );
- try
- {
- assertEquals( "No documents", 0, reader.numDocs() );
- }
- finally
- {
- reader.close();
- }
- }
-
- public void testAddPlugin()
- throws IOException, RepositoryIndexException, XmlPullParserException
- {
- createEmptyIndex();
-
- Artifact artifact = createArtifact( "test-plugin" );
-
- RepositoryIndexRecord record = recordFactory.createRecord( artifact );
-
- index.indexRecords( Collections.singletonList( record ) );
-
- IndexReader reader = IndexReader.open( indexLocation );
- try
- {
- Document document = reader.document( 0 );
- assertRecord( document, artifact, "3530896791670ebb45e17708e5d52c40",
- "org.apache.maven.archiva.record.MyMojo" );
- assertEquals( "Check index size", 1, reader.numDocs() );
- }
- finally
- {
- reader.close();
- }
- }
-
- private Artifact createArtifact( String artifactId )
- {
- return createArtifact( artifactId, "1.0", "jar" );
- }
-
- private Artifact createArtifact( String artifactId, String version, String type )
- {
- Artifact artifact =
- artifactFactory.createBuildArtifact( "org.apache.maven.archiva.record", artifactId, version, type );
- artifact.setFile( new File( repository.getBasedir(), repository.pathOf( artifact ) ) );
- artifact.setRepository( repository );
- return artifact;
- }
-
- private void createEmptyIndex()
- throws IOException
- {
- createIndex( Collections.EMPTY_LIST );
- }
-
- private void createIndex( List docments )
- throws IOException
- {
- IndexWriter writer = new IndexWriter( indexLocation, LuceneRepositoryArtifactIndex.getAnalyzer(), true );
- for ( Iterator i = docments.iterator(); i.hasNext(); )
- {
- Document document = (Document) i.next();
- writer.addDocument( document );
- }
- writer.optimize();
- writer.close();
- }
-
- private void assertRecord( Document document, Artifact artifact, String expectedChecksum, String expectedClasses )
- {
- assertEquals( "Check document filename", repository.pathOf( artifact ),
- document.get( MinimalIndexRecordFields.FILENAME ) );
- assertEquals( "Check document timestamp", getLastModified( artifact.getFile() ),
- document.get( MinimalIndexRecordFields.LAST_MODIFIED ) );
- assertEquals( "Check document checksum", expectedChecksum, document.get( MinimalIndexRecordFields.MD5 ) );
- assertEquals( "Check document size", artifact.getFile().length(),
- NumberTools.stringToLong( document.get( MinimalIndexRecordFields.FILE_SIZE ) ) );
- assertEquals( "Check document classes", expectedClasses, document.get( MinimalIndexRecordFields.CLASSES ) );
- }
-
- private String getLastModified( File file )
- {
- SimpleDateFormat dateFormat = new SimpleDateFormat( "yyyyMMddHHmmss", Locale.US );
- dateFormat.setTimeZone( TimeZone.getTimeZone( "UTC" ) );
- return dateFormat.format( new Date( file.lastModified() ) );
- }
-}
diff --git a/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/lucene/LuceneStandardArtifactIndexSearchTest.java b/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/lucene/LuceneStandardArtifactIndexSearchTest.java
deleted file mode 100644
index ba3b6d1b5..000000000
--- a/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/lucene/LuceneStandardArtifactIndexSearchTest.java
+++ /dev/null
@@ -1,790 +0,0 @@
-package org.apache.maven.archiva.indexer.lucene;
-
-/*
- * 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.
- */
-
-import org.apache.commons.io.FileUtils;
-import org.apache.lucene.index.Term;
-import org.apache.lucene.queryParser.ParseException;
-import org.apache.lucene.queryParser.QueryParser;
-import org.apache.lucene.search.BooleanClause;
-import org.apache.lucene.search.BooleanQuery;
-import org.apache.lucene.search.MatchAllDocsQuery;
-import org.apache.lucene.search.Query;
-import org.apache.lucene.search.TermQuery;
-import org.apache.maven.archiva.indexer.RepositoryArtifactIndex;
-import org.apache.maven.archiva.indexer.RepositoryArtifactIndexFactory;
-import org.apache.maven.archiva.indexer.RepositoryIndexSearchException;
-import org.apache.maven.archiva.indexer.record.RepositoryIndexRecordFactory;
-import org.apache.maven.archiva.indexer.record.StandardIndexRecordFields;
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.factory.ArtifactFactory;
-import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
-import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
-import org.apache.maven.artifact.versioning.VersionRange;
-import org.codehaus.plexus.PlexusTestCase;
-
-import java.io.File;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Test the Lucene implementation of the artifact index search.
- *
- * @author <a href="mailto:brett@apache.org">Brett Porter</a>
- * @todo would be nice to abstract some of the query away, but for now passing in a Lucene query directly is good enough
- */
-public class LuceneStandardArtifactIndexSearchTest
- extends PlexusTestCase
-{
- private RepositoryArtifactIndex index;
-
- private ArtifactRepository repository;
-
- private ArtifactFactory artifactFactory;
-
- private File indexLocation;
-
- private RepositoryIndexRecordFactory recordFactory;
-
- private Map records = new HashMap();
-
- protected void setUp()
- throws Exception
- {
- super.setUp();
-
- recordFactory = (RepositoryIndexRecordFactory) lookup( RepositoryIndexRecordFactory.ROLE, "standard" );
-
- artifactFactory = (ArtifactFactory) lookup( ArtifactFactory.ROLE );
-
- ArtifactRepositoryFactory repositoryFactory =
- (ArtifactRepositoryFactory) lookup( ArtifactRepositoryFactory.ROLE );
-
- ArtifactRepositoryLayout layout = (ArtifactRepositoryLayout) lookup( ArtifactRepositoryLayout.ROLE, "default" );
-
- File file = getTestFile( "src/test/managed-repository" );
- repository =
- repositoryFactory.createArtifactRepository( "test", file.toURI().toURL().toString(), layout, null, null );
-
- RepositoryArtifactIndexFactory factory =
- (RepositoryArtifactIndexFactory) lookup( RepositoryArtifactIndexFactory.ROLE, "lucene" );
-
- indexLocation = getTestFile( "target/test-index" );
-
- FileUtils.deleteDirectory( indexLocation );
-
- index = factory.createStandardIndex( indexLocation );
-
- records.put( "test-jar", recordFactory.createRecord( createArtifact( "test-jar" ) ) );
- records.put( "test-jar-jdk14",
- recordFactory.createRecord( createArtifact( "test-jar", "1.0", "jar", "jdk14" ) ) );
- records.put( "test-jar-and-pom",
- recordFactory.createRecord( createArtifact( "test-jar-and-pom", "1.0-alpha-1", "jar" ) ) );
- records.put( "test-jar-and-pom-jdk14", recordFactory.createRecord(
- createArtifact( "test-jar-and-pom", "1.0-alpha-1", "jar", "jdk14" ) ) );
- records.put( "test-child-pom",
- recordFactory.createRecord( createArtifact( "test-child-pom", "1.0-20060728.121314-1", "jar" ) ) );
- records.put( "test-archetype", recordFactory.createRecord( createArtifact( "test-archetype" ) ) );
- records.put( "test-plugin", recordFactory.createRecord( createArtifact( "test-plugin" ) ) );
- records.put( "test-pom", recordFactory.createRecord( createArtifact( "test-pom", "1.0", "pom" ) ) );
- records.put( "parent-pom", recordFactory.createRecord( createArtifact( "parent-pom", "1", "pom" ) ) );
- records.put( "test-dll", recordFactory.createRecord( createArtifact( "test-dll", "1.0.1.34", "dll" ) ) );
-
- index.indexRecords( records.values() );
- }
-
- public void testExactMatchVersion()
- throws RepositoryIndexSearchException
- {
- Query query = createExactMatchQuery( StandardIndexRecordFields.VERSION_EXACT, "1.0" );
- List results = index.search( new LuceneQuery( query ) );
-
- assertTrue( "Check result", results.contains( records.get( "test-jar" ) ) );
- assertTrue( "Check result", results.contains( records.get( "test-jar-jdk14" ) ) );
- assertTrue( "Check result", results.contains( records.get( "test-pom" ) ) );
- assertTrue( "Check result", results.contains( records.get( "test-plugin" ) ) );
- assertTrue( "Check result", results.contains( records.get( "test-archetype" ) ) );
- assertEquals( "Check results size", 5, results.size() );
-
- query = createExactMatchQuery( StandardIndexRecordFields.VERSION_EXACT, "1.0-SNAPSHOT" );
- results = index.search( new LuceneQuery( query ) );
-
- assertTrue( "Check results size", results.isEmpty() );
-
- query = createExactMatchQuery( StandardIndexRecordFields.VERSION_EXACT, "1.0-snapshot" );
- results = index.search( new LuceneQuery( query ) );
-
- assertTrue( "Check results size", results.isEmpty() );
-
- query = createExactMatchQuery( StandardIndexRecordFields.VERSION_EXACT, "1.0-20060728.121314-1" );
- results = index.search( new LuceneQuery( query ) );
-
- assertTrue( "Check result", results.contains( records.get( "test-child-pom" ) ) );
- assertEquals( "Check results size", 1, results.size() );
-
- // test non-match fails
- query = createExactMatchQuery( StandardIndexRecordFields.VERSION_EXACT, "foo" );
- results = index.search( new LuceneQuery( query ) );
-
- assertTrue( "Check results size", results.isEmpty() );
- }
-
- public void testExactMatchBaseVersion()
- throws RepositoryIndexSearchException
- {
- Query query = createExactMatchQuery( StandardIndexRecordFields.BASE_VERSION_EXACT, "1.0" );
- List results = index.search( new LuceneQuery( query ) );
-
- assertTrue( "Check result", results.contains( records.get( "test-jar" ) ) );
- assertTrue( "Check result", results.contains( records.get( "test-jar-jdk14" ) ) );
- assertTrue( "Check result", results.contains( records.get( "test-pom" ) ) );
- assertTrue( "Check result", results.contains( records.get( "test-plugin" ) ) );
- assertTrue( "Check result", results.contains( records.get( "test-archetype" ) ) );
- assertEquals( "Check results size", 5, results.size() );
-
- query = createExactMatchQuery( StandardIndexRecordFields.BASE_VERSION_EXACT, "1.0-SNAPSHOT" );
- results = index.search( new LuceneQuery( query ) );
-
- assertTrue( "Check result", results.contains( records.get( "test-child-pom" ) ) );
- assertEquals( "Check results size", 1, results.size() );
-
- query = createExactMatchQuery( StandardIndexRecordFields.BASE_VERSION_EXACT, "1.0-snapshot" );
- results = index.search( new LuceneQuery( query ) );
-
- assertTrue( "Check results size", results.isEmpty() );
-
- query = createExactMatchQuery( StandardIndexRecordFields.BASE_VERSION_EXACT, "1.0-20060728.121314-1" );
- results = index.search( new LuceneQuery( query ) );
-
- assertTrue( "Check results size", results.isEmpty() );
-
- // test non-match fails
- query = createExactMatchQuery( StandardIndexRecordFields.BASE_VERSION_EXACT, "foo" );
- results = index.search( new LuceneQuery( query ) );
-
- assertTrue( "Check results size", results.isEmpty() );
- }
-
- public void testExactMatchGroupId()
- throws RepositoryIndexSearchException
- {
- Query query =
- createExactMatchQuery( StandardIndexRecordFields.GROUPID_EXACT, "org.apache.maven.archiva.record" );
- List results = index.search( new LuceneQuery( query ) );
-
- assertEquals( "Check results size", 10, results.size() );
-
- // test partial match fails
- query = createExactMatchQuery( StandardIndexRecordFields.GROUPID_EXACT, "org.apache.maven" );
- results = index.search( new LuceneQuery( query ) );
-
- assertTrue( "Check results size", results.isEmpty() );
-
- // test non-match fails
- query = createExactMatchQuery( StandardIndexRecordFields.GROUPID_EXACT, "foo" );
- results = index.search( new LuceneQuery( query ) );
-
- assertTrue( "Check results size", results.isEmpty() );
- }
-
- public void testExactMatchArtifactId()
- throws RepositoryIndexSearchException
- {
- Query query = createExactMatchQuery( StandardIndexRecordFields.ARTIFACTID_EXACT, "test-jar" );
- List results = index.search( new LuceneQuery( query ) );
-
- assertTrue( "Check result", results.contains( records.get( "test-jar" ) ) );
- assertTrue( "Check result", results.contains( records.get( "test-jar-jdk14" ) ) );
- assertEquals( "Check results size", 2, results.size() );
-
- // test partial match fails
- query = createExactMatchQuery( StandardIndexRecordFields.ARTIFACTID_EXACT, "test" );
- results = index.search( new LuceneQuery( query ) );
-
- assertTrue( "Check results size", results.isEmpty() );
-
- // test non-match fails
- query = createExactMatchQuery( StandardIndexRecordFields.ARTIFACTID_EXACT, "foo" );
- results = index.search( new LuceneQuery( query ) );
-
- assertTrue( "Check results size", results.isEmpty() );
- }
-
- public void testExactMatchType()
- throws RepositoryIndexSearchException
- {
- Query query = createExactMatchQuery( StandardIndexRecordFields.TYPE, "maven-plugin" );
- List results = index.search( new LuceneQuery( query ) );
-
- assertTrue( "Check result", results.contains( records.get( "test-plugin" ) ) );
- assertEquals( "Check results size", 1, results.size() );
-
- query = createExactMatchQuery( StandardIndexRecordFields.TYPE, "jar" );
- results = index.search( new LuceneQuery( query ) );
-
- assertTrue( "Check result", results.contains( records.get( "test-jar" ) ) );
- assertTrue( "Check result", results.contains( records.get( "test-jar-jdk14" ) ) );
- assertTrue( "Check result", results.contains( records.get( "test-jar-and-pom" ) ) );
- assertTrue( "Check result", results.contains( records.get( "test-jar-and-pom-jdk14" ) ) );
- assertTrue( "Check result", results.contains( records.get( "test-child-pom" ) ) );
- assertEquals( "Check results size", 5, results.size() );
-
- query = createExactMatchQuery( StandardIndexRecordFields.TYPE, "dll" );
- results = index.search( new LuceneQuery( query ) );
-
- assertTrue( "Check result", results.contains( records.get( "test-dll" ) ) );
- assertEquals( "Check results size", 1, results.size() );
-
- query = createExactMatchQuery( StandardIndexRecordFields.TYPE, "maven-archetype" );
- results = index.search( new LuceneQuery( query ) );
-
- assertTrue( "Check result", results.contains( records.get( "test-archetype" ) ) );
- assertEquals( "Check results size", 1, results.size() );
-
- // test non-match fails
- query = createExactMatchQuery( StandardIndexRecordFields.TYPE, "foo" );
- results = index.search( new LuceneQuery( query ) );
-
- assertTrue( "Check results size", results.isEmpty() );
- }
-
- public void testExactMatchPackaging()
- throws RepositoryIndexSearchException
- {
- Query query = createExactMatchQuery( StandardIndexRecordFields.PACKAGING, "maven-plugin" );
- List results = index.search( new LuceneQuery( query ) );
-
- assertTrue( "Check result", results.contains( records.get( "test-plugin" ) ) );
- assertEquals( "Check results size", 1, results.size() );
-
- query = createExactMatchQuery( StandardIndexRecordFields.PACKAGING, "jar" );
- results = index.search( new LuceneQuery( query ) );
-
- assertTrue( "Check result", results.contains( records.get( "test-archetype" ) ) );
- assertTrue( "Check result", results.contains( records.get( "test-jar-and-pom" ) ) );
- assertTrue( "Check result", results.contains( records.get( "test-jar-and-pom-jdk14" ) ) );
- assertTrue( "Check result", results.contains( records.get( "test-child-pom" ) ) );
- assertEquals( "Check results size", 4, results.size() );
-
- query = createExactMatchQuery( StandardIndexRecordFields.PACKAGING, "dll" );
- results = index.search( new LuceneQuery( query ) );
-
- assertTrue( "Check results size", results.isEmpty() );
-
- query = createExactMatchQuery( StandardIndexRecordFields.PACKAGING, "maven-archetype" );
- results = index.search( new LuceneQuery( query ) );
-
- assertTrue( "Check results size", results.isEmpty() );
-
- // test non-match fails
- query = createExactMatchQuery( StandardIndexRecordFields.PACKAGING, "foo" );
- results = index.search( new LuceneQuery( query ) );
-
- assertTrue( "Check results size", results.isEmpty() );
- }
-
- public void testExactMatchPluginPrefix()
- throws RepositoryIndexSearchException
- {
- Query query = createExactMatchQuery( StandardIndexRecordFields.PLUGIN_PREFIX, "test" );
- List results = index.search( new LuceneQuery( query ) );
-
- assertTrue( "Check result", results.contains( records.get( "test-plugin" ) ) );
- assertEquals( "Check results size", 1, results.size() );
-
- // test non-match fails
- query = createExactMatchQuery( StandardIndexRecordFields.PLUGIN_PREFIX, "foo" );
- results = index.search( new LuceneQuery( query ) );
-
- assertTrue( "Check results size", results.isEmpty() );
- }
-
- public void testExactMatchRepository()
- throws RepositoryIndexSearchException
- {
- Query query = createExactMatchQuery( StandardIndexRecordFields.REPOSITORY, "test" );
- List results = index.search( new LuceneQuery( query ) );
-
- assertEquals( "Check results size", 10, results.size() );
-
- // test non-match fails
- query = createExactMatchQuery( StandardIndexRecordFields.REPOSITORY, "foo" );
- results = index.search( new LuceneQuery( query ) );
-
- assertTrue( "Check results size", results.isEmpty() );
- }
-
- public void testExactMatchMd5()
- throws RepositoryIndexSearchException
- {
- Query query = createExactMatchQuery( StandardIndexRecordFields.MD5, "3a0adc365f849366cd8b633cad155cb7" );
- List results = index.search( new LuceneQuery( query ) );
-
- assertTrue( "Check result", results.contains( records.get( "test-jar" ) ) );
- assertTrue( "Check result", results.contains( records.get( "test-jar-jdk14" ) ) );
- assertTrue( "Check result", results.contains( records.get( "test-jar-and-pom" ) ) );
- assertTrue( "Check result", results.contains( records.get( "test-jar-and-pom-jdk14" ) ) );
- assertTrue( "Check result", results.contains( records.get( "test-child-pom" ) ) );
- assertEquals( "Check results size", 5, results.size() );
-
- // test non-match fails
- query = createExactMatchQuery( StandardIndexRecordFields.MD5, "foo" );
- results = index.search( new LuceneQuery( query ) );
-
- assertTrue( "Check results size", results.isEmpty() );
- }
-
- public void testExactMatchSha1()
- throws RepositoryIndexSearchException
- {
- Query query =
- createExactMatchQuery( StandardIndexRecordFields.SHA1, "c66f18bf192cb613fc2febb4da541a34133eedc2" );
- List results = index.search( new LuceneQuery( query ) );
-
- assertTrue( "Check result", results.contains( records.get( "test-jar" ) ) );
- assertTrue( "Check result", results.contains( records.get( "test-jar-jdk14" ) ) );
- assertTrue( "Check result", results.contains( records.get( "test-jar-and-pom" ) ) );
- assertTrue( "Check result", results.contains( records.get( "test-jar-and-pom-jdk14" ) ) );
- assertTrue( "Check result", results.contains( records.get( "test-child-pom" ) ) );
- assertEquals( "Check results size", 5, results.size() );
-
- // test non-match fails
- query = createExactMatchQuery( StandardIndexRecordFields.SHA1, "foo" );
- results = index.search( new LuceneQuery( query ) );
-
- assertTrue( "Check results size", results.isEmpty() );
- }
-
- public void testExactMatchInceptionYear()
- throws RepositoryIndexSearchException
- {
- Query query = createExactMatchQuery( StandardIndexRecordFields.INCEPTION_YEAR, "2005" );
- List results = index.search( new LuceneQuery( query ) );
-
- assertTrue( "Check result", results.contains( records.get( "test-child-pom" ) ) );
- assertTrue( "Check result", results.contains( records.get( "test-pom" ) ) );
- assertTrue( "Check result", results.contains( records.get( "parent-pom" ) ) );
- assertEquals( "Check results size", 3, results.size() );
-
- // test non-match fails
- query = createExactMatchQuery( StandardIndexRecordFields.INCEPTION_YEAR, "foo" );
- results = index.search( new LuceneQuery( query ) );
-
- assertTrue( "Check results size", results.isEmpty() );
- }
-
- public void testMatchFilename()
- throws RepositoryIndexSearchException, ParseException
- {
- Query query = createMatchQuery( StandardIndexRecordFields.FILENAME, "maven" );
- List results = index.search( new LuceneQuery( query ) );
-
- assertEquals( "Check results size", 10, results.size() );
-
- query = createMatchQuery( StandardIndexRecordFields.FILENAME, "plugin" );
- results = index.search( new LuceneQuery( query ) );
-
- assertTrue( "Check result", results.contains( records.get( "test-plugin" ) ) );
- assertEquals( "Check results size", 1, results.size() );
-
- query = createMatchQuery( StandardIndexRecordFields.FILENAME, "pLuGiN" );
- results = index.search( new LuceneQuery( query ) );
-
- assertTrue( "Check results size", results.isEmpty() );
-
- query = createMatchQuery( StandardIndexRecordFields.FILENAME, "test" );
- results = index.search( new LuceneQuery( query ) );
-
- assertFalse( "Check result", results.contains( records.get( "parent-pom" ) ) );
- assertEquals( "Check results size", 9, results.size() );
-
- // test non-match fails
- query = createMatchQuery( StandardIndexRecordFields.FILENAME, "foo" );
- results = index.search( new LuceneQuery( query ) );
-
- assertTrue( "Check results size", results.isEmpty() );
- }
-
- public void testMatchGroupId()
- throws RepositoryIndexSearchException, ParseException
- {
- Query query = createMatchQuery( StandardIndexRecordFields.GROUPID, "org.apache.maven.archiva.record" );
- List results = index.search( new LuceneQuery( query ) );
-
- assertEquals( "Check results size", 10, results.size() );
-
- query = createMatchQuery( StandardIndexRecordFields.GROUPID, "maven" );
- results = index.search( new LuceneQuery( query ) );
-
- assertEquals( "Check results size", 10, results.size() );
-
- query = createMatchQuery( StandardIndexRecordFields.GROUPID, "Maven" );
- results = index.search( new LuceneQuery( query ) );
-
- assertEquals( "Check results size", 10, results.size() );
-
- // test non-match fails
- query = createMatchQuery( StandardIndexRecordFields.GROUPID, "foo" );
- results = index.search( new LuceneQuery( query ) );
-
- assertTrue( "Check results size", results.isEmpty() );
- }
-
- public void testMatchArtifactId()
- throws RepositoryIndexSearchException, ParseException
- {
- Query query = createMatchQuery( StandardIndexRecordFields.ARTIFACTID, "plugin" );
- List results = index.search( new LuceneQuery( query ) );
-
- assertTrue( "Check result", results.contains( records.get( "test-plugin" ) ) );
- assertEquals( "Check results size", 1, results.size() );
-
- query = createMatchQuery( StandardIndexRecordFields.ARTIFACTID, "test" );
- results = index.search( new LuceneQuery( query ) );
-
- assertFalse( "Check result", results.contains( records.get( "parent-pom" ) ) );
- assertEquals( "Check results size", 9, results.size() );
-
- // test non-match fails
- query = createMatchQuery( StandardIndexRecordFields.ARTIFACTID, "maven" );
- results = index.search( new LuceneQuery( query ) );
-
- assertTrue( "Check results size", results.isEmpty() );
- }
-
- public void testMatchVersion()
- throws RepositoryIndexSearchException, ParseException
- {
- // If partial matches are desired, need to change the analyzer for versions to split on '.'
- Query query = createMatchQuery( StandardIndexRecordFields.VERSION, "1" );
- List results = index.search( new LuceneQuery( query ) );
-
- assertTrue( "Check result", results.contains( records.get( "parent-pom" ) ) );
- assertTrue( "Check result", results.contains( records.get( "test-jar-and-pom" ) ) );
- assertTrue( "Check result", results.contains( records.get( "test-jar-and-pom-jdk14" ) ) );
- assertTrue( "Check result", results.contains( records.get( "test-child-pom" ) ) );
- assertEquals( "Check results size", 4, results.size() );
-
- query = createMatchQuery( StandardIndexRecordFields.VERSION, "1.0" );
- results = index.search( new LuceneQuery( query ) );
-
- assertTrue( "Check result", results.contains( records.get( "test-jar" ) ) );
- assertTrue( "Check result", results.contains( records.get( "test-jar-jdk14" ) ) );
- assertTrue( "Check result", results.contains( records.get( "test-plugin" ) ) );
- assertTrue( "Check result", results.contains( records.get( "test-pom" ) ) );
- assertTrue( "Check result", results.contains( records.get( "test-archetype" ) ) );
- assertTrue( "Check result", results.contains( records.get( "test-jar-and-pom" ) ) );
- assertTrue( "Check result", results.contains( records.get( "test-jar-and-pom-jdk14" ) ) );
- assertTrue( "Check result", results.contains( records.get( "test-child-pom" ) ) );
- assertEquals( "Check results size", 8, results.size() );
-
- query = createMatchQuery( StandardIndexRecordFields.VERSION, "snapshot" );
- results = index.search( new LuceneQuery( query ) );
-
- assertTrue( "Check results size", results.isEmpty() );
-
- query = createMatchQuery( StandardIndexRecordFields.VERSION, "SNAPSHOT" );
- results = index.search( new LuceneQuery( query ) );
-
- assertTrue( "Check results size", results.isEmpty() );
-
- query = createMatchQuery( StandardIndexRecordFields.VERSION, "alpha" );
- results = index.search( new LuceneQuery( query ) );
-
- assertTrue( "Check result", results.contains( records.get( "test-jar-and-pom" ) ) );
- assertTrue( "Check result", results.contains( records.get( "test-jar-and-pom-jdk14" ) ) );
- assertEquals( "Check results size", 2, results.size() );
-
- query = createMatchQuery( StandardIndexRecordFields.VERSION, "1.0-alpha-1" );
- results = index.search( new LuceneQuery( query ) );
-
- assertTrue( "Check result", results.contains( records.get( "test-jar-and-pom" ) ) );
- assertTrue( "Check result", results.contains( records.get( "test-jar-and-pom-jdk14" ) ) );
- assertEquals( "Check results size", 2, results.size() );
-
- // test non-match fails
- query = createMatchQuery( StandardIndexRecordFields.VERSION, "foo" );
- results = index.search( new LuceneQuery( query ) );
-
- assertTrue( "Check results size", results.isEmpty() );
- }
-
- public void testMatchBaseVersion()
- throws RepositoryIndexSearchException, ParseException
- {
- // If partial matches are desired, need to change the analyzer for versions to split on '.'
- Query query = createMatchQuery( StandardIndexRecordFields.BASE_VERSION, "1" );
- List results = index.search( new LuceneQuery( query ) );
-
- assertTrue( "Check result", results.contains( records.get( "parent-pom" ) ) );
- assertTrue( "Check result", results.contains( records.get( "test-jar-and-pom" ) ) );
- assertTrue( "Check result", results.contains( records.get( "test-jar-and-pom-jdk14" ) ) );
- assertEquals( "Check results size", 3, results.size() );
-
- query = createMatchQuery( StandardIndexRecordFields.BASE_VERSION, "1.0" );
- results = index.search( new LuceneQuery( query ) );
-
- assertTrue( "Check result", results.contains( records.get( "test-jar" ) ) );
- assertTrue( "Check result", results.contains( records.get( "test-jar-jdk14" ) ) );
- assertTrue( "Check result", results.contains( records.get( "test-plugin" ) ) );
- assertTrue( "Check result", results.contains( records.get( "test-pom" ) ) );
- assertTrue( "Check result", results.contains( records.get( "test-archetype" ) ) );
- assertTrue( "Check result", results.contains( records.get( "test-jar-and-pom" ) ) );
- assertTrue( "Check result", results.contains( records.get( "test-jar-and-pom-jdk14" ) ) );
- assertTrue( "Check result", results.contains( records.get( "test-child-pom" ) ) );
- assertEquals( "Check results size", 8, results.size() );
-
- query = createMatchQuery( StandardIndexRecordFields.BASE_VERSION, "SNAPSHOT" );
- results = index.search( new LuceneQuery( query ) );
-
- assertTrue( "Check result", results.contains( records.get( "test-child-pom" ) ) );
- assertEquals( "Check results size", 1, results.size() );
-
- query = createMatchQuery( StandardIndexRecordFields.BASE_VERSION, "SnApShOt" );
- results = index.search( new LuceneQuery( query ) );
-
- assertTrue( "Check results size", results.isEmpty() );
-
- query = createMatchQuery( StandardIndexRecordFields.BASE_VERSION, "snapshot" );
- results = index.search( new LuceneQuery( query ) );
-
- assertTrue( "Check results size", results.isEmpty() );
-
- query = createMatchQuery( StandardIndexRecordFields.BASE_VERSION, "alpha" );
- results = index.search( new LuceneQuery( query ) );
-
- assertTrue( "Check result", results.contains( records.get( "test-jar-and-pom" ) ) );
- assertTrue( "Check result", results.contains( records.get( "test-jar-and-pom-jdk14" ) ) );
- assertEquals( "Check results size", 2, results.size() );
-
- query = createMatchQuery( StandardIndexRecordFields.BASE_VERSION, "1.0-alpha-1" );
- results = index.search( new LuceneQuery( query ) );
-
- assertTrue( "Check result", results.contains( records.get( "test-jar-and-pom" ) ) );
- assertTrue( "Check result", results.contains( records.get( "test-jar-and-pom-jdk14" ) ) );
- assertEquals( "Check results size", 2, results.size() );
-
- // test non-match fails
- query = createMatchQuery( StandardIndexRecordFields.BASE_VERSION, "foo" );
- results = index.search( new LuceneQuery( query ) );
-
- assertTrue( "Check results size", results.isEmpty() );
- }
-
- public void testMatchClassifier()
- throws RepositoryIndexSearchException, ParseException
- {
- BooleanQuery bQuery = new BooleanQuery();
- bQuery.add( new MatchAllDocsQuery(), BooleanClause.Occur.MUST );
- bQuery.add( createMatchQuery( StandardIndexRecordFields.CLASSIFIER, "jdk14" ), BooleanClause.Occur.MUST_NOT );
- List results = index.search( new LuceneQuery( bQuery ) );
-
- assertFalse( "Check result", results.contains( records.get( "test-jar-jdk14" ) ) );
- assertFalse( "Check result", results.contains( records.get( "test-jar-and-pom-jdk14" ) ) );
- assertEquals( "Check results size", 8, results.size() );
-
- // TODO: can we search for "anything with no classifier" ?
-
- Query query = createMatchQuery( StandardIndexRecordFields.CLASSIFIER, "jdk14" );
- results = index.search( new LuceneQuery( query ) );
-
- assertTrue( "Check result", results.contains( records.get( "test-jar-jdk14" ) ) );
- assertTrue( "Check result", results.contains( records.get( "test-jar-and-pom-jdk14" ) ) );
- assertEquals( "Check results size", 2, results.size() );
-
- // test non-match fails
- query = createMatchQuery( StandardIndexRecordFields.CLASSIFIER, "foo" );
- results = index.search( new LuceneQuery( query ) );
-
- assertTrue( "Check results size", results.isEmpty() );
- }
-
- public void testMatchClass()
- throws RepositoryIndexSearchException, ParseException
- {
- Query query = createMatchQuery( StandardIndexRecordFields.CLASSES, "b.c.C" );
- List results = index.search( new LuceneQuery( query ) );
-
- assertTrue( "Check result", results.contains( records.get( "test-child-pom" ) ) );
- assertTrue( "Check result", results.contains( records.get( "test-jar" ) ) );
- assertTrue( "Check result", results.contains( records.get( "test-jar-jdk14" ) ) );
- assertTrue( "Check result", results.contains( records.get( "test-jar-and-pom" ) ) );
- assertTrue( "Check result", results.contains( records.get( "test-jar-and-pom-jdk14" ) ) );
- assertEquals( "Check results size", 5, results.size() );
-
- query = createMatchQuery( StandardIndexRecordFields.CLASSES, "C" );
- results = index.search( new LuceneQuery( query ) );
-
- assertTrue( "Check result", results.contains( records.get( "test-child-pom" ) ) );
- assertTrue( "Check result", results.contains( records.get( "test-jar" ) ) );
- assertTrue( "Check result", results.contains( records.get( "test-jar-jdk14" ) ) );
- assertTrue( "Check result", results.contains( records.get( "test-jar-and-pom" ) ) );
- assertTrue( "Check result", results.contains( records.get( "test-jar-and-pom-jdk14" ) ) );
- assertEquals( "Check results size", 5, results.size() );
-
- query = createMatchQuery( StandardIndexRecordFields.CLASSES, "MyMojo" );
- results = index.search( new LuceneQuery( query ) );
-
- assertTrue( "Check result", results.contains( records.get( "test-plugin" ) ) );
- assertEquals( "Check results size", 1, results.size() );
-
- query = createMatchQuery( StandardIndexRecordFields.CLASSES, "MYMOJO" );
- results = index.search( new LuceneQuery( query ) );
-
- assertTrue( "Check result", results.contains( records.get( "test-plugin" ) ) );
- assertEquals( "Check results size", 1, results.size() );
-
- query = createMatchQuery( StandardIndexRecordFields.CLASSES, "mymojo" );
- results = index.search( new LuceneQuery( query ) );
-
- assertTrue( "Check result", results.contains( records.get( "test-plugin" ) ) );
- assertEquals( "Check results size", 1, results.size() );
-
- // test non-match fails
- query = createMatchQuery( StandardIndexRecordFields.CLASSES, "foo" );
- results = index.search( new LuceneQuery( query ) );
-
- assertTrue( "Check results size", results.isEmpty() );
- }
-
- public void testMatchFiles()
- throws RepositoryIndexSearchException, ParseException
- {
- Query query = createMatchQuery( StandardIndexRecordFields.FILES, "MANIFEST.MF" );
- List results = index.search( new LuceneQuery( query ) );
-
- assertFalse( "Check result", results.contains( records.get( "test-pom" ) ) );
- assertFalse( "Check result", results.contains( records.get( "parent-pom" ) ) );
- assertFalse( "Check result", results.contains( records.get( "test-dll" ) ) );
- assertEquals( "Check results size", 7, results.size() );
-
- query = createMatchQuery( StandardIndexRecordFields.FILES, "META-INF" );
- results = index.search( new LuceneQuery( query ) );
-
- assertFalse( "Check result", results.contains( records.get( "test-pom" ) ) );
- assertFalse( "Check result", results.contains( records.get( "parent-pom" ) ) );
- assertFalse( "Check result", results.contains( records.get( "test-dll" ) ) );
- assertEquals( "Check results size", 7, results.size() );
-
- query = createMatchQuery( StandardIndexRecordFields.FILES, "plugin.xml" );
- results = index.search( new LuceneQuery( query ) );
-
- assertTrue( "Check result", results.contains( records.get( "test-plugin" ) ) );
- assertEquals( "Check results size", 1, results.size() );
-
- // test non-match fails
- query = createMatchQuery( StandardIndexRecordFields.FILES, "foo" );
- results = index.search( new LuceneQuery( query ) );
-
- assertTrue( "Check results size", results.isEmpty() );
- }
-
- public void testExactMatchDependency()
- throws RepositoryIndexSearchException
- {
- Query query =
- createExactMatchQuery( StandardIndexRecordFields.DEPENDENCIES, "org.apache.maven:maven-plugin-api:2.0" );
- List results = index.search( new LuceneQuery( query ) );
-
- assertTrue( "Check result", results.contains( records.get( "test-plugin" ) ) );
- assertEquals( "Check results size", 1, results.size() );
-
- // test non-match fails
- query = createExactMatchQuery( StandardIndexRecordFields.DEPENDENCIES, "foo" );
- results = index.search( new LuceneQuery( query ) );
-
- assertTrue( "Check results size", results.isEmpty() );
- }
-
- public void testMatchProjectName()
- throws RepositoryIndexSearchException, ParseException
- {
- Query query = createMatchQuery( StandardIndexRecordFields.PROJECT_NAME, "mojo" );
- List results = index.search( new LuceneQuery( query ) );
-
- assertTrue( "Check result", results.contains( records.get( "test-plugin" ) ) );
- assertEquals( "Check results size", 1, results.size() );
-
- query = createMatchQuery( StandardIndexRecordFields.PROJECT_NAME, "maven" );
- results = index.search( new LuceneQuery( query ) );
-
- assertFalse( "Check result", results.contains( records.get( "parent-pom" ) ) );
- assertFalse( "Check result", results.contains( records.get( "test-child-pom" ) ) );
- assertEquals( "Check results size", 2, results.size() );
-
- // test non-match fails
- query = createMatchQuery( StandardIndexRecordFields.PROJECT_NAME, "foo" );
- results = index.search( new LuceneQuery( query ) );
-
- assertTrue( "Check results size", results.isEmpty() );
- }
-
- public void testMatchProjectDescription()
- throws RepositoryIndexSearchException, ParseException
- {
- Query query = createMatchQuery( StandardIndexRecordFields.PROJECT_DESCRIPTION, "description" );
- List results = index.search( new LuceneQuery( query ) );
-
- assertTrue( "Check result", results.contains( records.get( "test-child-pom" ) ) );
- assertTrue( "Check result", results.contains( records.get( "parent-pom" ) ) );
- assertTrue( "Check result", results.contains( records.get( "test-pom" ) ) );
- assertEquals( "Check results size", 3, results.size() );
-
- // test non-match fails
- query = createMatchQuery( StandardIndexRecordFields.PROJECT_DESCRIPTION, "foo" );
- results = index.search( new LuceneQuery( query ) );
-
- assertTrue( "Check results size", results.isEmpty() );
- }
-
- private static Query createExactMatchQuery( String field, String value )
- {
- return new TermQuery( new Term( field, value ) );
- }
-
- private static Query createMatchQuery( String field, String value )
- throws ParseException
- {
- return new QueryParser( field, LuceneRepositoryArtifactIndex.getAnalyzer() ).parse( value );
- }
-
- private Artifact createArtifact( String artifactId )
- {
- return createArtifact( artifactId, "1.0", "jar", null );
- }
-
- private Artifact createArtifact( String artifactId, String version, String type )
- {
- return createArtifact( artifactId, version, type, null );
- }
-
- private Artifact createArtifact( String artifactId, String version, String type, String classifier )
- {
- Artifact artifact = artifactFactory.createDependencyArtifact( "org.apache.maven.archiva.record", artifactId,
- VersionRange.createFromVersion( version ), type,
- classifier, Artifact.SCOPE_RUNTIME );
- artifact.isSnapshot();
- artifact.setFile( new File( repository.getBasedir(), repository.pathOf( artifact ) ) );
- artifact.setRepository( repository );
- return artifact;
- }
-}
diff --git a/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/lucene/LuceneStandardArtifactIndexTest.java b/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/lucene/LuceneStandardArtifactIndexTest.java
deleted file mode 100644
index 34fe5992a..000000000
--- a/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/lucene/LuceneStandardArtifactIndexTest.java
+++ /dev/null
@@ -1,409 +0,0 @@
-package org.apache.maven.archiva.indexer.lucene;
-
-/*
- * 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.
- */
-
-import org.apache.commons.io.FileUtils;
-import org.apache.lucene.document.Document;
-import org.apache.lucene.document.NumberTools;
-import org.apache.lucene.index.IndexReader;
-import org.apache.lucene.index.IndexWriter;
-import org.apache.maven.archiva.indexer.RepositoryArtifactIndex;
-import org.apache.maven.archiva.indexer.RepositoryArtifactIndexFactory;
-import org.apache.maven.archiva.indexer.RepositoryIndexException;
-import org.apache.maven.archiva.indexer.record.RepositoryIndexRecord;
-import org.apache.maven.archiva.indexer.record.RepositoryIndexRecordFactory;
-import org.apache.maven.archiva.indexer.record.StandardIndexRecordFields;
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.factory.ArtifactFactory;
-import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
-import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
-import org.codehaus.plexus.PlexusTestCase;
-import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
-
-import java.io.File;
-import java.io.IOException;
-import java.text.SimpleDateFormat;
-import java.util.Collections;
-import java.util.Date;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Locale;
-import java.util.TimeZone;
-
-/**
- * Test the Lucene implementation of the artifact index.
- *
- * @author <a href="mailto:brett@apache.org">Brett Porter</a>
- */
-public class LuceneStandardArtifactIndexTest
- extends PlexusTestCase
-{
- private RepositoryArtifactIndex index;
-
- private ArtifactRepository repository;
-
- private ArtifactFactory artifactFactory;
-
- private File indexLocation;
-
- private RepositoryIndexRecordFactory recordFactory;
-
- protected void setUp()
- throws Exception
- {
- super.setUp();
-
- recordFactory = (RepositoryIndexRecordFactory) lookup( RepositoryIndexRecordFactory.ROLE, "standard" );
-
- artifactFactory = (ArtifactFactory) lookup( ArtifactFactory.ROLE );
-
- ArtifactRepositoryFactory repositoryFactory =
- (ArtifactRepositoryFactory) lookup( ArtifactRepositoryFactory.ROLE );
-
- ArtifactRepositoryLayout layout = (ArtifactRepositoryLayout) lookup( ArtifactRepositoryLayout.ROLE, "default" );
-
- File file = getTestFile( "src/test/managed-repository" );
- repository =
- repositoryFactory.createArtifactRepository( "test", file.toURI().toURL().toString(), layout, null, null );
-
- RepositoryArtifactIndexFactory factory =
- (RepositoryArtifactIndexFactory) lookup( RepositoryArtifactIndexFactory.ROLE, "lucene" );
-
- indexLocation = getTestFile( "target/test-index" );
-
- FileUtils.deleteDirectory( indexLocation );
-
- index = factory.createStandardIndex( indexLocation );
- }
-
- public void testIndexExists()
- throws IOException, RepositoryIndexException
- {
- assertFalse( "check index doesn't exist", index.exists() );
-
- // create empty directory
- indexLocation.mkdirs();
- assertFalse( "check index doesn't exist even if directory does", index.exists() );
-
- // create index, with no records
- createEmptyIndex();
- assertTrue( "check index is considered to exist", index.exists() );
-
- // Test non-directory
- FileUtils.deleteDirectory( indexLocation );
- indexLocation.createNewFile();
- try
- {
- index.exists();
- fail( "Index operation should fail as the location is not valid" );
- }
- catch ( RepositoryIndexException e )
- {
- // great
- }
- finally
- {
- indexLocation.delete();
- }
- }
-
- public void testAddRecordNoIndex()
- throws IOException, RepositoryIndexException
- {
- Artifact artifact = createArtifact( "test-jar" );
-
- RepositoryIndexRecord record = recordFactory.createRecord( artifact );
- index.indexRecords( Collections.singletonList( record ) );
-
- IndexReader reader = IndexReader.open( indexLocation );
- try
- {
- Document document = reader.document( 0 );
- assertJarRecord( artifact, document );
- assertEquals( "Check index size", 1, reader.numDocs() );
- }
- finally
- {
- reader.close();
- }
- }
-
- public void testAddRecordExistingEmptyIndex()
- throws IOException, RepositoryIndexException
- {
- createEmptyIndex();
-
- Artifact artifact = createArtifact( "test-jar" );
-
- RepositoryIndexRecord record = recordFactory.createRecord( artifact );
- index.indexRecords( Collections.singletonList( record ) );
-
- IndexReader reader = IndexReader.open( indexLocation );
- try
- {
- Document document = reader.document( 0 );
- assertJarRecord( artifact, document );
- assertEquals( "Check index size", 1, reader.numDocs() );
- }
- finally
- {
- reader.close();
- }
- }
-
- public void testAddRecordInIndex()
- throws IOException, RepositoryIndexException
- {
- createEmptyIndex();
-
- Artifact artifact = createArtifact( "test-jar" );
-
- RepositoryIndexRecord record = recordFactory.createRecord( artifact );
- index.indexRecords( Collections.singletonList( record ) );
-
- // Do it again
- record = recordFactory.createRecord( artifact );
- index.indexRecords( Collections.singletonList( record ) );
-
- IndexReader reader = IndexReader.open( indexLocation );
- try
- {
- Document document = reader.document( 0 );
- assertJarRecord( artifact, document );
- assertEquals( "Check index size", 1, reader.numDocs() );
- }
- finally
- {
- reader.close();
- }
- }
-
- public void testAddPomRecord()
- throws IOException, RepositoryIndexException
- {
- createEmptyIndex();
-
- Artifact artifact = createArtifact( "test-pom", "1.0", "pom" );
-
- RepositoryIndexRecord record = recordFactory.createRecord( artifact );
- index.indexRecords( Collections.singletonList( record ) );
-
- IndexReader reader = IndexReader.open( indexLocation );
- try
- {
- Document document = reader.document( 0 );
- assertPomRecord( artifact, document );
- assertEquals( "Check index size", 1, reader.numDocs() );
- }
- finally
- {
- reader.close();
- }
- }
-
- public void testAddPlugin()
- throws IOException, RepositoryIndexException, XmlPullParserException
- {
- createEmptyIndex();
-
- Artifact artifact = createArtifact( "test-plugin" );
-
- RepositoryIndexRecord record = recordFactory.createRecord( artifact );
-
- index.indexRecords( Collections.singletonList( record ) );
-
- IndexReader reader = IndexReader.open( indexLocation );
- try
- {
- Document document = reader.document( 0 );
- assertPluginRecord( artifact, document );
- assertEquals( "Check index size", 1, reader.numDocs() );
- }
- finally
- {
- reader.close();
- }
- }
-
- public void testDeleteRecordInIndex()
- throws IOException, RepositoryIndexException
- {
- createEmptyIndex();
-
- Artifact artifact = createArtifact( "test-jar" );
-
- RepositoryIndexRecord record = recordFactory.createRecord( artifact );
- index.indexRecords( Collections.singletonList( record ) );
-
- index.deleteRecords( Collections.singletonList( record ) );
-
- IndexReader reader = IndexReader.open( indexLocation );
- try
- {
- assertEquals( "No documents", 0, reader.numDocs() );
- }
- finally
- {
- reader.close();
- }
- }
-
- public void testDeleteRecordNotInIndex()
- throws IOException, RepositoryIndexException
- {
- createEmptyIndex();
-
- Artifact artifact = createArtifact( "test-jar" );
-
- RepositoryIndexRecord record = recordFactory.createRecord( artifact );
-
- index.deleteRecords( Collections.singletonList( record ) );
-
- IndexReader reader = IndexReader.open( indexLocation );
- try
- {
- assertEquals( "No documents", 0, reader.numDocs() );
- }
- finally
- {
- reader.close();
- }
- }
-
- public void testDeleteRecordNoIndex()
- throws IOException, RepositoryIndexException
- {
- Artifact artifact = createArtifact( "test-jar" );
-
- RepositoryIndexRecord record = recordFactory.createRecord( artifact );
- index.deleteRecords( Collections.singleton( record ) );
-
- assertFalse( index.exists() );
- }
-
- private Artifact createArtifact( String artifactId )
- {
- return createArtifact( artifactId, "1.0", "jar" );
- }
-
- private Artifact createArtifact( String artifactId, String version, String type )
- {
- Artifact artifact =
- artifactFactory.createBuildArtifact( "org.apache.maven.archiva.record", artifactId, version, type );
- artifact.setFile( new File( repository.getBasedir(), repository.pathOf( artifact ) ) );
- artifact.setRepository( repository );
- return artifact;
- }
-
- private void createEmptyIndex()
- throws IOException
- {
- createIndex( Collections.EMPTY_LIST );
- }
-
- private void createIndex( List docments )
- throws IOException
- {
- IndexWriter writer = new IndexWriter( indexLocation, LuceneRepositoryArtifactIndex.getAnalyzer(), true );
- for ( Iterator i = docments.iterator(); i.hasNext(); )
- {
- Document document = (Document) i.next();
- writer.addDocument( document );
- }
- writer.optimize();
- writer.close();
- }
-
- private void assertRecord( Artifact artifact, Document document, String expectedArtifactId, String expectedType,
- String expectedMd5, String expectedSha1 )
- {
- assertEquals( "Check document filename", repository.pathOf( artifact ),
- document.get( StandardIndexRecordFields.FILENAME ) );
- assertEquals( "Check document groupId", "org.apache.maven.archiva.record",
- document.get( StandardIndexRecordFields.GROUPID ) );
- assertEquals( "Check document artifactId", expectedArtifactId,
- document.get( StandardIndexRecordFields.ARTIFACTID ) );
- assertEquals( "Check document version", "1.0", document.get( StandardIndexRecordFields.VERSION ) );
- assertEquals( "Check document type", expectedType, document.get( StandardIndexRecordFields.TYPE ) );
- assertEquals( "Check document repository", "test", document.get( StandardIndexRecordFields.REPOSITORY ) );
- assertEquals( "Check document timestamp", getLastModified( artifact.getFile() ),
- document.get( StandardIndexRecordFields.LAST_MODIFIED ) );
- assertEquals( "Check document md5", expectedMd5, document.get( StandardIndexRecordFields.MD5 ) );
- assertEquals( "Check document sha1", expectedSha1, document.get( StandardIndexRecordFields.SHA1 ) );
- assertEquals( "Check document file size", artifact.getFile().length(),
- NumberTools.stringToLong( document.get( StandardIndexRecordFields.FILE_SIZE ) ) );
- assertNull( "Check document classifier", document.get( StandardIndexRecordFields.CLASSIFIER ) );
- }
-
- private void assertPomRecord( Artifact artifact, Document document )
- {
- assertRecord( artifact, document, "test-pom", "pom", "758e1ae96dff63dab7278a62e3eb174d",
- "770fde06cd5c3dccb5f5e8c6754b8c4c77b98560" );
- assertNull( "Check document classes", document.get( StandardIndexRecordFields.CLASSES ) );
- assertNull( "Check document files", document.get( StandardIndexRecordFields.FILES ) );
- assertNull( "Check document pluginPrefix", document.get( StandardIndexRecordFields.PLUGIN_PREFIX ) );
- assertEquals( "Check document year", "2005", document.get( StandardIndexRecordFields.INCEPTION_YEAR ) );
- assertEquals( "Check document project name", "Maven Repository Manager Test POM",
- document.get( StandardIndexRecordFields.PROJECT_NAME ) );
- assertEquals( "Check document project description", "Description",
- document.get( StandardIndexRecordFields.PROJECT_DESCRIPTION ) );
- assertEquals( "Check document packaging", "pom", document.get( StandardIndexRecordFields.PACKAGING ) );
- }
-
- private void assertJarRecord( Artifact artifact, Document document )
- {
- assertRecord( artifact, document, "test-jar", "jar", "3a0adc365f849366cd8b633cad155cb7",
- "c66f18bf192cb613fc2febb4da541a34133eedc2" );
- assertEquals( "Check document classes", "A\nb.B\nb.c.C", document.get( StandardIndexRecordFields.CLASSES ) );
- assertEquals( "Check document files", "META-INF/MANIFEST.MF\nA.class\nb/B.class\nb/c/C.class",
- document.get( StandardIndexRecordFields.FILES ) );
- assertNull( "Check document inceptionYear", document.get( StandardIndexRecordFields.INCEPTION_YEAR ) );
- assertNull( "Check document projectName", document.get( StandardIndexRecordFields.PROJECT_NAME ) );
- assertNull( "Check document projectDesc", document.get( StandardIndexRecordFields.PROJECT_DESCRIPTION ) );
- assertNull( "Check document pluginPrefix", document.get( StandardIndexRecordFields.PLUGIN_PREFIX ) );
- assertNull( "Check document packaging", document.get( StandardIndexRecordFields.PACKAGING ) );
- }
-
- private void assertPluginRecord( Artifact artifact, Document document )
- {
- assertRecord( artifact, document, "test-plugin", "maven-plugin", "3530896791670ebb45e17708e5d52c40",
- "2cd2619d59a684e82e97471d2c2e004144c8f24e" );
- assertEquals( "Check document classes", "org.apache.maven.archiva.record.MyMojo",
- document.get( StandardIndexRecordFields.CLASSES ) );
- assertEquals( "Check document files", "META-INF/MANIFEST.MF\n" +
- "META-INF/maven/org.apache.maven.archiva.record/test-plugin/pom.properties\n" +
- "META-INF/maven/org.apache.maven.archiva.record/test-plugin/pom.xml\n" + "META-INF/maven/plugin.xml\n" +
- "org/apache/maven/archiva/record/MyMojo.class", document.get( StandardIndexRecordFields.FILES ) );
- assertEquals( "Check document pluginPrefix", "test", document.get( StandardIndexRecordFields.PLUGIN_PREFIX ) );
- assertEquals( "Check document packaging", "maven-plugin", document.get( StandardIndexRecordFields.PACKAGING ) );
- assertNull( "Check document inceptionYear", document.get( StandardIndexRecordFields.INCEPTION_YEAR ) );
- assertEquals( "Check document project name", "Maven Mojo Archetype",
- document.get( StandardIndexRecordFields.PROJECT_NAME ) );
- assertNull( "Check document projectDesc", document.get( StandardIndexRecordFields.PROJECT_DESCRIPTION ) );
- }
-
- private String getLastModified( File file )
- {
- SimpleDateFormat dateFormat = new SimpleDateFormat( "yyyyMMddHHmmss", Locale.US );
- dateFormat.setTimeZone( TimeZone.getTimeZone( "UTC" ) );
- return dateFormat.format( new Date( file.lastModified() ) );
- }
-}
diff --git a/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/query/QueryTest.java b/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/query/QueryTest.java
deleted file mode 100644
index b0cc88e98..000000000
--- a/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/query/QueryTest.java
+++ /dev/null
@@ -1,159 +0,0 @@
-package org.apache.maven.archiva.indexer.query;
-
-/*
- * 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.
- */
-
-import junit.framework.TestCase;
-
-import java.util.Iterator;
-
-/**
- * @author Brett Porter
- */
-public class QueryTest
- extends TestCase
-{
- private QueryTerm term1 = new QueryTerm( "field1", "value1" );
-
- private QueryTerm term2 = new QueryTerm( "field2", "value2" );
-
- private QueryTerm term3 = new QueryTerm( "field3", "value3" );
-
- public void testQueryTerm()
- {
- QueryTerm query = new QueryTerm( "Field", "Value" );
- assertEquals( "check field setting", "Field", query.getField() );
- assertEquals( "check value setting", "Value", query.getValue() );
- }
-
- public void testSingleTermQuery()
- {
- SingleTermQuery query = new SingleTermQuery( "Field", "Value" );
- assertEquals( "check field setting", "Field", query.getField() );
- assertEquals( "check value setting", "Value", query.getValue() );
-
- query = new SingleTermQuery( term1 );
- assertEquals( "check field setting", "field1", query.getField() );
- assertEquals( "check value setting", "value1", query.getValue() );
- }
-
- public void testRangeQueryOpen()
- {
- RangeQuery rangeQuery = RangeQuery.createOpenRange();
- assertNull( "Check range has no start", rangeQuery.getBegin() );
- assertNull( "Check range has no end", rangeQuery.getEnd() );
- }
-
- public void testRangeQueryExclusive()
- {
- RangeQuery rangeQuery = RangeQuery.createExclusiveRange( term1, term2 );
- assertEquals( "Check range start", term1, rangeQuery.getBegin() );
- assertEquals( "Check range end", term2, rangeQuery.getEnd() );
- assertFalse( "Check exclusive", rangeQuery.isInclusive() );
- }
-
- public void testRangeQueryInclusive()
- {
- RangeQuery rangeQuery = RangeQuery.createInclusiveRange( term1, term2 );
- assertEquals( "Check range start", term1, rangeQuery.getBegin() );
- assertEquals( "Check range end", term2, rangeQuery.getEnd() );
- assertTrue( "Check inclusive", rangeQuery.isInclusive() );
- }
-
- public void testRangeQueryOpenEnded()
- {
- RangeQuery rangeQuery = RangeQuery.createGreaterThanOrEqualToRange( term1 );
- assertEquals( "Check range start", term1, rangeQuery.getBegin() );
- assertNull( "Check range end", rangeQuery.getEnd() );
- assertTrue( "Check inclusive", rangeQuery.isInclusive() );
-
- rangeQuery = RangeQuery.createGreaterThanRange( term1 );
- assertEquals( "Check range start", term1, rangeQuery.getBegin() );
- assertNull( "Check range end", rangeQuery.getEnd() );
- assertFalse( "Check exclusive", rangeQuery.isInclusive() );
-
- rangeQuery = RangeQuery.createLessThanOrEqualToRange( term1 );
- assertNull( "Check range start", rangeQuery.getBegin() );
- assertEquals( "Check range end", term1, rangeQuery.getEnd() );
- assertTrue( "Check inclusive", rangeQuery.isInclusive() );
-
- rangeQuery = RangeQuery.createLessThanRange( term1 );
- assertNull( "Check range start", rangeQuery.getBegin() );
- assertEquals( "Check range end", term1, rangeQuery.getEnd() );
- assertFalse( "Check exclusive", rangeQuery.isInclusive() );
- }
-
- public void testCompundQuery()
- {
- CompoundQuery query = new CompoundQuery();
- assertTrue( "check query is empty", query.getCompoundQueryTerms().isEmpty() );
-
- query.and( term1 );
- query.or( term2 );
- query.not( term3 );
-
- Iterator i = query.getCompoundQueryTerms().iterator();
- CompoundQueryTerm term = (CompoundQueryTerm) i.next();
- assertEquals( "Check first term", "field1", getQuery( term ).getField() );
- assertEquals( "Check first term", "value1", getQuery( term ).getValue() );
- assertTrue( "Check first term", term.isRequired() );
- assertFalse( "Check first term", term.isProhibited() );
-
- term = (CompoundQueryTerm) i.next();
- assertEquals( "Check second term", "field2", getQuery( term ).getField() );
- assertEquals( "Check second term", "value2", getQuery( term ).getValue() );
- assertFalse( "Check second term", term.isRequired() );
- assertFalse( "Check second term", term.isProhibited() );
-
- term = (CompoundQueryTerm) i.next();
- assertEquals( "Check third term", "field3", getQuery( term ).getField() );
- assertEquals( "Check third term", "value3", getQuery( term ).getValue() );
- assertFalse( "Check third term", term.isRequired() );
- assertTrue( "Check third term", term.isProhibited() );
-
- CompoundQuery query2 = new CompoundQuery();
- query2.and( query );
- query2.or( new SingleTermQuery( term2 ) );
- query2.not( new SingleTermQuery( term3 ) );
-
- i = query2.getCompoundQueryTerms().iterator();
- term = (CompoundQueryTerm) i.next();
- assertEquals( "Check first term", query, term.getQuery() );
- assertTrue( "Check first term", term.isRequired() );
- assertFalse( "Check first term", term.isProhibited() );
-
- term = (CompoundQueryTerm) i.next();
- assertEquals( "Check second term", "field2", getQuery( term ).getField() );
- assertEquals( "Check second term", "value2", getQuery( term ).getValue() );
- assertFalse( "Check second term", term.isRequired() );
- assertFalse( "Check second term", term.isProhibited() );
-
- term = (CompoundQueryTerm) i.next();
- assertEquals( "Check third term", "field3", getQuery( term ).getField() );
- assertEquals( "Check third term", "value3", getQuery( term ).getValue() );
- assertFalse( "Check third term", term.isRequired() );
- assertTrue( "Check third term", term.isProhibited() );
- }
-
- private static SingleTermQuery getQuery( CompoundQueryTerm term )
- {
- return (SingleTermQuery) term.getQuery();
- }
-}
-
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
deleted file mode 100644
index 527e77ab3..000000000
--- a/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/record/MinimalArtifactIndexRecordFactoryTest.java
+++ /dev/null
@@ -1,249 +0,0 @@
-package org.apache.maven.archiva.indexer.record;
-
-/*
- * 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.
- */
-
-import org.apache.maven.archiva.indexer.RepositoryIndexException;
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.factory.ArtifactFactory;
-import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
-import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
-import org.apache.maven.artifact.versioning.VersionRange;
-import org.codehaus.plexus.PlexusTestCase;
-import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-
-/**
- * Test the minimal artifact index record.
- *
- * @author <a href="mailto:brett@apache.org">Brett Porter</a>
- */
-public class MinimalArtifactIndexRecordFactoryTest
- extends PlexusTestCase
-{
- private RepositoryIndexRecordFactory factory;
-
- private ArtifactRepository repository;
-
- private ArtifactFactory artifactFactory;
-
- private static final String TEST_GROUP_ID = "org.apache.maven.archiva.record";
-
- private static final List JAR_CLASS_LIST = Arrays.asList( new String[]{"A", "b.B", "b.c.C"} );
-
- protected void setUp()
- throws Exception
- {
- super.setUp();
-
- factory = (RepositoryIndexRecordFactory) lookup( RepositoryIndexRecordFactory.ROLE, "minimal" );
-
- artifactFactory = (ArtifactFactory) lookup( ArtifactFactory.ROLE );
-
- ArtifactRepositoryFactory repositoryFactory =
- (ArtifactRepositoryFactory) lookup( ArtifactRepositoryFactory.ROLE );
-
- ArtifactRepositoryLayout layout = (ArtifactRepositoryLayout) lookup( ArtifactRepositoryLayout.ROLE, "default" );
-
- File file = getTestFile( "src/test/managed-repository" );
- repository =
- repositoryFactory.createArtifactRepository( "test", file.toURI().toURL().toString(), layout, null, null );
- }
-
- public void testIndexedJar()
- throws RepositoryIndexException
- {
- Artifact artifact = createArtifact( "test-jar" );
-
- RepositoryIndexRecord record = factory.createRecord( artifact );
-
- MinimalArtifactIndexRecord expectedRecord = new MinimalArtifactIndexRecord();
- expectedRecord.setMd5Checksum( "3a0adc365f849366cd8b633cad155cb7" );
- expectedRecord.setFilename( repository.pathOf( artifact ) );
- expectedRecord.setLastModified( artifact.getFile().lastModified() );
- expectedRecord.setSize( artifact.getFile().length() );
- expectedRecord.setClasses( JAR_CLASS_LIST );
-
- assertEquals( "check record", expectedRecord, record );
- }
-
- public void testIndexedJarWithClassifier()
- throws RepositoryIndexException
- {
- Artifact artifact = createArtifact( "test-jar", "1.0", "jar", "jdk14" );
-
- RepositoryIndexRecord record = factory.createRecord( artifact );
-
- MinimalArtifactIndexRecord expectedRecord = new MinimalArtifactIndexRecord();
- expectedRecord.setMd5Checksum( "3a0adc365f849366cd8b633cad155cb7" );
- expectedRecord.setFilename( repository.pathOf( artifact ) );
- expectedRecord.setLastModified( artifact.getFile().lastModified() );
- expectedRecord.setSize( artifact.getFile().length() );
- expectedRecord.setClasses( JAR_CLASS_LIST );
-
- assertEquals( "check record", expectedRecord, record );
- }
-
- public void testIndexedJarAndPom()
- throws RepositoryIndexException
- {
- Artifact artifact = createArtifact( "test-jar-and-pom", "1.0-alpha-1", "jar" );
-
- RepositoryIndexRecord record = factory.createRecord( artifact );
-
- MinimalArtifactIndexRecord expectedRecord = new MinimalArtifactIndexRecord();
- expectedRecord.setMd5Checksum( "3a0adc365f849366cd8b633cad155cb7" );
- expectedRecord.setFilename( repository.pathOf( artifact ) );
- expectedRecord.setLastModified( artifact.getFile().lastModified() );
- expectedRecord.setSize( artifact.getFile().length() );
- expectedRecord.setClasses( JAR_CLASS_LIST );
-
- assertEquals( "check record", expectedRecord, record );
- }
-
- public void testIndexedJarAndPomWithClassifier()
- throws RepositoryIndexException
- {
- Artifact artifact = createArtifact( "test-jar-and-pom", "1.0-alpha-1", "jar", "jdk14" );
-
- RepositoryIndexRecord record = factory.createRecord( artifact );
-
- MinimalArtifactIndexRecord expectedRecord = new MinimalArtifactIndexRecord();
- expectedRecord.setMd5Checksum( "3a0adc365f849366cd8b633cad155cb7" );
- expectedRecord.setFilename( repository.pathOf( artifact ) );
- expectedRecord.setLastModified( artifact.getFile().lastModified() );
- expectedRecord.setSize( artifact.getFile().length() );
- expectedRecord.setClasses( JAR_CLASS_LIST );
-
- assertEquals( "check record", expectedRecord, record );
- }
-
- public void testIndexedPom()
- throws RepositoryIndexException
- {
- Artifact artifact = createArtifact( "test-pom", "1.0", "pom" );
-
- RepositoryIndexRecord record = factory.createRecord( artifact );
-
- assertNull( "Check no record", record );
- }
-
- public void testNonIndexedPom()
- throws RepositoryIndexException
- {
- // If we pass in only the POM that belongs to a JAR, then expect null not the POM
- Artifact artifact = createArtifact( "test-jar-and-pom", "1.0-alpha-1", "pom" );
-
- RepositoryIndexRecord record = factory.createRecord( artifact );
-
- assertNull( "Check no record", record );
-
- artifact = createArtifact( "test-plugin", "1.0", "pom" );
-
- record = factory.createRecord( artifact );
-
- assertNull( "Check no record", record );
-
- artifact = createArtifact( "test-archetype", "1.0", "pom" );
-
- 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()
- throws RepositoryIndexException, IOException, XmlPullParserException
- {
- Artifact artifact = createArtifact( "test-plugin" );
-
- RepositoryIndexRecord record = factory.createRecord( artifact );
-
- MinimalArtifactIndexRecord expectedRecord = new MinimalArtifactIndexRecord();
- expectedRecord.setMd5Checksum( "3530896791670ebb45e17708e5d52c40" );
- expectedRecord.setFilename( repository.pathOf( artifact ) );
- expectedRecord.setLastModified( artifact.getFile().lastModified() );
- expectedRecord.setSize( artifact.getFile().length() );
- expectedRecord.setClasses( Collections.singletonList( "org.apache.maven.archiva.record.MyMojo" ) );
-
- assertEquals( "check record", expectedRecord, record );
- }
-
- public void testCorruptJar()
- throws RepositoryIndexException
- {
- Artifact artifact = createArtifact( "test-corrupt-jar" );
-
- RepositoryIndexRecord record = factory.createRecord( artifact );
-
- assertNull( "Confirm no record is returned", record );
- }
-
- public void testNonJar()
- throws RepositoryIndexException
- {
- Artifact artifact = createArtifact( "test-dll", "1.0.1.34", "dll" );
-
- RepositoryIndexRecord record = factory.createRecord( artifact );
-
- assertNull( "Confirm no record is returned", record );
- }
-
- public void testMissingFile()
- throws RepositoryIndexException
- {
- Artifact artifact = createArtifact( "test-foo" );
-
- RepositoryIndexRecord record = factory.createRecord( artifact );
-
- assertNull( "Confirm no record is returned", record );
- }
-
- private Artifact createArtifact( String artifactId )
- {
- return createArtifact( artifactId, "1.0", "jar" );
- }
-
- private Artifact createArtifact( String artifactId, String version, String type )
- {
- return createArtifact( artifactId, version, type, null );
- }
-
- private Artifact createArtifact( String artifactId, String version, String type, String classifier )
- {
- Artifact artifact = artifactFactory.createDependencyArtifact( TEST_GROUP_ID, artifactId,
- VersionRange.createFromVersion( version ), type,
- classifier, Artifact.SCOPE_RUNTIME );
- artifact.isSnapshot();
- artifact.setFile( new File( repository.getBasedir(), repository.pathOf( artifact ) ) );
- artifact.setRepository( repository );
- return artifact;
- }
-}
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
deleted file mode 100644
index 9f1d1e456..000000000
--- a/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/record/StandardArtifactIndexRecordFactoryTest.java
+++ /dev/null
@@ -1,446 +0,0 @@
-package org.apache.maven.archiva.indexer.record;
-
-/*
- * 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.
- */
-
-import org.apache.maven.archiva.indexer.RepositoryIndexException;
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.factory.ArtifactFactory;
-import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
-import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
-import org.apache.maven.artifact.versioning.VersionRange;
-import org.codehaus.plexus.PlexusTestCase;
-import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-
-/**
- * Test the minimal artifact index record.
- *
- * @author <a href="mailto:brett@apache.org">Brett Porter</a>
- */
-public class StandardArtifactIndexRecordFactoryTest
- extends PlexusTestCase
-{
- private RepositoryIndexRecordFactory factory;
-
- private ArtifactRepository repository;
-
- private ArtifactFactory artifactFactory;
-
- private static final String TEST_GROUP_ID = "org.apache.maven.archiva.record";
-
- private static final List JAR_CLASS_LIST = Arrays.asList( new String[]{"A", "b.B", "b.c.C"} );
-
- private static final List JAR_FILE_LIST =
- Arrays.asList( new String[]{"META-INF/MANIFEST.MF", "A.class", "b/B.class", "b/c/C.class"} );
-
- private static final String JUNIT_DEPENDENCY = "junit:junit:3.8.1";
-
- private static final String PLUGIN_API_DEPENDENCY = "org.apache.maven:maven-plugin-api:2.0";
-
- protected void setUp()
- throws Exception
- {
- super.setUp();
-
- factory = (RepositoryIndexRecordFactory) lookup( RepositoryIndexRecordFactory.ROLE, "standard" );
-
- artifactFactory = (ArtifactFactory) lookup( ArtifactFactory.ROLE );
-
- ArtifactRepositoryFactory repositoryFactory =
- (ArtifactRepositoryFactory) lookup( ArtifactRepositoryFactory.ROLE );
-
- ArtifactRepositoryLayout layout = (ArtifactRepositoryLayout) lookup( ArtifactRepositoryLayout.ROLE, "default" );
-
- File file = getTestFile( "src/test/managed-repository" );
- repository =
- repositoryFactory.createArtifactRepository( "test", file.toURI().toURL().toString(), layout, null, null );
- }
-
- public void testIndexedJar()
- throws RepositoryIndexException
- {
- Artifact artifact = createArtifact( "test-jar" );
-
- RepositoryIndexRecord record = factory.createRecord( artifact );
-
- StandardArtifactIndexRecord expectedRecord = new StandardArtifactIndexRecord();
- expectedRecord.setMd5Checksum( "3a0adc365f849366cd8b633cad155cb7" );
- expectedRecord.setFilename( repository.pathOf( artifact ) );
- expectedRecord.setLastModified( artifact.getFile().lastModified() );
- expectedRecord.setSize( artifact.getFile().length() );
- expectedRecord.setClasses( JAR_CLASS_LIST );
- expectedRecord.setArtifactId( "test-jar" );
- expectedRecord.setGroupId( TEST_GROUP_ID );
- expectedRecord.setBaseVersion( "1.0" );
- expectedRecord.setVersion( "1.0" );
- expectedRecord.setFiles( JAR_FILE_LIST );
- expectedRecord.setSha1Checksum( "c66f18bf192cb613fc2febb4da541a34133eedc2" );
- expectedRecord.setType( "jar" );
- expectedRecord.setRepository( "test" );
-
- assertEquals( "check record", expectedRecord, record );
- }
-
- public void testIndexedJarWithClassifier()
- throws RepositoryIndexException
- {
- Artifact artifact = createArtifact( "test-jar", "1.0", "jar", "jdk14" );
-
- RepositoryIndexRecord record = factory.createRecord( artifact );
-
- StandardArtifactIndexRecord expectedRecord = new StandardArtifactIndexRecord();
- expectedRecord.setMd5Checksum( "3a0adc365f849366cd8b633cad155cb7" );
- expectedRecord.setFilename( repository.pathOf( artifact ) );
- expectedRecord.setLastModified( artifact.getFile().lastModified() );
- expectedRecord.setSize( artifact.getFile().length() );
- expectedRecord.setClasses( JAR_CLASS_LIST );
- expectedRecord.setArtifactId( "test-jar" );
- expectedRecord.setGroupId( TEST_GROUP_ID );
- expectedRecord.setBaseVersion( "1.0" );
- expectedRecord.setVersion( "1.0" );
- expectedRecord.setFiles( JAR_FILE_LIST );
- expectedRecord.setSha1Checksum( "c66f18bf192cb613fc2febb4da541a34133eedc2" );
- expectedRecord.setType( "jar" );
- expectedRecord.setRepository( "test" );
- expectedRecord.setClassifier( "jdk14" );
-
- assertEquals( "check record", expectedRecord, record );
- }
-
- public void testIndexedJarAndPom()
- throws RepositoryIndexException
- {
- Artifact artifact = createArtifact( "test-jar-and-pom", "1.0-alpha-1", "jar" );
-
- RepositoryIndexRecord record = factory.createRecord( artifact );
-
- StandardArtifactIndexRecord expectedRecord = new StandardArtifactIndexRecord();
- expectedRecord.setMd5Checksum( "3a0adc365f849366cd8b633cad155cb7" );
- expectedRecord.setFilename( repository.pathOf( artifact ) );
- expectedRecord.setLastModified( artifact.getFile().lastModified() );
- expectedRecord.setSize( artifact.getFile().length() );
- expectedRecord.setClasses( JAR_CLASS_LIST );
- expectedRecord.setArtifactId( "test-jar-and-pom" );
- expectedRecord.setGroupId( TEST_GROUP_ID );
- expectedRecord.setBaseVersion( "1.0-alpha-1" );
- expectedRecord.setVersion( "1.0-alpha-1" );
- expectedRecord.setFiles( JAR_FILE_LIST );
- expectedRecord.setSha1Checksum( "c66f18bf192cb613fc2febb4da541a34133eedc2" );
- expectedRecord.setType( "jar" );
- expectedRecord.setRepository( "test" );
- expectedRecord.setPackaging( "jar" );
- expectedRecord.setProjectName( "Test JAR and POM" );
- expectedRecord.setDependencies( createDependencies() );
- expectedRecord.setDevelopers( createDevelopers() );
-
- assertEquals( "check record", expectedRecord, record );
- }
-
- public void testIndexedJarAndPomWithClassifier()
- throws RepositoryIndexException
- {
- Artifact artifact = createArtifact( "test-jar-and-pom", "1.0-alpha-1", "jar", "jdk14" );
-
- RepositoryIndexRecord record = factory.createRecord( artifact );
-
- StandardArtifactIndexRecord expectedRecord = new StandardArtifactIndexRecord();
- expectedRecord.setMd5Checksum( "3a0adc365f849366cd8b633cad155cb7" );
- expectedRecord.setFilename( repository.pathOf( artifact ) );
- expectedRecord.setLastModified( artifact.getFile().lastModified() );
- expectedRecord.setSize( artifact.getFile().length() );
- expectedRecord.setClasses( JAR_CLASS_LIST );
- expectedRecord.setArtifactId( "test-jar-and-pom" );
- expectedRecord.setGroupId( TEST_GROUP_ID );
- expectedRecord.setBaseVersion( "1.0-alpha-1" );
- expectedRecord.setVersion( "1.0-alpha-1" );
- expectedRecord.setFiles( JAR_FILE_LIST );
- expectedRecord.setSha1Checksum( "c66f18bf192cb613fc2febb4da541a34133eedc2" );
- expectedRecord.setType( "jar" );
- expectedRecord.setRepository( "test" );
- expectedRecord.setPackaging( "jar" );
- expectedRecord.setProjectName( "Test JAR and POM" );
- expectedRecord.setClassifier( "jdk14" );
- expectedRecord.setDependencies( createDependencies() );
- expectedRecord.setDevelopers( createDevelopers() );
-
- assertEquals( "check record", expectedRecord, record );
- }
-
- public void testIndexedJarWithParentPom()
- throws RepositoryIndexException
- {
- Artifact artifact = createArtifact( "test-child-pom", "1.0-20060728.121314-1", "jar" );
-
- RepositoryIndexRecord record = factory.createRecord( artifact );
-
- StandardArtifactIndexRecord expectedRecord = new StandardArtifactIndexRecord();
- expectedRecord.setMd5Checksum( "3a0adc365f849366cd8b633cad155cb7" );
- expectedRecord.setFilename( repository.pathOf( artifact ) );
- expectedRecord.setLastModified( artifact.getFile().lastModified() );
- expectedRecord.setSize( artifact.getFile().length() );
- expectedRecord.setClasses( JAR_CLASS_LIST );
- expectedRecord.setArtifactId( "test-child-pom" );
- expectedRecord.setGroupId( TEST_GROUP_ID );
- expectedRecord.setBaseVersion( "1.0-SNAPSHOT" );
- expectedRecord.setVersion( "1.0-20060728.121314-1" );
- expectedRecord.setFiles( JAR_FILE_LIST );
- expectedRecord.setSha1Checksum( "c66f18bf192cb613fc2febb4da541a34133eedc2" );
- expectedRecord.setType( "jar" );
- expectedRecord.setRepository( "test" );
- expectedRecord.setPackaging( "jar" );
- expectedRecord.setProjectName( "Child Project" );
- expectedRecord.setProjectDescription( "Description" );
- expectedRecord.setInceptionYear( "2005" );
- expectedRecord.setDependencies( Collections.singletonList( JUNIT_DEPENDENCY ) );
-
- assertEquals( "check record", expectedRecord, record );
- }
-
- public void testIndexedPom()
- throws RepositoryIndexException
- {
- Artifact artifact = createArtifact( "test-pom", "1.0", "pom" );
-
- RepositoryIndexRecord record = factory.createRecord( artifact );
-
- StandardArtifactIndexRecord expectedRecord = new StandardArtifactIndexRecord();
- expectedRecord.setMd5Checksum( "758e1ae96dff63dab7278a62e3eb174d" );
- expectedRecord.setFilename( repository.pathOf( artifact ) );
- expectedRecord.setLastModified( artifact.getFile().lastModified() );
- expectedRecord.setSize( artifact.getFile().length() );
- expectedRecord.setArtifactId( "test-pom" );
- expectedRecord.setGroupId( TEST_GROUP_ID );
- expectedRecord.setBaseVersion( "1.0" );
- expectedRecord.setVersion( "1.0" );
- expectedRecord.setSha1Checksum( "770fde06cd5c3dccb5f5e8c6754b8c4c77b98560" );
- expectedRecord.setType( "pom" );
- expectedRecord.setRepository( "test" );
- expectedRecord.setPackaging( "pom" );
- expectedRecord.setInceptionYear( "2005" );
- expectedRecord.setProjectName( "Maven Repository Manager Test POM" );
- expectedRecord.setProjectDescription( "Description" );
-
- assertEquals( "check record", expectedRecord, record );
- }
-
- public void testNonIndexedPom()
- throws RepositoryIndexException
- {
- // If we pass in only the POM that belongs to a JAR, then expect null not the POM
- Artifact artifact = createArtifact( "test-jar-and-pom", "1.0", "pom" );
-
- RepositoryIndexRecord record = factory.createRecord( artifact );
-
- assertNull( "Check no record", record );
-
- artifact = createArtifact( "test-plugin", "1.0", "pom" );
-
- record = factory.createRecord( artifact );
-
- assertNull( "Check no record", record );
-
- artifact = createArtifact( "test-archetype", "1.0", "pom" );
-
- 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()
- throws RepositoryIndexException, IOException, XmlPullParserException
- {
- Artifact artifact = createArtifact( "test-plugin" );
-
- RepositoryIndexRecord record = factory.createRecord( artifact );
-
- StandardArtifactIndexRecord expectedRecord = new StandardArtifactIndexRecord();
- expectedRecord.setMd5Checksum( "3530896791670ebb45e17708e5d52c40" );
- expectedRecord.setFilename( repository.pathOf( artifact ) );
- expectedRecord.setLastModified( artifact.getFile().lastModified() );
- expectedRecord.setSize( artifact.getFile().length() );
- expectedRecord.setArtifactId( "test-plugin" );
- expectedRecord.setGroupId( TEST_GROUP_ID );
- expectedRecord.setBaseVersion( "1.0" );
- expectedRecord.setVersion( "1.0" );
- expectedRecord.setSha1Checksum( "2cd2619d59a684e82e97471d2c2e004144c8f24e" );
- expectedRecord.setType( "maven-plugin" );
- expectedRecord.setRepository( "test" );
- expectedRecord.setClasses( Arrays.asList( new String[]{"org.apache.maven.archiva.record.MyMojo"} ) );
- expectedRecord.setFiles( Arrays.asList( new String[]{"META-INF/MANIFEST.MF",
- "META-INF/maven/org.apache.maven.archiva.record/test-plugin/pom.properties",
- "META-INF/maven/org.apache.maven.archiva.record/test-plugin/pom.xml", "META-INF/maven/plugin.xml",
- "org/apache/maven/archiva/record/MyMojo.class"} ) );
- expectedRecord.setPackaging( "maven-plugin" );
- expectedRecord.setProjectName( "Maven Mojo Archetype" );
- expectedRecord.setPluginPrefix( "test" );
- expectedRecord.setDependencies( Arrays.asList( new String[]{JUNIT_DEPENDENCY, PLUGIN_API_DEPENDENCY} ) );
-
- assertEquals( "check record", expectedRecord, record );
- }
-
- public void testIndexedArchetype()
- throws RepositoryIndexException, IOException, XmlPullParserException
- {
- Artifact artifact = createArtifact( "test-archetype" );
-
- RepositoryIndexRecord record = factory.createRecord( artifact );
-
- StandardArtifactIndexRecord expectedRecord = new StandardArtifactIndexRecord();
- expectedRecord.setMd5Checksum( "52b7ea4b53818b8a5f4c329d88fd60d9" );
- expectedRecord.setFilename( repository.pathOf( artifact ) );
- expectedRecord.setLastModified( artifact.getFile().lastModified() );
- expectedRecord.setSize( artifact.getFile().length() );
- expectedRecord.setArtifactId( "test-archetype" );
- expectedRecord.setGroupId( TEST_GROUP_ID );
- expectedRecord.setBaseVersion( "1.0" );
- expectedRecord.setVersion( "1.0" );
- expectedRecord.setSha1Checksum( "05841f5e51c124f1729d86c1687438c36b9255d9" );
- expectedRecord.setType( "maven-archetype" );
- expectedRecord.setRepository( "test" );
- expectedRecord.setFiles( Arrays.asList( new String[]{"META-INF/MANIFEST.MF", "META-INF/maven/archetype.xml",
- "META-INF/maven/org.apache.maven.archiva.record/test-archetype/pom.properties",
- "META-INF/maven/org.apache.maven.archiva.record/test-archetype/pom.xml", "archetype-resources/pom.xml",
- "archetype-resources/src/main/java/App.java", "archetype-resources/src/test/java/AppTest.java"} ) );
- expectedRecord.setPackaging( "jar" );
- expectedRecord.setProjectName( "Archetype - test-archetype" );
-
- 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
- {
- Artifact artifact = createArtifact( "test-corrupt-jar" );
-
- RepositoryIndexRecord record = factory.createRecord( artifact );
-
- assertNull( "Confirm no record is returned", record );
- }
-
- public void testDll()
- throws RepositoryIndexException
- {
- Artifact artifact = createArtifact( "test-dll", "1.0.1.34", "dll" );
-
- RepositoryIndexRecord record = factory.createRecord( artifact );
-
- StandardArtifactIndexRecord expectedRecord = new StandardArtifactIndexRecord();
- expectedRecord.setMd5Checksum( "d41d8cd98f00b204e9800998ecf8427e" );
- expectedRecord.setFilename( repository.pathOf( artifact ) );
- expectedRecord.setLastModified( artifact.getFile().lastModified() );
- expectedRecord.setSize( artifact.getFile().length() );
- expectedRecord.setArtifactId( "test-dll" );
- expectedRecord.setGroupId( TEST_GROUP_ID );
- expectedRecord.setBaseVersion( "1.0.1.34" );
- expectedRecord.setVersion( "1.0.1.34" );
- expectedRecord.setSha1Checksum( "da39a3ee5e6b4b0d3255bfef95601890afd80709" );
- expectedRecord.setType( "dll" );
- expectedRecord.setRepository( "test" );
-
- assertEquals( "check record", expectedRecord, record );
- }
-
- public void testMissingFile()
- throws RepositoryIndexException
- {
- Artifact artifact = createArtifact( "test-foo" );
-
- RepositoryIndexRecord record = factory.createRecord( artifact );
-
- assertNull( "Confirm no record is returned", record );
- }
-
- private Artifact createArtifact( String artifactId )
- {
- return createArtifact( artifactId, "1.0", "jar" );
- }
-
- private Artifact createArtifact( String artifactId, String version, String type )
- {
- return createArtifact( artifactId, version, type, null );
- }
-
- private Artifact createArtifact( String artifactId, String version, String type, String classifier )
- {
- Artifact artifact = artifactFactory.createDependencyArtifact( TEST_GROUP_ID, artifactId,
- VersionRange.createFromVersion( version ), type,
- classifier, Artifact.SCOPE_RUNTIME );
- artifact.isSnapshot();
- artifact.setFile( new File( repository.getBasedir(), repository.pathOf( artifact ) ) );
- artifact.setRepository( repository );
- return artifact;
- }
-
- private static List createDevelopers()
- {
- List developers = new ArrayList();
- developers.add( "brett:Brett Porter:brett@apache.org" );
- return developers;
- }
-
- private static List createDependencies()
- {
- List dependencies = new ArrayList();
- dependencies.add( JUNIT_DEPENDENCY );
- dependencies.add( "org.apache.maven:maven-project:2.0" );
- return dependencies;
- }
-}
diff --git a/archiva-indexer/src/test/managed-repository/org/apache/maven/archiva/record/parent-pom/1/parent-pom-1.pom b/archiva-indexer/src/test/managed-repository/org/apache/maven/archiva/record/parent-pom/1/parent-pom-1.pom
deleted file mode 100644
index b4d864fdb..000000000
--- a/archiva-indexer/src/test/managed-repository/org/apache/maven/archiva/record/parent-pom/1/parent-pom-1.pom
+++ /dev/null
@@ -1,41 +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.
- -->
-<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>parent-pom</artifactId>
- <version>1</version>
- <packaging>pom</packaging>
- <name>Test Parent POM</name>
- <description>Description</description>
- <inceptionYear>2005</inceptionYear>
- <dependencies>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>3.8.1</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
- <modules>
- <module>test-child-pom</module>
- </modules>
-</project>
-
diff --git a/archiva-indexer/src/test/managed-repository/org/apache/maven/archiva/record/test-archetype/1.0/test-archetype-1.0.jar b/archiva-indexer/src/test/managed-repository/org/apache/maven/archiva/record/test-archetype/1.0/test-archetype-1.0.jar
deleted file mode 100644
index 6b5db4295..000000000
--- a/archiva-indexer/src/test/managed-repository/org/apache/maven/archiva/record/test-archetype/1.0/test-archetype-1.0.jar
+++ /dev/null
Binary files differ
diff --git a/archiva-indexer/src/test/managed-repository/org/apache/maven/archiva/record/test-archetype/1.0/test-archetype-1.0.pom b/archiva-indexer/src/test/managed-repository/org/apache/maven/archiva/record/test-archetype/1.0/test-archetype-1.0.pom
deleted file mode 100644
index d2492aaf3..000000000
--- a/archiva-indexer/src/test/managed-repository/org/apache/maven/archiva/record/test-archetype/1.0/test-archetype-1.0.pom
+++ /dev/null
@@ -1,27 +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.
- -->
-
-<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-archetype</artifactId>
- <version>1.0</version>
- <name>Archetype - test-archetype</name>
-</project>
diff --git a/archiva-indexer/src/test/managed-repository/org/apache/maven/archiva/record/test-child-pom/1.0-SNAPSHOT/test-child-pom-1.0-20060728.121314-1.jar b/archiva-indexer/src/test/managed-repository/org/apache/maven/archiva/record/test-child-pom/1.0-SNAPSHOT/test-child-pom-1.0-20060728.121314-1.jar
deleted file mode 100644
index b78be2eb8..000000000
--- a/archiva-indexer/src/test/managed-repository/org/apache/maven/archiva/record/test-child-pom/1.0-SNAPSHOT/test-child-pom-1.0-20060728.121314-1.jar
+++ /dev/null
Binary files differ
diff --git a/archiva-indexer/src/test/managed-repository/org/apache/maven/archiva/record/test-child-pom/1.0-SNAPSHOT/test-child-pom-1.0-20060728.121314-1.pom b/archiva-indexer/src/test/managed-repository/org/apache/maven/archiva/record/test-child-pom/1.0-SNAPSHOT/test-child-pom-1.0-20060728.121314-1.pom
deleted file mode 100644
index 7c2b68f67..000000000
--- a/archiva-indexer/src/test/managed-repository/org/apache/maven/archiva/record/test-child-pom/1.0-SNAPSHOT/test-child-pom-1.0-20060728.121314-1.pom
+++ /dev/null
@@ -1,31 +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.
- -->
-
-<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>
- <parent>
- <groupId>org.apache.maven.archiva.record</groupId>
- <artifactId>parent-pom</artifactId>
- <version>1</version>
- </parent>
- <artifactId>test-child-pom</artifactId>
- <version>1.0-20060731-121314-1</version>
- <name>Child Project</name>
-</project>
diff --git a/archiva-indexer/src/test/managed-repository/org/apache/maven/archiva/record/test-corrupt-jar/1.0/test-corrupt-jar-1.0.jar b/archiva-indexer/src/test/managed-repository/org/apache/maven/archiva/record/test-corrupt-jar/1.0/test-corrupt-jar-1.0.jar
deleted file mode 100644
index e69de29bb..000000000
--- a/archiva-indexer/src/test/managed-repository/org/apache/maven/archiva/record/test-corrupt-jar/1.0/test-corrupt-jar-1.0.jar
+++ /dev/null
diff --git a/archiva-indexer/src/test/managed-repository/org/apache/maven/archiva/record/test-dll/1.0.1.34/test-dll-1.0.1.34.dll b/archiva-indexer/src/test/managed-repository/org/apache/maven/archiva/record/test-dll/1.0.1.34/test-dll-1.0.1.34.dll
deleted file mode 100644
index e69de29bb..000000000
--- a/archiva-indexer/src/test/managed-repository/org/apache/maven/archiva/record/test-dll/1.0.1.34/test-dll-1.0.1.34.dll
+++ /dev/null
diff --git a/archiva-indexer/src/test/managed-repository/org/apache/maven/archiva/record/test-jar-and-pom/1.0-alpha-1/test-jar-and-pom-1.0-alpha-1-jdk14.jar b/archiva-indexer/src/test/managed-repository/org/apache/maven/archiva/record/test-jar-and-pom/1.0-alpha-1/test-jar-and-pom-1.0-alpha-1-jdk14.jar
deleted file mode 100644
index b78be2eb8..000000000
--- a/archiva-indexer/src/test/managed-repository/org/apache/maven/archiva/record/test-jar-and-pom/1.0-alpha-1/test-jar-and-pom-1.0-alpha-1-jdk14.jar
+++ /dev/null
Binary files differ
diff --git a/archiva-indexer/src/test/managed-repository/org/apache/maven/archiva/record/test-jar-and-pom/1.0-alpha-1/test-jar-and-pom-1.0-alpha-1.jar b/archiva-indexer/src/test/managed-repository/org/apache/maven/archiva/record/test-jar-and-pom/1.0-alpha-1/test-jar-and-pom-1.0-alpha-1.jar
deleted file mode 100644
index b78be2eb8..000000000
--- a/archiva-indexer/src/test/managed-repository/org/apache/maven/archiva/record/test-jar-and-pom/1.0-alpha-1/test-jar-and-pom-1.0-alpha-1.jar
+++ /dev/null
Binary files differ
diff --git a/archiva-indexer/src/test/managed-repository/org/apache/maven/archiva/record/test-jar-and-pom/1.0-alpha-1/test-jar-and-pom-1.0-alpha-1.pom b/archiva-indexer/src/test/managed-repository/org/apache/maven/archiva/record/test-jar-and-pom/1.0-alpha-1/test-jar-and-pom-1.0-alpha-1.pom
deleted file mode 100644
index 4585fe6dd..000000000
--- a/archiva-indexer/src/test/managed-repository/org/apache/maven/archiva/record/test-jar-and-pom/1.0-alpha-1/test-jar-and-pom-1.0-alpha-1.pom
+++ /dev/null
@@ -1,50 +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.
- -->
-
-<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-jar-and-pom</artifactId>
- <version>1.0-alpha-1</version>
- <name>Test JAR and POM</name>
- <dependencies>
- <dependency>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-project</artifactId>
- <version>2.0</version>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>3.8.1</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
- <developers>
- <developer>
- <id>brett</id>
- <name>Brett Porter</name>
- <email>brett@apache.org</email>
- <roles>
- <role>Developer</role>
- </roles>
- </developer>
- </developers>
-</project>
diff --git a/archiva-indexer/src/test/managed-repository/org/apache/maven/archiva/record/test-jar/1.0/test-jar-1.0-jdk14.jar b/archiva-indexer/src/test/managed-repository/org/apache/maven/archiva/record/test-jar/1.0/test-jar-1.0-jdk14.jar
deleted file mode 100644
index b78be2eb8..000000000
--- a/archiva-indexer/src/test/managed-repository/org/apache/maven/archiva/record/test-jar/1.0/test-jar-1.0-jdk14.jar
+++ /dev/null
Binary files differ
diff --git a/archiva-indexer/src/test/managed-repository/org/apache/maven/archiva/record/test-jar/1.0/test-jar-1.0.jar b/archiva-indexer/src/test/managed-repository/org/apache/maven/archiva/record/test-jar/1.0/test-jar-1.0.jar
deleted file mode 100644
index b78be2eb8..000000000
--- a/archiva-indexer/src/test/managed-repository/org/apache/maven/archiva/record/test-jar/1.0/test-jar-1.0.jar
+++ /dev/null
Binary files differ
diff --git a/archiva-indexer/src/test/managed-repository/org/apache/maven/archiva/record/test-plugin/1.0/test-plugin-1.0.jar b/archiva-indexer/src/test/managed-repository/org/apache/maven/archiva/record/test-plugin/1.0/test-plugin-1.0.jar
deleted file mode 100644
index 1c0b105fe..000000000
--- a/archiva-indexer/src/test/managed-repository/org/apache/maven/archiva/record/test-plugin/1.0/test-plugin-1.0.jar
+++ /dev/null
Binary files differ
diff --git a/archiva-indexer/src/test/managed-repository/org/apache/maven/archiva/record/test-plugin/1.0/test-plugin-1.0.pom b/archiva-indexer/src/test/managed-repository/org/apache/maven/archiva/record/test-plugin/1.0/test-plugin-1.0.pom
deleted file mode 100644
index a5d4a9043..000000000
--- a/archiva-indexer/src/test/managed-repository/org/apache/maven/archiva/record/test-plugin/1.0/test-plugin-1.0.pom
+++ /dev/null
@@ -1,41 +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.
- -->
-
-<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-plugin</artifactId>
- <packaging>maven-plugin</packaging>
- <version>1.0</version>
- <name>Maven Mojo Archetype</name>
- <dependencies>
- <dependency>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-plugin-api</artifactId>
- <version>2.0</version>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>3.8.1</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-</project>
diff --git a/archiva-indexer/src/test/managed-repository/org/apache/maven/archiva/record/test-pom/1.0/test-pom-1.0.pom b/archiva-indexer/src/test/managed-repository/org/apache/maven/archiva/record/test-pom/1.0/test-pom-1.0.pom
deleted file mode 100644
index bff7d34cd..000000000
--- a/archiva-indexer/src/test/managed-repository/org/apache/maven/archiva/record/test-pom/1.0/test-pom-1.0.pom
+++ /dev/null
@@ -1,30 +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.
- -->
-
-<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-pom</artifactId>
- <version>1.0</version>
- <name>Maven Repository Manager Test POM</name>
- <inceptionYear>2005</inceptionYear>
- <description>Description</description>
- <packaging>pom</packaging>
-</project>
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
deleted file mode 100644
index 99bd1e78b..000000000
--- a/archiva-indexer/src/test/managed-repository/org/apache/maven/archiva/record/test-skin/1.0/test-skin-1.0.jar
+++ /dev/null
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
deleted file mode 100644
index 48a67d622..000000000
--- a/archiva-indexer/src/test/managed-repository/org/apache/maven/archiva/record/test-skin/1.0/test-skin-1.0.pom
+++ /dev/null
@@ -1,27 +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.
- -->
-
-<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>
diff --git a/archiva-indexer/src/test/repository/org/apache/maven/maven-artifact/2.0.1/maven-artifact-2.0.1.jar b/archiva-indexer/src/test/repository/org/apache/maven/maven-artifact/2.0.1/maven-artifact-2.0.1.jar
deleted file mode 100644
index 14fa95ab9..000000000
--- a/archiva-indexer/src/test/repository/org/apache/maven/maven-artifact/2.0.1/maven-artifact-2.0.1.jar
+++ /dev/null
Binary files differ
diff --git a/archiva-indexer/src/test/repository/org/apache/maven/maven-artifact/2.0.1/maven-artifact-2.0.1.pom b/archiva-indexer/src/test/repository/org/apache/maven/maven-artifact/2.0.1/maven-artifact-2.0.1.pom
deleted file mode 100644
index 726c01830..000000000
--- a/archiva-indexer/src/test/repository/org/apache/maven/maven-artifact/2.0.1/maven-artifact-2.0.1.pom
+++ /dev/null
@@ -1,64 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ 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.
- -->
-
-<project>
- <parent>
- <artifactId>maven</artifactId>
- <groupId>org.apache.maven</groupId>
- <version>2.0.1</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-artifact</artifactId>
- <name>Maven Artifact</name>
- <version>2.0.1</version>
- <licenses>
- <license>
- <name>The Apache Software License, Version 2.0</name>
- <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
- <distribution>repo</distribution>
- </license>
- </licenses>
- <dependencies>
- <dependency>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-utils</artifactId>
- <version>1.0.5</version>
- </dependency>
- <dependency>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-container-default</artifactId>
- <version>1.0-alpha-9</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
- <distributionManagement>
- <status>deployed</status>
- </distributionManagement>
- <reporting>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-checkstyle-plugin</artifactId>
- <version>2.0</version>
- </plugin>
- </plugins>
- </reporting>
-</project> \ No newline at end of file
diff --git a/archiva-indexer/src/test/repository/org/apache/maven/maven-artifact/2.0.1/maven-metadata.xml b/archiva-indexer/src/test/repository/org/apache/maven/maven-artifact/2.0.1/maven-metadata.xml
deleted file mode 100644
index c66d54e12..000000000
--- a/archiva-indexer/src/test/repository/org/apache/maven/maven-artifact/2.0.1/maven-metadata.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
- ~ 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.
- -->
-
-<metadata>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-artifact</artifactId>
- <version>2.0.1</version>
-</metadata>
diff --git a/archiva-indexer/src/test/repository/org/apache/maven/maven-artifact/maven-metadata.xml b/archiva-indexer/src/test/repository/org/apache/maven/maven-artifact/maven-metadata.xml
deleted file mode 100644
index da270169f..000000000
--- a/archiva-indexer/src/test/repository/org/apache/maven/maven-artifact/maven-metadata.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
- ~ 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.
- -->
-
-<metadata>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-artifact</artifactId>
- <version>2.0.1</version>
- <versioning>
- <release>2.0.1</release>
- <versions>
- <version>2.0.1</version>
- </versions>
- <lastUpdated>20051212044643</lastUpdated>
- </versioning>
-</metadata>
diff --git a/archiva-indexer/src/test/repository/org/apache/maven/maven-corrupt-jar/2.0/maven-corrupt-jar-2.0.jar b/archiva-indexer/src/test/repository/org/apache/maven/maven-corrupt-jar/2.0/maven-corrupt-jar-2.0.jar
deleted file mode 100644
index e69de29bb..000000000
--- a/archiva-indexer/src/test/repository/org/apache/maven/maven-corrupt-jar/2.0/maven-corrupt-jar-2.0.jar
+++ /dev/null
diff --git a/archiva-indexer/src/test/repository/org/apache/maven/maven-corrupt-jar/2.0/maven-corrupt-jar-2.0.pom b/archiva-indexer/src/test/repository/org/apache/maven/maven-corrupt-jar/2.0/maven-corrupt-jar-2.0.pom
deleted file mode 100644
index 75e761b8c..000000000
--- a/archiva-indexer/src/test/repository/org/apache/maven/maven-corrupt-jar/2.0/maven-corrupt-jar-2.0.pom
+++ /dev/null
@@ -1,114 +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.
- -->
-
-<project>
- <parent>
- <artifactId>maven</artifactId>
- <groupId>org.apache.maven</groupId>
- <version>2.0</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-corrupt-jar</artifactId>
- <name>Maven Model</name>
- <version>2.0</version>
- <description>Maven Model</description>
- <licenses>
- <license>
- <name>The Apache Software License, Version 2.0</name>
- <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
- <distribution>repo</distribution>
- </license>
- </licenses>
- <build>
- <plugins>
- <plugin>
- <groupId>org.codehaus.modello</groupId>
- <artifactId>modello-maven-plugin</artifactId>
- <version>2.0</version>
- <executions>
- <execution>
- <goals>
- <goal>xpp3-writer</goal>
- <goal>java</goal>
- <goal>xpp3-reader</goal>
- <goal>xsd</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <version>4.0.0</version>
- <model>maven.mdo</model>
- </configuration>
- </plugin>
- </plugins>
- </build>
- <profiles>
- <profile>
- <id>all-models</id>
- <build>
- <plugins>
- <plugin>
- <groupId>org.codehaus.modello</groupId>
- <artifactId>modello-maven-plugin</artifactId>
- <executions>
- <execution>
- <id>v3</id>
- <goals>
- <goal>xpp3-writer</goal>
- <goal>java</goal>
- <goal>xpp3-reader</goal>
- <goal>xsd</goal>
- </goals>
- <configuration>
- <version>3.0.0</version>
- <packageWithVersion>true</packageWithVersion>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <artifactId>maven-jar-plugin</artifactId>
- <executions>
- <execution>
- <phase>package</phase>
- <goals>
- <goal>jar</goal>
- </goals>
- <configuration>
- <classifier>all</classifier>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
- <dependencies>
- <dependency>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-utils</artifactId>
- <version>1.0.5</version>
- </dependency>
- </dependencies>
- <distributionManagement>
- <status>deployed</status>
- </distributionManagement>
-</project> \ No newline at end of file
diff --git a/archiva-indexer/src/test/repository/org/apache/maven/maven-metadata.xml b/archiva-indexer/src/test/repository/org/apache/maven/maven-metadata.xml
deleted file mode 100644
index fc9de9c04..000000000
--- a/archiva-indexer/src/test/repository/org/apache/maven/maven-metadata.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
- ~ 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.
- -->
-
-<metadata>
- <groupId>org.apache.maven</groupId>
- <plugins>
- <plugin>
- <prefix>org.apache.maven</prefix>
- <artifactId>org.apache.maven-maven-plugin</artifactId>
- </plugin>
- </plugins>
-</metadata>
diff --git a/archiva-indexer/src/test/repository/org/apache/maven/maven-model/2.0/maven-model-2.0.jar b/archiva-indexer/src/test/repository/org/apache/maven/maven-model/2.0/maven-model-2.0.jar
deleted file mode 100644
index d6820d6fe..000000000
--- a/archiva-indexer/src/test/repository/org/apache/maven/maven-model/2.0/maven-model-2.0.jar
+++ /dev/null
Binary files differ
diff --git a/archiva-indexer/src/test/repository/org/apache/maven/maven-model/2.0/maven-model-2.0.pom b/archiva-indexer/src/test/repository/org/apache/maven/maven-model/2.0/maven-model-2.0.pom
deleted file mode 100644
index 8579fd492..000000000
--- a/archiva-indexer/src/test/repository/org/apache/maven/maven-model/2.0/maven-model-2.0.pom
+++ /dev/null
@@ -1,114 +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.
- -->
-
-<project>
- <parent>
- <artifactId>maven</artifactId>
- <groupId>org.apache.maven</groupId>
- <version>2.0</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-model</artifactId>
- <name>Maven Model</name>
- <version>2.0</version>
- <description>Maven Model</description>
- <licenses>
- <license>
- <name>The Apache Software License, Version 2.0</name>
- <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
- <distribution>repo</distribution>
- </license>
- </licenses>
- <build>
- <plugins>
- <plugin>
- <groupId>org.codehaus.modello</groupId>
- <artifactId>modello-maven-plugin</artifactId>
- <version>2.0</version>
- <executions>
- <execution>
- <goals>
- <goal>xpp3-writer</goal>
- <goal>java</goal>
- <goal>xpp3-reader</goal>
- <goal>xsd</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <version>4.0.0</version>
- <model>maven.mdo</model>
- </configuration>
- </plugin>
- </plugins>
- </build>
- <profiles>
- <profile>
- <id>all-models</id>
- <build>
- <plugins>
- <plugin>
- <groupId>org.codehaus.modello</groupId>
- <artifactId>modello-maven-plugin</artifactId>
- <executions>
- <execution>
- <id>v3</id>
- <goals>
- <goal>xpp3-writer</goal>
- <goal>java</goal>
- <goal>xpp3-reader</goal>
- <goal>xsd</goal>
- </goals>
- <configuration>
- <version>3.0.0</version>
- <packageWithVersion>true</packageWithVersion>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <artifactId>maven-jar-plugin</artifactId>
- <executions>
- <execution>
- <phase>package</phase>
- <goals>
- <goal>jar</goal>
- </goals>
- <configuration>
- <classifier>all</classifier>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
- <dependencies>
- <dependency>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-utils</artifactId>
- <version>1.0.5</version>
- </dependency>
- </dependencies>
- <distributionManagement>
- <status>deployed</status>
- </distributionManagement>
-</project> \ No newline at end of file
diff --git a/archiva-indexer/src/test/repository/test/inherited/test-inherited/1.0.15/test-inherited-1.0.15.pom b/archiva-indexer/src/test/repository/test/inherited/test-inherited/1.0.15/test-inherited-1.0.15.pom
deleted file mode 100644
index 20419b61a..000000000
--- a/archiva-indexer/src/test/repository/test/inherited/test-inherited/1.0.15/test-inherited-1.0.15.pom
+++ /dev/null
@@ -1,30 +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.
- -->
-
-<project>
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>test.inherited</groupId>
- <version>1.0.15</version>
- <artifactId>test-inherited-parent</artifactId>
- </parent>
- <!-- groupID, version are inherited -->
- <artifactId>test-inherited</artifactId>
- <packaging>pom</packaging>
-</project> \ No newline at end of file
diff --git a/archiva-indexer/src/test/repository/test/maven-metadata.xml b/archiva-indexer/src/test/repository/test/maven-metadata.xml
deleted file mode 100644
index 6846739d3..000000000
--- a/archiva-indexer/src/test/repository/test/maven-metadata.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
- ~ 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.
- -->
-
-<metadata>
- <groupId>test</groupId>
- <plugins>
- <plugin>
- <prefix></prefix>
- <artifactId>test-test-plugin</artifactId>
- </plugin>
- </plugins>
-</metadata>
diff --git a/archiva-indexer/src/test/repository/test/test-artifactId/1.0/test-artifactId-1.0.jar b/archiva-indexer/src/test/repository/test/test-artifactId/1.0/test-artifactId-1.0.jar
deleted file mode 100644
index 00eb58b70..000000000
--- a/archiva-indexer/src/test/repository/test/test-artifactId/1.0/test-artifactId-1.0.jar
+++ /dev/null
Binary files differ
diff --git a/archiva-indexer/src/test/repository/test/test-artifactId/1.0/test-artifactId-1.0.pom b/archiva-indexer/src/test/repository/test/test-artifactId/1.0/test-artifactId-1.0.pom
deleted file mode 100644
index f92a25607..000000000
--- a/archiva-indexer/src/test/repository/test/test-artifactId/1.0/test-artifactId-1.0.pom
+++ /dev/null
@@ -1,25 +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.
- -->
-
-<project>
- <modelVersion>4.0.0</modelVersion>
- <groupId>test</groupId>
- <artifactId>test-artifactId</artifactId>
- <version>1.0</version>
-</project> \ No newline at end of file