Ejemplo n.º 1
0
  public void testFactoryInstantiation() throws Exception {
    TwitterFactory twitterFactory = (TwitterFactory) beanFactory.getBean("twitterFactory");
    Twitter twitter = twitterFactory.getInstance();
    assertTrue(twitter instanceof Twitter);

    AsyncTwitterFactory asyncTwitterFactory =
        (AsyncTwitterFactory) beanFactory.getBean("asyncTwitterFactory");
    AsyncTwitter asyncTwitter = asyncTwitterFactory.getInstance();
    assertTrue(asyncTwitter instanceof AsyncTwitter);

    TwitterStreamFactory twitterStreamFactory =
        (TwitterStreamFactory) beanFactory.getBean("twitterStreamFactory");
    TwitterStream twitterStream = twitterStreamFactory.getInstance("test", "test");
    assertTrue(twitterStream instanceof TwitterStream);
  }
Ejemplo n.º 2
0
  public Main(String[] args) throws Exception {
    this.stream = TwitterStreamFactory.getSingleton();

    if (0 != args.length) {
      String topicArn = args[0];

      snsPublisher = new SnsPublisher(topicArn);
    } else {
      snsPublisher = null;
    }

    this.stream.addListener(new TwtailStatusAdapter());
  }