mirror of
https://github.com/apache/archiva.git
synced 2025-02-06 18:19:02 +00:00
Fixing up tests. Snapshot versions are now merged in the search action
git-svn-id: https://svn.apache.org/repos/asf/archiva/branches/archiva-search-improvements@726923 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
ad8ffba93b
commit
5210f5f229
@ -126,17 +126,6 @@ private CrossRepositorySearch lookupCrossRepositorySearch()
|
||||
return search;
|
||||
}
|
||||
|
||||
public void testSearchTerm_Org()
|
||||
throws Exception
|
||||
{
|
||||
CrossRepositorySearch search = lookupCrossRepositorySearch();
|
||||
|
||||
SearchResults results = search.searchForTerm( "guest", Arrays.asList(TEST_DEFAULT_REPO_ID), "org", new SearchResultLimits(1) );
|
||||
|
||||
assertNotNull(results);
|
||||
assertEquals(7, results.getHits().size());
|
||||
}
|
||||
|
||||
public void testSearchArtifactIdHasMoreWieghtThanGroupId() throws Exception
|
||||
{
|
||||
CrossRepositorySearch search = lookupCrossRepositorySearch();
|
||||
@ -149,12 +138,6 @@ public void testSearchArtifactIdHasMoreWieghtThanGroupId() throws Exception
|
||||
SearchResultHit hit = new SearchResultHit();
|
||||
hit.setGroupId("ant");
|
||||
hit.setArtifactId("ant");
|
||||
hit.setVersion("1.5.1");
|
||||
expectedHits.add(hit);
|
||||
|
||||
hit = new SearchResultHit();
|
||||
hit.setGroupId("ant");
|
||||
hit.setArtifactId("ant");
|
||||
hit.setVersion("1.5");
|
||||
expectedHits.add(hit);
|
||||
|
||||
@ -194,27 +177,25 @@ public void testSearchForClassesAndPackages()
|
||||
TEST_DEFAULT_REPO_ID
|
||||
};
|
||||
|
||||
// String expectedResults[] = new String[] {
|
||||
// "archiva-common-1.0.jar"
|
||||
// };
|
||||
|
||||
ArrayList<SearchResultHit> expectedHits = new ArrayList<SearchResultHit>();
|
||||
SearchResultHit archivaCommon = new SearchResultHit();
|
||||
archivaCommon.setArtifactId("archiva-common");
|
||||
archivaCommon.setGroupId("org.apache.maven.archiva");
|
||||
archivaCommon.setVersion("1.0");
|
||||
|
||||
// class with packagename search
|
||||
assertSearchResults( expectedRepos, expectedHits, search,
|
||||
assertSearchResults( expectedRepos, Arrays.asList(archivaCommon), search,
|
||||
"org.apache.maven.archiva.common.utils.BaseFile", null, true );
|
||||
// class name search
|
||||
assertSearchResults( expectedRepos, expectedHits, search,
|
||||
assertSearchResults( expectedRepos, Arrays.asList(archivaCommon), search,
|
||||
"BaseFile", null, true );
|
||||
|
||||
// String expectedMethodSearchResults[] = new String[] {
|
||||
// "continuum-webapp-1.0.3-SNAPSHOT.war"
|
||||
// };
|
||||
|
||||
ArrayList<SearchResultHit> expectedMethodSearchResults = new ArrayList<SearchResultHit>();
|
||||
SearchResultHit hit = new SearchResultHit();
|
||||
hit.setGroupId("org.apache.maven.continuum");
|
||||
hit.setArtifactId("continuum-webapp");
|
||||
hit.setVersion("1.0.3-SNAPSHOT");
|
||||
|
||||
// method search
|
||||
assertSearchResults( expectedRepos, expectedMethodSearchResults, search,
|
||||
assertSearchResults( expectedRepos, Arrays.asList(hit), search,
|
||||
"org.apache.maven.continuum.web.action.BuildDefinitionAction.isBuildFresh", null, true );
|
||||
}
|
||||
|
||||
|
@ -286,7 +286,7 @@ public String quickSearch()
|
||||
if (versions != null && !versions.isEmpty())
|
||||
{
|
||||
resultHit.setVersion(null);
|
||||
resultHit.setVersions(filterOutTimestampedSnapshots(versions));
|
||||
resultHit.setVersions(filterTimestampedSnapshots(versions));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -297,7 +297,7 @@ public String quickSearch()
|
||||
/**
|
||||
* Remove timestamped snapshots from versions
|
||||
*/
|
||||
private static List<String> filterOutTimestampedSnapshots(List<String> versions)
|
||||
private static List<String> filterTimestampedSnapshots(List<String> versions)
|
||||
{
|
||||
final List<String> filtered = new ArrayList<String>();
|
||||
for (final String version : versions)
|
||||
|
Loading…
x
Reference in New Issue
Block a user