Package org.openid4java.util

Examples of org.openid4java.util.HttpFetcher



    public void testIncompleteHtmlParsing() throws DiscoveryException
    {
        // stop reading from the received HTML body shortly after the Yadis tag
        HttpFetcher cache = new HttpCache();
        HttpRequestOptions requestOptions = cache.getRequestOptions();
        requestOptions.setMaxBodySize(350);
        cache.setDefaultRequestOptions(requestOptions);

        YadisResolver resolver = new YadisResolver(cache);
        YadisResult result = resolver.discover("http://localhost:" + _servletPort + "/?html=simplehtml",
            10, Collections.singleton("http://example.com/"));
View Full Code Here


    public void testXrdsSizeExceeded()
    {
        HttpRequestOptions requestOptions = new HttpRequestOptions();
        requestOptions.setMaxBodySize(10);

        HttpFetcher cache = new HttpCache();
        cache.setDefaultRequestOptions(requestOptions);

        YadisResolver resolver = new YadisResolver(cache);

        try
        {
View Full Code Here

public class InjectionTest extends TestCase {

  public void testNonGuice() throws Exception {
    ConsumerManager m = new ConsumerManager();
    HttpFetcher fetcher = m.getHttpFetcher();

    assertTrue(fetcher instanceof HttpCache);
    assertEquals(0, fetcher.getDefaultRequestOptions().getMaxRedirects());

    YadisResolver yadis = m.getDiscovery().getYadisResolver();
    fetcher = yadis.getHttpFetcher();

    assertTrue(fetcher instanceof HttpCache);
    assertEquals(10, fetcher.getDefaultRequestOptions().getMaxRedirects());
  }
View Full Code Here

  }

  public void testGuiceNoModule() throws Exception {
    Injector injector = Guice.createInjector();
    ConsumerManager m = injector.getInstance(ConsumerManager.class);
    HttpFetcher fetcher = m.getHttpFetcher();

    assertTrue(fetcher instanceof HttpCache);
    assertEquals(0, fetcher.getDefaultRequestOptions().getMaxRedirects());

    YadisResolver yadis = m.getDiscovery().getYadisResolver();
    fetcher = yadis.getHttpFetcher();

    assertTrue(fetcher instanceof HttpCache);
    assertEquals(10, fetcher.getDefaultRequestOptions().getMaxRedirects());
  }
View Full Code Here

  }

  public void testGuiceInjectedFetcher() throws Exception {
    Injector injector = Guice.createInjector(new TestModule());
    ConsumerManager m = injector.getInstance(ConsumerManager.class);
    HttpFetcher fetcher = m.getHttpFetcher();

    assertTrue(fetcher instanceof TestFetcher);
    assertEquals(0, fetcher.getDefaultRequestOptions().getMaxRedirects());

    YadisResolver yadis = m.getDiscovery().getYadisResolver();
    fetcher = yadis.getHttpFetcher();

    assertTrue(fetcher instanceof TestFetcher);
    assertEquals(10, fetcher.getDefaultRequestOptions().getMaxRedirects());
  }
View Full Code Here

TOP

Related Classes of org.openid4java.util.HttpFetcher

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.