use of org.nzbhydra.searching.searchrequests.SearchRequest in project nzbhydra2 by theotherp.
the class NzbsOrgTest method shouldLimitQueryLengthWhenAddingRequiredWords.
@Test
public void shouldLimitQueryLengthWhenAddingRequiredWords() throws Exception {
SearchRequest request = new SearchRequest(SearchSource.INTERNAL, SearchType.SEARCH, 0, 100);
request.getInternalData().setRequiredWords(Arrays.asList("characters50sssssssssssssssssssssssssssssssssssss1", "characters50sssssssssssssssssssssssssssssssssssss2", "characters50sssssssssssssssssssssssssssssssssssss3", "characters50sssssssssssssssssssssssssssssssssssss4", "characters40ssssssssssssssssssssssssssss", "aaaaa", "bbbbb"));
String query = testee.addRequiredWords(request, "");
assertThat(query.length()).isLessThan(255);
}
use of org.nzbhydra.searching.searchrequests.SearchRequest in project nzbhydra2 by theotherp.
the class TorznabTest method shouldNotAddExcludedWordsToQuery.
@Test
public void shouldNotAddExcludedWordsToQuery() throws Exception {
SearchRequest searchRequest = new SearchRequest(SearchSource.INTERNAL, SearchType.SEARCH, 0, 100);
searchRequest.getInternalData().setForbiddenWords(Arrays.asList("notthis", "alsonotthis"));
searchRequest.setQuery("query");
UriComponentsBuilder builder = testee.buildSearchUrl(searchRequest, 0, 100);
assertThat(builder.toUriString(), not(containsString("notthis")));
}
use of org.nzbhydra.searching.searchrequests.SearchRequest in project nzbhydra2 by theotherp.
the class AnizbTest method shouldAbortIfSearchNotPossible.
@Test(expected = IndexerSearchAbortedException.class)
public void shouldAbortIfSearchNotPossible() throws IndexerSearchAbortedException {
SearchRequest searchRequest = new SearchRequest(SearchSource.INTERNAL, SearchType.SEARCH, 0, 100);
testee.buildSearchUrl(searchRequest, 0, 100);
}
use of org.nzbhydra.searching.searchrequests.SearchRequest in project nzbhydra2 by theotherp.
the class AnizbTest method shouldBuildSimpleQuery.
@Test
public void shouldBuildSimpleQuery() throws IndexerSearchAbortedException {
SearchRequest searchRequest = new SearchRequest(SearchSource.INTERNAL, SearchType.SEARCH, 0, 100);
searchRequest.setQuery("query");
UriComponentsBuilder builder = testee.buildSearchUrl(searchRequest, 0, 100);
assertThat(builder.toUriString(), is("https://anizb.org/api/?q=query"));
}
use of org.nzbhydra.searching.searchrequests.SearchRequest in project nzbhydra2 by theotherp.
the class BinsearchTest method shouldRecognizeIfMoreResultsAvailable.
@Test
public void shouldRecognizeIfMoreResultsAvailable() throws Exception {
SearchRequest searchRequest = new SearchRequest(SearchSource.INTERNAL, SearchType.SEARCH, 0, 100);
String html = Resources.toString(Resources.getResource(BinsearchTest.class, "/org/nzbhydra/mapping/binsearch.html"), Charsets.UTF_8);
IndexerSearchResult indexerSearchResult = new IndexerSearchResult(testee, "");
testee.completeIndexerSearchResult(html, indexerSearchResult, null, searchRequest);
assertThat(indexerSearchResult.isTotalResultsKnown(), is(false));
assertThat(indexerSearchResult.isHasMoreResults(), is(true));
}
Aggregations