Package winterwell.jtwitter.Twitter

Examples of winterwell.jtwitter.Twitter.User


  @Override
  public void createPartControl(Composite parent) {

    parent.setLayout(new FormLayout());

    User user = new User("ToaoT");
    try {
      user = TwitterFactory.getTwitter().getUser("ToaoT");
    } catch (Exception e) {
      e.printStackTrace();
      System.out.println("Excpetion calling the Twitter API.");
    }

    // Screen name
    text_1 = new Text(parent, SWT.BORDER | SWT.SINGLE);
    FormData fd = new FormData();
    fd.top = new FormAttachment(0, 49);
    fd.right = new FormAttachment(100, -123);
    text_1.setLayoutData(fd);
    String temp = user.getScreenName();
    text_1.setText((temp == null) ? "{screen name}" : temp);

    // Location
    text_2 = new Text(parent, SWT.BORDER | SWT.SINGLE);
    fd.bottom = new FormAttachment(text_2, -6);
    fd.left = new FormAttachment(text_2, 0, SWT.LEFT);
    fd = new FormData();
    fd.top = new FormAttachment(0, 74);
    fd.left = new FormAttachment(0, 10);
    fd.right = new FormAttachment(100, -123);
    text_2.setLayoutData(fd);
    temp = user.getLocation();
    text_2.setText((temp == null) ? "{location}" : temp);

    // Web site
    text_3 = new Text(parent, SWT.BORDER | SWT.SINGLE);
    fd.bottom = new FormAttachment(text_3, -6);
    fd = new FormData();
    fd.top = new FormAttachment(0, 99);
    fd.left = new FormAttachment(0, 10);
    fd.right = new FormAttachment(100, -123);
    text_3.setLayoutData(fd);
    URI temp2 = user.getWebsite();
    text_3.setText((temp2 == null) ? "{web site}" : temp2.toASCIIString());

    // Description
    text_4 = new Text(parent, SWT.BORDER | SWT.WRAP | SWT.V_SCROLL | SWT.CANCEL | SWT.MULTI);
    fd.bottom = new FormAttachment(text_4, -6);
    fd = new FormData();
    fd.height = 50;
    fd.top = new FormAttachment(0, 124);
    fd.left = new FormAttachment(0, 10);
    fd.right = new FormAttachment(100, -10);
    fd.bottom = new FormAttachment(100, -281);
    text_4.setLayoutData(fd);
    temp = user.getDescription();
    text_4.setText((temp == null) ? "{description}" : temp);
   
    Canvas canvas = new Canvas(parent, SWT.BORDER | SWT.NO_REDRAW_RESIZE);
    FormData fd_canvas = new FormData();
    fd_canvas.bottom = new FormAttachment(text_3, 0, SWT.BOTTOM);
View Full Code Here


      Thread.sleep(lag);
    }
    assert tw.isFollowing("winterstein") : friends;

    // Stop
    User h = tw.stopFollowing("winterstein");
    assert h != null;
    Thread.sleep(lag);
    assert ! tw.isFollowing("winterstein") : friends;

    // break where no friendship exists
    User h2 = tw.stopFollowing("winterstein");
    assert h2==null;

    // Follow
    tw.follow("winterstein");
    Thread.sleep(lag);
    assert tw.isFollowing("winterstein") : friends;

    try {
      User suspended = tw.follow("Alysha6822");
      assert false : "Trying to follow a suspended user should throw an exception";
    } catch (TwitterException e) {
    }
  }
View Full Code Here

   */
  public void testGetDirectMessages() {
    Twitter tw = new Twitter(TEST_USER, TEST_PASSWORD);
    List<Message> msgs = tw.getDirectMessages();
    for (Message message : msgs) {
      assert message.getRecipient().equals(new User(TEST_USER));
    }
    assert msgs.size() != 0;
  }
View Full Code Here

   */
  public void testGetDirectMessagesSent() {
    Twitter tw = new Twitter(TEST_USER, TEST_PASSWORD);
    List<Message> msgs = tw.getDirectMessagesSent();
    for (Message message : msgs) {
      assert message.getSender().equals(new User(TEST_USER));
    }
    assert msgs.size() != 0;
  }
View Full Code Here

   */
  public void testGetManyFollowers() {
    Twitter tw = new Twitter(TEST_USER, TEST_PASSWORD);
    tw.setMaxResults(10000); // we don't want to run the test for ever.
    String victim = "psychovertical";
    User user = tw.getUser(victim);
    assertFalse("More than 10000 followers; choose a different victim or increase the maximum results",
        user.followersCount > 10000);
    Set<User> followers = new HashSet(tw.getFollowers(victim));
    Set<Long> followerIDs = new HashSet(tw.getFollowerIDs(victim));
    // psychovertical has about 600 followers, as of 14/12/09
View Full Code Here

  public void testIsFollower() throws InterruptedException {
    Twitter tw = new Twitter(TEST_USER, TEST_PASSWORD);
   
    assert tw.isFollower("winterstein");
    int LAG = 5000;
    User u = tw.stopFollowing("winterstein");
    Thread.sleep(LAG);
    assert ! tw.isFollowing("winterstein");
    tw.follow("winterstein");
    Thread.sleep(LAG);
    assert tw.isFollowing("winterstein");
View Full Code Here

  /**
   * Test method for {@link winterwell.jtwitter.Twitter#show(java.lang.String)}.
   */
  public void testShow() {
    Twitter tw = new Twitter(TEST_USER, TEST_PASSWORD);
    User show = tw.show(TEST_USER);
    assert show != null;

    // a protected user
    User ts = tw.show("tassosstevens");
  }
View Full Code Here

TOP

Related Classes of winterwell.jtwitter.Twitter.User

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.