Package org.apache.shindig.gadgets.process

Examples of org.apache.shindig.gadgets.process.ProcessingException


            + "}}");
    HttpRequest httpRequest = new HttpRequest(Uri.parse("http://www.example.org/somecontent"));
    httpRequest.setMethod("GET");
    expect(pipeline.execute(eqRequest(httpRequest))).andReturn(builder.create()).anyTimes();
    expect(mockProcessor.process(EasyMock.isA(GadgetContext.class))).andThrow(
            new ProcessingException("error", HttpServletResponse.SC_BAD_REQUEST)).anyTimes();

    replay();
    RpcHandler operation = registry.getRpcHandler(request);

    HttpRequestHandler.HttpApiResponse httpApiResponse =
View Full Code Here


        .put(createGadget(SPEC_URL2.toString(), 1, null));
    JSONObject input = new JSONObject()
        .put("context", createContext("en", "US"))
        .put("gadgets", gadgets);

    processor.exceptions.put(SPEC_URL2, new ProcessingException("broken"));

    JSONObject response = jsonRpcHandler.process(input);

    JSONArray outGadgets = response.getJSONArray("gadgets");
View Full Code Here

    }

    @Override
    public Gadget process(GadgetContext context) throws ProcessingException {

      ProcessingException exception = exceptions.get(context.getUrl());
      if (exception != null) {
        throw exception;
      }

      try {
View Full Code Here

    assertEquals(TYPE_URL_HREF, results.getRedirect());
  }

  @Test
  public void handlesProcessingExceptionGracefully() {
    processor.exception = new ProcessingException("foo");
    RenderingResults results = renderer.render(makeContext("html"));
    assertEquals(RenderingResults.Status.ERROR, results.getStatus());
    assertEquals("foo", results.getErrorMessage());
  }
View Full Code Here

  public void testBadGadget() throws Exception {
    HttpRequest request = new HttpRequest(DEST_URL);
    request.setSecurityToken(securityToken);
    request.setOAuthArguments(new OAuthArguments());
    expect(processor.process(eqContext(securityToken, request.getOAuthArguments())))
        .andThrow(new ProcessingException("doh"));
   
    control.replay();
   
    try {
      getGenerator().generateCallback(fetcherConfig, "base", request, responseParams);
View Full Code Here

  public void testBadGadget() throws Exception {
    HttpRequest request = new HttpRequest(DEST_URL);
    request.setSecurityToken(securityToken);
    request.setOAuthArguments(new OAuthArguments());
    expect(processor.process(eqContext(securityToken, request.getOAuthArguments())))
        .andThrow(new ProcessingException("doh", HttpServletResponse.SC_BAD_REQUEST));
   
    control.replay();
   
    try {
      getGenerator().generateCallback(fetcherConfig, "base", request, responseParams);
View Full Code Here

    JSONObject input = new JSONObject()
        .put("context", createContext("en", "US"))
        .put("gadgets", gadgets);

    processor.exceptions.put(SPEC_URL2,
        new ProcessingException("broken", HttpServletResponse.SC_BAD_REQUEST));

    JSONObject response = jsonRpcHandler.process(input);

    JSONArray outGadgets = response.getJSONArray("gadgets");
View Full Code Here

    }

    @Override
    public Gadget process(GadgetContext context) throws ProcessingException {

      ProcessingException exception = exceptions.get(context.getUrl());
      if (exception != null) {
        throw exception;
      }

      try {
View Full Code Here

  @Test
  public void testMetadataMultipleGadgetsWithFailure() throws Exception {
    registerGadgetsHandler(null);
    JSONObject request = makeMetadataRequest("en", "US", GADGET1_URL, GADGET2_URL);
    processor.exceptions.put(FakeProcessor.SPEC_URL2, new ProcessingException("broken",
        HttpServletResponse.SC_BAD_REQUEST));
    RpcHandler operation = registry.getRpcHandler(request);
    Object responseObj = operation.execute(emptyFormItems, token, converter).get();
    JSONObject response = new JSONObject(converter.convertToString(responseObj));
View Full Code Here

  public void testBadGadget() throws Exception {
    HttpRequest request = new HttpRequest(DEST_URL);
    request.setSecurityToken(securityToken);
    request.setOAuthArguments(new OAuthArguments());
    expect(processor.process(eqContext(securityToken, request.getOAuthArguments())))
        .andThrow(new ProcessingException("doh", HttpServletResponse.SC_BAD_REQUEST));
   
    control.replay();
   
    try {
      getGenerator().generateCallback(fetcherConfig, "base", request, responseParams);
View Full Code Here

TOP

Related Classes of org.apache.shindig.gadgets.process.ProcessingException

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.