Search in sources :

Example 1 with Newznab

use of org.nzbhydra.indexers.Newznab in project nzbhydra2 by theotherp.

the class DuplicateDetectorTest method setValues.

protected void setValues(SearchResultItem item, String indexerName, String poster, String group, Instant pubDate) {
    item.setAgePrecise(true);
    item.setTitle("title");
    item.setIndexerGuid("123");
    item.setPubDate(pubDate);
    item.setPoster(poster);
    item.setGroup(group);
    item.setSize(10000L);
    Newznab indexer = new Newznab();
    IndexerConfig config = new IndexerConfig();
    config.setName(indexerName);
    IndexerEntity indexerEntity = new IndexerEntity();
    indexerEntity.setName(indexerName);
    indexer.initialize(config, indexerEntity);
    item.setIndexer(indexer);
}
Also used : Newznab(org.nzbhydra.indexers.Newznab) IndexerConfig(org.nzbhydra.config.IndexerConfig) IndexerEntity(org.nzbhydra.indexers.IndexerEntity)

Example 2 with Newznab

use of org.nzbhydra.indexers.Newznab in project nzbhydra2 by theotherp.

the class ResultAcceptorTest method shouldCheckForCategoryDisabledForIndexer.

@Test
public void shouldCheckForCategoryDisabledForIndexer() {
    Indexer indexer = new Newznab();
    indexer.initialize(indexerConfig, new IndexerEntity());
    item.setIndexer(indexer);
    // All categories enabled
    when(indexerConfig.getEnabledCategories()).thenReturn(Collections.emptyList());
    assertTrue(testee.checkForCategoryDisabledForIndexer(searchRequest, HashMultiset.create(), item));
    // Used category enabled
    when(indexerConfig.getEnabledCategories()).thenReturn(Arrays.asList(category.getName()));
    assertTrue(testee.checkForCategoryDisabledForIndexer(searchRequest, HashMultiset.create(), item));
    // Only other category enabled
    when(indexerConfig.getEnabledCategories()).thenReturn(Arrays.asList("Other"));
    assertFalse(testee.checkForCategoryDisabledForIndexer(searchRequest, HashMultiset.create(), item));
}
Also used : Newznab(org.nzbhydra.indexers.Newznab) Indexer(org.nzbhydra.indexers.Indexer) IndexerEntity(org.nzbhydra.indexers.IndexerEntity) Test(org.junit.Test)

Aggregations

IndexerEntity (org.nzbhydra.indexers.IndexerEntity)2 Newznab (org.nzbhydra.indexers.Newznab)2 Test (org.junit.Test)1 IndexerConfig (org.nzbhydra.config.IndexerConfig)1 Indexer (org.nzbhydra.indexers.Indexer)1