Examples of ProxyUri


Examples of org.apache.shindig.gadgets.uri.ProxyUriManager.ProxyUri

    expect(request.getIgnoreCache()).andStubReturn(true);
    expect(request.getImageParams()).andStubReturn(image);
    expect(request.getRewriteMimeType()).andStubReturn("image/png");
    expect(request.getSanitize()).andStubReturn(true);
    replay();
    ProxyUri pUri = gadgetHandler.createProxyUri(request);

    ProxyUri expectedUri = new ProxyUri(333, true, true, CONTAINER,
            FakeProcessor.SPEC_URL.toString(), RESOURCE);
    expectedUri.setRewriteMimeType("image/png").setSanitizeContent(true);
    expectedUri.setResize(210, 120, 77, true).setFallbackUrl(FALLBACK);
    assertEquals(pUri, expectedUri);
    verify();
  }
View Full Code Here

Examples of org.apache.shindig.gadgets.uri.ProxyUriManager.ProxyUri

    expect(proxyUriManager.make(capture(uriCapture), EasyMock.anyInt())).andReturn(
            ImmutableList.of(resUri));
    replay();
    GadgetsHandlerApi.ProxyResponse response = gadgetHandler.getProxy(request);
    assertEquals(1, uriCapture.getValue().size());
    ProxyUri pUri = uriCapture.getValue().get(0);
    assertEquals(CONTAINER, pUri.getContainer());
    assertEquals(resUri, response.getProxyUrl());
    assertNull(response.getProxyContent());
    assertEquals(timeSource.currentTimeMillis() + HttpUtil.getDefaultTtl() * 1000, response
            .getExpireTimeMs().longValue());
    verify();
View Full Code Here

Examples of org.apache.shindig.gadgets.uri.ProxyUriManager.ProxyUri

    HttpResponse httpResponse = builder.create();
    expect(proxyHandler.fetch(EasyMock.isA(ProxyUri.class))).andReturn(httpResponse);
    replay();
    GadgetsHandlerApi.ProxyResponse response = gadgetHandler.getProxy(request);
    assertEquals(1, uriCapture.getValue().size());
    ProxyUri pUri = uriCapture.getValue().get(0);
    assertEquals(CONTAINER, pUri.getContainer());
    assertNull(response.getProxyUrl());
    assertEquals("response",
            new String(Base64.decodeBase64(response.getProxyContent().getContentBase64())));
    assertEquals(20000L, response.getExpireTimeMs().longValue());
    verify();
View Full Code Here

Examples of org.apache.shindig.gadgets.uri.ProxyUriManager.ProxyUri

    HttpResponse httpResponse = new HttpResponseBuilder().setHttpStatusCode(504).create();
    expect(proxyHandler.fetch(EasyMock.isA(ProxyUri.class))).andReturn(httpResponse);
    replay();
    GadgetsHandlerApi.ProxyResponse response = gadgetHandler.getProxy(request);
    assertEquals(1, uriCapture.getValue().size());
    ProxyUri pUri = uriCapture.getValue().get(0);
    assertEquals(CONTAINER, pUri.getContainer());
    assertNull(response.getProxyUrl());
    assertEquals("", response.getProxyContent().getContentBase64());
    assertEquals(504, response.getProxyContent().getCode());
    verify();
  }
View Full Code Here

Examples of org.apache.shindig.gadgets.uri.ProxyUriManager.ProxyUri

    String host = "host.com";
    String path = "/proxy/path";
    ProxyUriManager.Versioner versioner = makeVersioner(null, "version1", "version2");
    DefaultProxyUriManager manager = makeManager(host, path, versioner);
    List<ProxyUri> proxyUris = Lists.newLinkedList();
    ProxyUri pUri = new ProxyUri(null, false, true, CONTAINER, SPEC_URI.toString(),
        RESOURCE_1);
    pUri.setResize(100, 10, 90, true);
    proxyUris.add(pUri);

    pUri = new ProxyUri(null, false, true, CONTAINER, SPEC_URI.toString(),
        RESOURCE_2);
    pUri.setResize(null, 10, null, false);
    proxyUris.add(pUri);

    List<Uri> uris = manager.make(proxyUris, null);
    assertEquals(2, uris.size());
    verifyQueryUriWithRefresh(RESOURCE_1, uris.get(0), false, true,
View Full Code Here

Examples of org.apache.shindig.gadgets.uri.ProxyUriManager.ProxyUri

    Capture<Uri> uriCapture = new Capture<Uri>();
    expect(uriManager.process(capture(uriCapture))).andReturn(proxyUri).once();
    replay(uriManager);
   
    SanitizingProxyUriManager rewriter = makeRewriter(null);
    ProxyUri returned = rewriter.process(uri);
   
    verify(uriManager);
    assertSame(uri, uriCapture.getValue());
    assertSame(returned, proxyUri);
  }
View Full Code Here

Examples of org.apache.shindig.gadgets.uri.ProxyUriManager.ProxyUri

    String host = "host.com";
    String path = "/proxy/" + DefaultProxyUriManager.CHAINED_PARAMS_TOKEN + "/path";
    ProxyUriManager.Versioner versioner = makeVersioner(null, "version");
    DefaultProxyUriManager manager = makeManager(host, path, versioner);
    List<ProxyUri> proxyUris = Lists.newLinkedList();
    ProxyUri pUri = new ProxyUri(null, false, true, CONTAINER, SPEC_URI.toString(),
        RESOURCE_1);
    pUri.setResize(100, 10, 90, true);
    proxyUris.add(pUri);

    List<Uri> uris = manager.make(proxyUris, null);
    assertEquals(1, uris.size());
    verifyChainedUri(RESOURCE_1, uris.get(0), false, true,
View Full Code Here

Examples of org.apache.shindig.gadgets.uri.ProxyUriManager.ProxyUri

        uris.get(0).getPath());
  }

  @Test
  public void testFallbackUrl() throws Exception {
    ProxyUri uri = new ProxyUri(null, false, false, "open", "http://example.com/gadget",
        Uri.parse("http://example.com/resource"));
    uri.setFallbackUrl("http://example.com/fallback");

    assertEquals("http://example.com/fallback", uri.getFallbackUri().toString());
  }
View Full Code Here

Examples of org.apache.shindig.gadgets.uri.ProxyUriManager.ProxyUri

    assertEquals("http://example.com/fallback", uri.getFallbackUri().toString());
  }

  @Test(expected = GadgetException.class)
  public void testBadFallbackUrl() throws Exception {
    ProxyUri uri = new ProxyUri(null, false, false, "open", "http://example.com/gadget",
        Uri.parse("http://example.com/resource"));
    uri.setFallbackUrl("bad url");
    uri.getFallbackUri(); // throws exception!
  }
View Full Code Here

Examples of org.apache.shindig.gadgets.uri.ProxyUriManager.ProxyUri

    Uri testUri = new UriBuilder().setAuthority(host).setPath(path)
        .addQueryParameter(Param.CONTAINER.getKey(), CONTAINER)
        .addQueryParameter(Param.URL.getKey(), "http://www.example.org/")
        .addQueryParameter(Param.HTML_TAG_CONTEXT.getKey(), "htmlTag")
        .toUri();
    ProxyUri proxyUri = manager.process(testUri);
    assertEquals("htmlTag", proxyUri.getHtmlTagContext());

    Uri targetUri = Uri.parse("http://www.example2.org/");
    HttpRequest req = proxyUri.makeHttpRequest(targetUri);
    assertEquals("htmlTag", req.getParam(Param.HTML_TAG_CONTEXT.getKey()));

    UriBuilder builder = proxyUri.makeQueryParams(1, "2");
    assertEquals("htmlTag", builder.getQueryParameter(Param.HTML_TAG_CONTEXT.getKey()));
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.