mirror of https://github.com/apache/archiva.git
Switching to zip file for index test
This commit is contained in:
parent
7c683efd5d
commit
08a51f0eff
|
@ -201,10 +201,10 @@ public abstract class AbstractMavenRepositorySearch
|
|||
}
|
||||
|
||||
protected void createIndex( String repository, List<Path> filesToBeIndexed, boolean scan) throws Exception {
|
||||
createIndex(repository, filesToBeIndexed, scan, null);
|
||||
createIndex(repository, filesToBeIndexed, scan, null, true);
|
||||
}
|
||||
|
||||
protected void createIndex( String repository, List<Path> filesToBeIndexed, boolean scan, Path indexDir)
|
||||
protected void createIndex( String repository, List<Path> filesToBeIndexed, boolean scan, Path indexDir, boolean copyFiles)
|
||||
throws Exception
|
||||
{
|
||||
Repository rRepo = repositoryRegistry.getRepository(repository);
|
||||
|
@ -246,9 +246,11 @@ public abstract class AbstractMavenRepositorySearch
|
|||
|
||||
icf.setIndexPath(indexDir.toUri());
|
||||
}
|
||||
if (copyFiles) {
|
||||
Path repo = Paths.get(org.apache.archiva.common.utils.FileUtils.getBasedir(), "src/test/" + repository);
|
||||
assertTrue(Files.exists(repo));
|
||||
org.apache.commons.io.FileUtils.copyDirectory(repo.toFile(), repoDir.toFile());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ package org.apache.archiva.indexer.maven.search;
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import org.apache.archiva.common.utils.FileUtils;
|
||||
import org.apache.archiva.indexer.search.RepositorySearchException;
|
||||
import org.apache.archiva.indexer.search.SearchFields;
|
||||
import org.apache.archiva.indexer.search.SearchResultHit;
|
||||
|
@ -27,7 +28,6 @@ import org.apache.archiva.indexer.search.SearchResults;
|
|||
import org.apache.archiva.indexer.util.SearchUtil;
|
||||
import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner;
|
||||
import org.apache.maven.index_shaded.lucene.index.IndexUpgrader;
|
||||
import org.codehaus.plexus.util.FileUtils;
|
||||
import org.easymock.EasyMock;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
@ -896,20 +896,18 @@ public class MavenRepositorySearchTest
|
|||
{
|
||||
|
||||
Path repo = Paths.get("target/repo-release");
|
||||
FileUtils.deleteDirectory(repo.toFile());
|
||||
try {
|
||||
Path indexDirectory = repo.resolve(".indexer");
|
||||
FileUtils.copyDirectoryStructure( Paths.get( "src/test/repo-release" ).toFile(), repo.toFile() );
|
||||
|
||||
Path zipFile = Paths.get(Thread.currentThread().getContextClassLoader().getResource("repo-release.zip").toURI());
|
||||
FileUtils.unzip(zipFile, repo.getParent());
|
||||
IndexUpgrader.main(new String[]{indexDirectory.toAbsolutePath().toString()});
|
||||
|
||||
createIndex(REPO_RELEASE, Collections.emptyList(), false, indexDirectory );
|
||||
createIndex(REPO_RELEASE, Collections.emptyList(), false, indexDirectory, false);
|
||||
|
||||
// indexer.addIndexingContext( REPO_RELEASE, REPO_RELEASE, repo.toFile(), indexDirectory.toFile(),
|
||||
// repo.toUri().toURL().toExternalForm(),
|
||||
// indexDirectory.toUri().toURL().toString(), indexCreators );
|
||||
|
||||
|
||||
|
||||
SearchResultLimits limits = new SearchResultLimits(SearchResultLimits.ALL_PAGES);
|
||||
limits.setPageSize(300);
|
||||
|
||||
|
@ -937,5 +935,8 @@ public class MavenRepositorySearchTest
|
|||
assertEquals(255, searchResults.getHits().size());
|
||||
|
||||
archivaConfigControl.verify();
|
||||
} finally {
|
||||
FileUtils.deleteQuietly(repo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue