Package twitter4j

Examples of twitter4j.Status


  @Test
  public void testConvertStatus() {
    TwitterConverter converter = new TwitterConverter();
   
    Status tweet = EasyMock.createMock(Status.class);
    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


  }

  @Override
  public void nextTuple() {
    Status ret = queue.poll();
    if (ret == null) {
      Utils.sleep(50);
    } else {
      _collector.emit(new Values(ret));
View Full Code Here

  @Test
  public void send() throws TwitterException
  {
     // The factory instance is re-useable and thread safe.
      Twitter twitter = new TwitterFactory().getInstance("geodojo","latinoware");
      Status status = twitter.updateStatus("Testando o  twitter4j");
      System.out.println("Successfully updated the status to [" + status.getText() + "].");
  }
View Full Code Here

        p("got the access token: " + accessToken);
        storeAccessToken(twitter.verifyCredentials().getId() , accessToken);

        AccessToken toke = new AccessToken(accessToken.getToken(), accessToken.getTokenSecret());
        twitter.setOAuthAccessToken(accessToken);
        Status status = twitter.updateStatus("quick test of twitter with oauth. hope this works! :)");
        p("changed the status to : " + status.getText());
    }
View Full Code Here

                try {
                    Configuration conf = new PropertyConfiguration(new Properties());
                    OAuthAuthorization oauth = new OAuthAuthorization(conf,consumerKey,consumerSecret,token);
                    ImageUpload upload = ImageUpload.getTwitpicUploader(TWITPIC_API,oauth);
                    final String resultUrl = upload.upload(file,message);
                    Status s = twitter.updateStatus(message + " " + resultUrl);
                    final String tweetUrl = "http://twitter.com/"+s.getUser().getScreenName()+"/status/"+s.getId();
                    Core.getShared().defer(new Runnable(){
                        public void run() {
                            context.addNotification("Done uploading to Twitter");
                            OSUtil.openBrowser(tweetUrl);
                        }
View Full Code Here

  }
 
  public void tweetSafe(String text) {
    try {
      if (Application.get().getAppContext().isTwitterEnabled()) {
        Status status = twitterFactory.getInstance().updateStatus(text);
        LOGGER.info("Successfully updated the status to [" + status.getText() + "].");
      } else {
        LOGGER.warn("Ignored tweet status [" + text + "].");
      }
    } catch (TwitterException e) {
      LOGGER.error("Error when posting on Twitter", e);
View Full Code Here

      List<Status> statuses = this.twitter.getFriendsTimeline();
      ArrayList<Resource> resources = new ArrayList<Resource>(limit);

      for(int i = 0; i < statuses.size() && resources.size() < limit; i++)
      {
        Status status = statuses.get(i);

        if(status.getCreatedAt().after(this.getLastUpdated()))
        {
          Resource res = new Resource();
          res.setId("" + status.getId());
          res.setTitle(status.getText());
          res.setLink(status.getSource());
          res.setDate(status.getCreatedAt());

          resources.add(res);
        }
        }
View Full Code Here

    if(chan.equals(this.nick))
    {
      try
      {
        Status status = twitter.updateStatus(msg);

        logger.info("Update status " + status.getId());
      }
      catch(Exception e)
      {
        conn.doPrivmsg(u.getNick(), e.getMessage());
View Full Code Here

            String msg = b.toString();
            if (msg.length() > 140)
                msg = msg.substring(0, 140);

            Status status = twitter.updateStatus(msg);

            result = SenderResult.getSimpleSuccess("Send notification - msg-id: " + status.getId());
        } catch (TwitterException e) {

            log.warn("Notification via Microblog failed!", e);
            result = SenderResult.getSimpleFailure("Sending failed :" + e.getMessage());
View Full Code Here

            }

            String message = configuration.getSimpleValue("message",null);

            Twitter twitter = createTwitterInstance();
            Status status = twitter.updateStatus(message);
            @SuppressWarnings({"UnnecessaryLocalVariable"})
            OperationResult result = new OperationResult("Posted " + status.getText());

            return result;

        }
        throw new UnsupportedOperationException("Operation " + name + " is not valid");
View Full Code Here

TOP

Related Classes of twitter4j.Status

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.