use of org.nzbhydra.searching.IdentifierKeyValuePair in project nzbhydra2 by theotherp.
the class SqliteMigrationTest method shouldMigrateSearches.
// TODO tests are still for old json based sqlite migration, need to be adapted to actual sqlite access
@Test
@Ignore
public void shouldMigrateSearches() throws Exception {
String searchesJson = Resources.toString(Resources.getResource(SqliteMigrationTest.class, "searches"), Charsets.UTF_8);
List<Map<String, Object>> oldSearches = testee.objectMapper.readValue(searchesJson, testee.listOfMapsTypeReference);
Map<Integer, SearchEntity> searchEntities = testee.migrateSearches();
assertThat(searchEntities.size(), is(4));
SearchEntity entityTv = searchEntities.get(3);
assertThat(entityTv.getAuthor(), is(nullValue()));
assertThat(entityTv.getUsername(), is(nullValue()));
assertThat(entityTv.getSeason(), is(1));
assertThat(entityTv.getEpisode(), is(2));
assertThat(entityTv.getIdentifiers().size(), is(1));
IdentifierKeyValuePair keyValuePair = entityTv.getIdentifiers().iterator().next();
assertThat(keyValuePair.getIdentifierKey(), is(IdType.TVDB.name()));
assertThat(keyValuePair.getIdentifierValue(), is("456"));
assertThat(entityTv.getQuery(), is(nullValue()));
assertThat(entityTv.getSearchType(), is(SearchType.TVSEARCH));
assertThat(entityTv.getCategoryName(), is("TV"));
SearchEntity entityAll = searchEntities.get(2);
assertThat(entityAll.getAuthor(), is(nullValue()));
assertThat(entityAll.getUsername(), is(nullValue()));
assertThat(entityAll.getEpisode(), is(nullValue()));
assertThat(entityAll.getSeason(), is(nullValue()));
assertThat(entityAll.getIdentifiers(), is(empty()));
assertThat(entityAll.getQuery(), is("aquery"));
assertThat(entityAll.getSearchType(), is(SearchType.SEARCH));
assertThat(entityAll.getCategoryName(), is("All"));
}
Aggregations