Examples of toJsString()


Examples of org.apache.shindig.gadgets.js.JsResponse.toJsString()

    try {
      jsResponse = jsServingPipeline.execute(jsRequest);
    } catch (JsException e) {
      throw new GadgetException(Code.JS_PROCESSING_ERROR, e, e.getStatusCode());
    }
    return jsResponse.toJsString();
  }

  /**
   * Add script tag with either js content (inline=true) or script src tag
   */
 
View Full Code Here

Examples of org.apache.shindig.gadgets.js.JsResponse.toJsString()

         *  isExternExportsEnabled and specifying an export path will keep the
         *  closure compiler on and export the externs for debugging.
         */
        compile = compile && (!jsUri.isDebug() || options.isExternExportsEnabled());
        if (compile) { // We should compile this code segment.
          String cacheKey = makeCacheKey(defaultCompiled.toJsString(), externs, jsUri, options);

          synchronized (compiling) {
            CompileResult cached = cache.getElement(cacheKey);
            if (cached == null) {
              future = compiling.get(cacheKey);
View Full Code Here

Examples of org.apache.shindig.gadgets.js.JsResponse.toJsString()

    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());
  }

  @SuppressWarnings("unchecked")
  public void testCompileSuccessOptWithProfiling() throws Exception {
View Full Code Here

Examples of org.apache.shindig.gadgets.js.JsResponse.toJsString()

      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());
    }
  }

  public void testCompileSuccessDeb() throws Exception {
View Full Code Here

Examples of org.apache.shindig.gadgets.js.JsResponse.toJsString()

    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());
  }

  public void testCompileErrorOpt() throws Exception {
    jsUriMock = mockJsUri(false); // opt
View Full Code Here

Examples of org.apache.shindig.gadgets.js.JsResponse.toJsString()

    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.toJsString()

  @Test
  public void testCompile() throws Exception {
    JsResponse actual = compiler.compile(null,
        ImmutableList.of(JsContent.fromText(COMPILE_CONTENT, "js")), null);
    assertEquals(COMPILE_CONTENT, actual.toJsString());
    assertEquals(0, actual.getErrors().size());
  }

  private JsUri mockJsUri(boolean debug) {
    JsUri result = createMock(JsUri.class);
View Full Code Here

Examples of org.apache.shindig.gadgets.js.JsResponse.toJsString()

  public JsResponse compile(JsUri jsUri, Iterable<JsContent> content, String externs) {
    JsResponse exportResponse = defaultCompiler.compile(jsUri, content, externs);
    content = exportResponse.getAllJsContent();

    String cacheKey = makeCacheKey(exportResponse.toJsString(), externs, jsUri);
    JsResponse cachedResult = cache.getElement(cacheKey);
    if (cachedResult != null) {
      return cachedResult;
    }
View Full Code Here

Examples of org.apache.shindig.gadgets.js.JsResponse.toJsString()

      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.toJsString()

    try {
      jsResponse = jsServingPipeline.execute(jsRequest);
    } catch (JsException e) {
      throw new GadgetException(Code.JS_PROCESSING_ERROR, e, e.getStatusCode());
    }
    return jsResponse.toJsString();
  }

  /**
   * Add script tag with either js content (inline=true) or script src tag
   */
 
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.