Search in sources :

Example 1 with TagOccurrence

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());
}
Also used : Artist(com.github.hakko.musiccabinet.domain.model.music.Artist) HashMap(java.util.HashMap) TagOccurrence(com.github.hakko.musiccabinet.domain.model.aggr.TagOccurrence) Tag(com.github.hakko.musiccabinet.domain.model.music.Tag) Test(org.junit.Test)

Example 2 with TagOccurrence

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;
}
Also used : TagOccurrence(com.github.hakko.musiccabinet.domain.model.aggr.TagOccurrence) HashSet(java.util.HashSet)

Aggregations

TagOccurrence (com.github.hakko.musiccabinet.domain.model.aggr.TagOccurrence)2 Artist (com.github.hakko.musiccabinet.domain.model.music.Artist)1 Tag (com.github.hakko.musiccabinet.domain.model.music.Tag)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Test (org.junit.Test)1