Package net.lr.tutorial.karaf.vote.model

Examples of net.lr.tutorial.karaf.vote.model.Vote


    return this.votingMap.remove(topic);
  }

  @Override
  public void addVote(String topic, int voteNum) {
    getVoting(topic).addVote(new Vote(topic, voteNum));
  }
View Full Code Here


      String text = message.getText();
      String[] parts = text.split(" ");
      String topic = parts[0];
      int voteNum = Integer.parseInt(parts[1]);
      String fromUser = message.getSender().getName();
      return new Vote(topic, voteNum, fromUser, message.getCreatedAt());
    } catch (Throwable  e) {
      LOG.info("Invalid tweet " + message.getText() + ": " + e.getMessage());
      return null;
    }
  }
View Full Code Here

      String text = tweet.getText();
      String[] parts = text.split(" ");
      String topic = parts[1];
      int voteNum = Integer.parseInt(parts[2]);
      String fromUser = tweet.getSource();
      return new Vote(topic, voteNum, fromUser, tweet.getCreatedAt());
    } catch (Throwable  e) {
      LOG.info("Invalid tweet " + tweet.getText() + ": " + e.getMessage());
      return null;
    }
  }
View Full Code Here

public class IrcConverter {
  public Vote textToVote(String chatLine, @Header("irc.user.nick") String userNick) {
    String[] parts = chatLine.split(" ");
    String topic = parts[0];
    int voteNum = Integer.parseInt(parts[1]);
    return new Vote(topic, voteNum, userNick, new Date());
  }
View Full Code Here

    EasyMock.expect(tweet.getSource()).andReturn("schneider_chris").anyTimes();
    Date now = new Date();
    EasyMock.expect(tweet.getCreatedAt()).andReturn(now).anyTimes();
    EasyMock.expect(tweet.getText()).andReturn("#camel mytopic 2").anyTimes();
    EasyMock.replay(tweet);
    Vote vote = converter.convert(tweet);
    Assert.assertEquals(tweet.getSource(), vote.getFromUser());
    Assert.assertEquals(now, vote.getVoteDateTime());
    Assert.assertEquals(2, vote.getVote());
    Assert.assertEquals("mytopic", vote.getTopic());
    EasyMock.verify(tweet);
  }
View Full Code Here

TOP

Related Classes of net.lr.tutorial.karaf.vote.model.Vote

Copyright © 2018 www.massapicom. 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.