use of com.github.hakko.musiccabinet.domain.model.aggr.TagOccurrence in project musiccabinet by hakko.
the class JdbcTagDaoTest method retrievesCorrectedAvailableTags.
@Test
public void retrievesCorrectedAvailableTags() {
deleteTags();
for (int i = 0; i < 5; i++) {
artistTopTagsDao.createTopTags(new Artist("artist" + i), Arrays.asList(new Tag("sludge", (short) 100), new Tag("drone", (short) 90), new Tag("e-l-e-c-t-r-o", (short) 50), new Tag("disco", (short) 10)));
}
Map<String, String> tagCorrections = new HashMap<>();
tagCorrections.put("e-l-e-c-t-r-o", "electro");
dao.createTagCorrections(tagCorrections);
dao.setTopTags(Arrays.asList("sludge"));
List<TagOccurrence> tags = dao.getAvailableTags();
Assert.assertEquals(3, tags.size());
Assert.assertEquals("drone", tags.get(0).getTag());
Assert.assertEquals("e-l-e-c-t-r-o", tags.get(1).getTag());
Assert.assertEquals("electro", tags.get(1).getCorrectedTag());
Assert.assertEquals("sludge", tags.get(2).getTag());
Assert.assertFalse(tags.get(0).isUse());
Assert.assertFalse(tags.get(1).isUse());
Assert.assertTrue(tags.get(2).isUse());
}
use of com.github.hakko.musiccabinet.domain.model.aggr.TagOccurrence in project musiccabinet by hakko.
the class TagInfoService method getTagsForUpdate.
protected Set<String> getTagsForUpdate() {
Set<String> tags = new HashSet<>();
for (TagOccurrence tagOccurrence : tagDao.getAvailableTags()) {
tags.add(tagOccurrence.getTag());
}
tags.removeAll(tagInfoDao.getTagsWithInfo());
return tags;
}