Package org.apache.shindig.gadgets.uri.JsUriManager

Examples of org.apache.shindig.gadgets.uri.JsUriManager.JsUri


    String targetHost = "target-host.org";
    ContainerConfig config = mockConfig("http://" + targetHost, "/gadgets/js");
    TestDefaultJsUriManager manager = makeManager(config, null);
    Uri testUri = Uri.parse("http://target-host.org/gadgets/js/feature:another?" +
        Param.CONTAINER.getKey() + '=' + CONTAINER);
    JsUri jsUri = manager.processExternJsUri(testUri);
    assertFalse(manager.hadError());
    assertEquals(jsUri.getStatus(), UriStatus.VALID_UNVERSIONED);
    List<String> extern = Lists.newArrayList("feature", "another");
    assertCollectionEquals(jsUri.getLibs(), extern);
  }
View Full Code Here


    String version = "verstring";
    TestDefaultJsUriManager manager = makeManager(config, null);
    Uri testUri = Uri.parse("http://target-host.org/gadgets/js/" + addJsLibs(extern) +
        JS_SUFFIX + '?' + Param.CONTAINER.getKey() + '=' + CONTAINER + '&' +
        Param.VERSION.getKey() + '=' + version);
    JsUri jsUri = manager.processExternJsUri(testUri);
    assertFalse(manager.hadError());
    assertEquals(jsUri.getStatus(), UriStatus.VALID_UNVERSIONED);
    assertCollectionEquals(jsUri.getLibs(), extern);
  }
View Full Code Here

    Versioner versioner = mockVersioner(extern, version, badVersion);
    TestDefaultJsUriManager manager = makeManager(config, versioner);
    Uri testUri = Uri.parse("http://target-host.org/gadgets/js/" + addJsLibs(extern) +
        JS_SUFFIX + '?' + Param.CONTAINER.getKey() + '=' + CONTAINER + '&' +
        Param.VERSION.getKey() + '=' + badVersion);
    JsUri jsUri = manager.processExternJsUri(testUri);
    assertFalse(manager.hadError());
    assertEquals(jsUri.getStatus(), UriStatus.INVALID_VERSION);
    assertCollectionEquals(jsUri.getLibs(), extern);
  }
View Full Code Here

    String version = "verstring";
    Versioner versioner = mockVersioner(extern, version, version);
    TestDefaultJsUriManager manager = makeManager(config, versioner);
    Uri testUri = Uri.parse("http://target-host.org/gadgets/js/" + addJsLibs(extern) +
        JS_SUFFIX + '?' + Param.CONTAINER.getKey() + '=' + CONTAINER);
    JsUri jsUri = manager.processExternJsUri(testUri);
    assertFalse(manager.hadError());
    assertEquals(jsUri.getStatus(), UriStatus.VALID_UNVERSIONED);
    assertCollectionEquals(jsUri.getLibs(), extern);
  }
View Full Code Here

    Versioner versioner = mockVersioner(extern, version, version);
    TestDefaultJsUriManager manager = makeManager(config, versioner);
    Uri testUri = Uri.parse("http://target-host.org/gadgets/js/" + addJsLibs(extern) +
        JS_SUFFIX + '?' + Param.CONTAINER.getKey() + '=' + CONTAINER + '&' +
        Param.VERSION.getKey() + '=' + version);
    JsUri jsUri = manager.processExternJsUri(testUri);
    assertFalse(manager.hadError());
    assertEquals(jsUri.getStatus(), UriStatus.VALID_VERSIONED);
    assertCollectionEquals(jsUri.getLibs(), extern);
  }
View Full Code Here

    assertEquals(version, jsUri.getQueryParameter(Param.VERSION.getKey()));
    assertEquals("0", jsUri.getQueryParameter(Param.NO_CACHE.getKey()));
    assertEquals("0", jsUri.getQueryParameter(Param.DEBUG.getKey()));

    // ...and process
    JsUri processed = manager.processExternJsUri(jsUri);
    assertEquals(UriStatus.VALID_VERSIONED, processed.getStatus());
    assertCollectionEquals(extern, processed.getLibs());
  }
View Full Code Here

    RpcHandler operation = registry.getRpcHandler(request);
    Object responseObj = operation.execute(emptyFormItems, authContext, converter).get();
    JSONObject results = new JSONObject(converter.convertToString(responseObj));
    assertEquals(jsUri.toString(), results.getString("jsUrl"));
    JsUri expectedUri = new JsUri(null, false, false, CONTAINER, GADGET1_URL, features, null, null,
            false, false, RenderingContext.GADGET, null, null);
    assertEquals(expectedUri, captureUri.getValue());
    assertFalse(results.has("error"));
    assertFalse(results.has("jsContent"));
    verify();
View Full Code Here

    RpcHandler operation = registry.getRpcHandler(request);
    Object responseObj = operation.execute(emptyFormItems, authContext, converter).get();
    JSONObject results = new JSONObject(converter.convertToString(responseObj));
    assertEquals(jsUri.toString(), results.getString("jsUrl"));
    JsUri expectedUri = new JsUri(123, true, true, CONTAINER, GADGET1_URL, features,
            loadedFeatures, onload, false, false, RenderingContext.CONTAINER, null, repository);
    assertEquals(expectedUri, captureUri.getValue());
    assertFalse(results.has("error"));
    assertEquals(jsContent, results.getString("jsContent"));
    verify();
View Full Code Here

    processor = new DeferJsProcessor(registryProvider, contextProviderMock);
  }

  @Test
  public void processWithOneNonEmptyFeatureDeferred() throws Exception {
    JsUri jsUri = mockJsUri(JsCompileMode.CONCAT_COMPILE_EXPORT_ALL, true, LIBS_WITH_DEFER);
    JsRequest jsRequest = new JsRequest(jsUri, null, false, featureRegistry);
    JsResponseBuilder jsBuilder = new JsResponseBuilder();
    boolean actualReturnCode = processor.process(jsRequest, jsBuilder);
    assertTrue(actualReturnCode);
    assertEquals(
View Full Code Here

        jsBuilder.build().toJsString());
  }

  @Test
  public void processWithOneNonEmptyFeatureDeferredNotSupported() throws Exception {
    JsUri jsUri = mockJsUri(JsCompileMode.CONCAT_COMPILE_EXPORT_ALL, true, LIBS_WITHOUT_DEFER);
    JsRequest jsRequest = new JsRequest(jsUri, null, false, featureRegistry);
    JsResponseBuilder jsBuilder = new JsResponseBuilder();
    boolean actualReturnCode = processor.process(jsRequest, jsBuilder);
    assertTrue(actualReturnCode);
    assertEquals(
View Full Code Here

TOP

Related Classes of org.apache.shindig.gadgets.uri.JsUriManager.JsUri

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.