Examples of ArtistUserTag


Examples of com.github.hakko.musiccabinet.domain.model.aggr.ArtistUserTag

  private final Artist artist = new Artist("artistName");
  private final String tag = "pop";

  @Test
  public void validateParametersForAddingTag() throws ApplicationException {
    final ArtistUserTag artistUserTagAdd = new ArtistUserTag(artist,
        lastFmUser, tag, 100, true);

    new TagUpdateClient() {
      @Override
      protected WSResponse executeWSRequest(List<NameValuePair> params)
View Full Code Here

Examples of com.github.hakko.musiccabinet.domain.model.aggr.ArtistUserTag

    }.updateTag(artistUserTagAdd);
  }

  @Test
  public void validateParametersForRemovingTag() throws ApplicationException {
    final ArtistUserTag artistUserTagRemove = new ArtistUserTag(artist,
        lastFmUser, tag, 10, false);

    new TagUpdateClient() {
      @Override
      protected WSResponse executeWSRequest(List<NameValuePair> params)
View Full Code Here

Examples of com.github.hakko.musiccabinet.domain.model.aggr.ArtistUserTag

   * last.fm is down.
   */
  public void updateTag(Artist artist, String lastFmUsername, String tagName,
      int tagCount, boolean increase) {
    LastFmUser lastFmUser = lastFmDao.getLastFmUser(lastFmUsername);
    register(new ArtistUserTag(artist, lastFmUser, tagName, tagCount, increase));

    if (!started.getAndSet(true)) {
      startTagUpdateService();
    }
  }
View Full Code Here

Examples of com.github.hakko.musiccabinet.domain.model.aggr.ArtistUserTag

  }

  protected void register(ArtistUserTag submission) {
    for (Iterator<ArtistUserTag> it = artistUserTags.iterator(); it.hasNext();) {
      ArtistUserTag aut = it.next();
      if (aut.getArtist().getId() == submission.getArtist().getId()
          && aut.getTagName().equals(submission.getTagName())
          && aut.getLastFmUser().getId() == submission
              .getLastFmUser().getId()) {
        it.remove();
        LOG.debug("remove " + aut + ", in favor of " + submission);
      }
    }
View Full Code Here

Examples of com.github.hakko.musiccabinet.domain.model.aggr.ArtistUserTag

        submission.getTagName(), submission.getTagCount());
  }

  protected void updateTags() throws ApplicationException {
    resendFailedUpdates();
    ArtistUserTag aut;
    while (failedUpdates.isEmpty() && (aut = artistUserTags.poll()) != null) {
      if ((aut.isIncrease() && aut.getTagCount() >= MAX_THRESHOLD)
          || (!aut.isIncrease() && aut.getTagCount() <= MIN_THRESHOLD)) {
        WSResponse wsResponse = tagUpdateClient.updateTag(aut);
        if (!wsResponse.wasCallSuccessful()) {
          LOG.warn("updating " + aut + " failed! Add for re-sending.");
          LOG.debug("Response: " + wsResponse);
          failedUpdates.add(aut);
View Full Code Here

Examples of com.github.hakko.musiccabinet.domain.model.aggr.ArtistUserTag

  protected void resendFailedUpdates() throws ApplicationException {
    while (failedUpdates.size() > 0) {
      LOG.debug("Queue of failed updates consists of "
          + failedUpdates.size() + " elements.");
      ArtistUserTag firstFailed = failedUpdates.get(0);
      WSResponse wsResponse = tagUpdateClient.updateTag(firstFailed);
      if (wsResponse.wasCallSuccessful()) {
        LOG.debug("Failed tag update was re-sent.");
        failedUpdates.remove(0);
      } else {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.