Examples of JsResponse


Examples of org.apache.shindig.gadgets.js.JsResponse

    jsUriMock = mockJsUri(true); // debug
    realResultMock = mockRealJsResult();
    realCompMock = mockRealJsCompiler(null, realResultMock, ACTUAL_COMPILER_OUTPUT);
    realOptionsMock = mockRealJsCompilerOptions(false);
    compiler = newClosureJsCompiler(realCompMock, realOptionsMock, compilerMock, cacheMock);
    JsResponse actual = compiler.compile(jsUriMock, EXPORT_COMPILER_CONTENTS, EXTERN);
    assertEquals(EXPORT_COMPILER_STRING, actual.toJsString());
    assertTrue(actual.getErrors().isEmpty());
  }
View Full Code Here

Examples of org.apache.shindig.gadgets.js.JsResponse

  public void testCompileErrorOpt() throws Exception {
    jsUriMock = mockJsUri(false); // opt
    realCompMock = mockRealJsCompiler(JS_ERROR, realResultMock, ACTUAL_COMPILER_OUTPUT);
    realOptionsMock = mockRealJsCompilerOptions(true); // force compiler to run
    compiler = newClosureJsCompiler(realCompMock, realOptionsMock, compilerMock, cacheMock);
    JsResponse actual = compiler.compile(jsUriMock, EXPORT_COMPILER_CONTENTS, EXTERN);
    assertTrue(actual.getErrors().get(0).contains(ERROR_NAME));
    assertEquals(1, actual.getErrors().size());
  }
View Full Code Here

Examples of org.apache.shindig.gadgets.js.JsResponse

    jsUriMock = mockJsUri(true); // debug
    realCompMock = mockRealJsCompiler(JS_ERROR, realResultMock, ACTUAL_COMPILER_OUTPUT);
    realOptionsMock = mockRealJsCompilerOptions(true); // force compiler to run
    realResultMock = mockRealJsResult();
    compiler = newClosureJsCompiler(realCompMock, realOptionsMock, compilerMock, cacheMock);
    JsResponse actual = compiler.compile(jsUriMock, EXPORT_COMPILER_CONTENTS, EXTERN);
    assertTrue(actual.getErrors().get(0).contains(ERROR_NAME));
    assertEquals(1, actual.getErrors().size());
  }
View Full Code Here

Examples of org.apache.shindig.gadgets.js.JsResponse

    replay(compiler);
    return compiler;
  }

  private JsResponse mockJsResponse(String content) {
    JsResponse result = createMock(JsResponse.class);
    expect(result.toJsString()).andReturn(content).anyTimes();
    expect(result.getAllJsContent()).andReturn(newJsContents(content)).anyTimes();
    replay(result);
    return result;
  }
View Full Code Here

Examples of org.apache.shindig.gadgets.js.JsResponse

    } catch (GadgetException e) {
      resp.setStatus(HttpServletResponse.SC_BAD_REQUEST);
      return;
    }

    JsResponse jsResponse;
    try {
      jsResponse = jsServingPipeline.execute(jsRequest);
    } catch (JsException e) {
      resp.sendError(e.getStatusCode(), e.getMessage());
      return;
View Full Code Here

Examples of org.apache.shindig.gadgets.js.JsResponse

    Uri servedUri = jsUriManager.makeExternJsUri(jsUri);

    String content = null;
    Long expireMs = null;
    if (isFieldIncluded(fields, "jsContent")) {
      JsResponse response;
      try {
        response = jsPipeline.execute(jsRequestBuilder.build(jsUri, servedUri.getAuthority()));
      } catch (JsException e) {
        throw new ProcessingException(e.getMessage(), e.getStatusCode());
      }
      content = response.toJsString();
      if (response.isProxyCacheable()) {
        expireMs = getDefaultExpiration();
      }
    } else {
      expireMs = getDefaultExpiration();
    }
View Full Code Here

Examples of org.apache.shindig.gadgets.js.JsResponse

    jsUriMock = mockJsUri(false); // opt
    realResultMock = mockRealJsResult();
    realCompMock = mockRealJsCompiler(null, realResultMock, ACTUAL_COMPILER_OUTPUT);
    realOptionsMock = mockRealJsCompilerOptions(false);
    compiler = newClosureJsCompiler(realCompMock, realOptionsMock, compilerMock, cacheMock);
    JsResponse actual = compiler.compile(jsUriMock, EXPORT_COMPILER_CONTENTS, EXTERN);
    assertEquals(ACTUAL_COMPILER_OUTPUT, actual.toJsString());
    assertTrue(actual.getErrors().isEmpty());
  }
View Full Code Here

Examples of org.apache.shindig.gadgets.js.JsResponse

      List<JsContent> content = newJsContents(compilerTest.getKey());
      exportResponseMock = mockJsResponse(compilerTest.getKey());
      compilerMock = mockDefaultJsCompiler(exportResponseMock, content);
      compiler = newProfilingClosureJsCompiler(realOptionsMock, compilerMock, cacheMock);

      JsResponse actual = compiler.compile(jsUriMock, content, EXTERN);
      assertEquals(compilerTest.getValue(), actual.toJsString());
      assertTrue(actual.getErrors().isEmpty());
    }
  }
View Full Code Here

Examples of org.apache.shindig.gadgets.js.JsResponse

    jsUriMock = mockJsUri(true); // debug
    realResultMock = mockRealJsResult();
    realCompMock = mockRealJsCompiler(null, realResultMock, ACTUAL_COMPILER_OUTPUT);
    realOptionsMock = mockRealJsCompilerOptions(false);
    compiler = newClosureJsCompiler(realCompMock, realOptionsMock, compilerMock, cacheMock);
    JsResponse actual = compiler.compile(jsUriMock, EXPORT_COMPILER_CONTENTS, EXTERN);
    assertEquals(EXPORT_COMPILER_STRING, actual.toJsString());
    assertTrue(actual.getErrors().isEmpty());
  }
View Full Code Here

Examples of org.apache.shindig.gadgets.js.JsResponse

  public void testCompileErrorOpt() throws Exception {
    jsUriMock = mockJsUri(false); // opt
    realCompMock = mockRealJsCompiler(JS_ERROR, realResultMock, ACTUAL_COMPILER_OUTPUT);
    realOptionsMock = mockRealJsCompilerOptions(true); // force compiler to run
    compiler = newClosureJsCompiler(realCompMock, realOptionsMock, compilerMock, cacheMock);
    JsResponse actual = compiler.compile(jsUriMock, EXPORT_COMPILER_CONTENTS, EXTERN);
    assertTrue(actual.getErrors().get(0).contains(ERROR_NAME));
    assertEquals(1, actual.getErrors().size());
  }
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.