Package org.apache.shindig.config

Examples of org.apache.shindig.config.ContainerConfig$ConfigObserver


    assertEquals(UriStatus.VALID_VERSIONED, manager.validateRenderingUri(uri));
  }

  @Test
  public void containerConfigurationChanges() throws Exception {
    ContainerConfig config = new BasicContainerConfig();
    config
        .newTransaction()
        .addContainer(ImmutableMap
            .<String, Object>builder()
            .put(ContainerConfig.CONTAINER_KEY, ContainerConfig.DEFAULT_CONTAINER)
            .put(LOCKED_DOMAIN_SUFFIX_KEY, LD_SUFFIX)
            .put(IFRAME_BASE_PATH_KEY, IFRAME_PATH)
            .put(LOCKED_DOMAIN_REQUIRED_KEY, true)
            .build())
        .commit();
    LockedDomainService ldService = new HashLockedDomainService(config, true, prefixGen);
    TestDefaultIframeUriManager manager = new TestDefaultIframeUriManager(config, ldService);

    Uri testUri = Uri.parse("http://foobar" + LD_SUFFIX + "/?url=http://example.com");

    config.newTransaction().addContainer(ImmutableMap
        .<String, Object>builder()
        .put(ContainerConfig.CONTAINER_KEY, ContainerConfig.DEFAULT_CONTAINER)
        .put(LOCKED_DOMAIN_SUFFIX_KEY, LD_SUFFIX_ALT)
        .build()).commit();
    assertEquals(UriStatus.VALID_UNVERSIONED, manager.validateRenderingUri(testUri));
View Full Code Here


  }

  @Test
  public void schemeLessUnlockedDomain() throws Exception {
    Gadget gadget = mockGadget();
    ContainerConfig config = new BasicContainerConfig();
    config
        .newTransaction()
        .addContainer(ImmutableMap.<String, Object>builder()
            .put(ContainerConfig.CONTAINER_KEY, ContainerConfig.DEFAULT_CONTAINER)
            .put(LOCKED_DOMAIN_SUFFIX_KEY, LD_SUFFIX)
            .build())
View Full Code Here

    return makeManager(alwaysToken, ldRequired, ldRequired ? true: false);
  }
  private TestDefaultIframeUriManager makeManager(boolean alwaysToken, boolean ldRequired, boolean enabled)
      throws ContainerConfigException {
    String altContainer = CONTAINER + "-alt";
    ContainerConfig config = new BasicContainerConfig();
    config
        .newTransaction()
        .addContainer(ImmutableMap
            .<String, Object>builder()
            .put(ContainerConfig.CONTAINER_KEY, ContainerConfig.DEFAULT_CONTAINER)
            .put(LOCKED_DOMAIN_SUFFIX_KEY, LD_SUFFIX)
View Full Code Here

        "8uhr00296d2o3sfhqilj387krjmgjv3v-a.example.com:8080", notLocked, "default"));

  }

  public void testMissingConfig() throws Exception {
    ContainerConfig containerMissingConfig = mock(ContainerConfig.class);
    expect(containerMissingConfig.getContainers())
      .andReturn(Arrays.asList(ContainerConfig.DEFAULT_CONTAINER));
    replay();

    lockedDomainService = new HashLockedDomainService(containerMissingConfig, true);
    assertFalse(lockedDomainService.gadgetCanRender("www.example.com", wantsLocked, "default"));
View Full Code Here

    assertFalse(lockedDomainService.gadgetCanRender("www.example.com", wantsLocked, "default"));
    assertTrue(lockedDomainService.gadgetCanRender("www.example.com", notLocked, "default"));
  }

  public void testMultiContainer() throws Exception {
    ContainerConfig inheritsConfig  = mock(ContainerConfig.class);
    expect(inheritsConfig.getContainers())
        .andReturn(Arrays.asList(ContainerConfig.DEFAULT_CONTAINER, "other"));
    expect(inheritsConfig.getBool(isA(String.class), eq(LOCKED_DOMAIN_REQUIRED_KEY)))
        .andReturn(true).anyTimes();
    expect(inheritsConfig.getString(isA(String.class), eq(LOCKED_DOMAIN_SUFFIX_KEY)))
        .andReturn("-a.example.com:8080").anyTimes();
    replay();

    lockedDomainService = new HashLockedDomainService(inheritsConfig, true);
    assertFalse(lockedDomainService.gadgetCanRender("www.example.com", wantsLocked, "other"));
View Full Code Here

  private BlobCrypterSecurityTokenDecoder decoder;
  private final FakeTimeSource timeSource = new FakeTimeSource();

  @Before
  public void setUp() throws Exception {
    ContainerConfig config = new AbstractContainerConfig() {
      @Override
      public Object getProperty(String container, String name) {
        if (BlobCrypterSecurityTokenDecoder.SECURITY_TOKEN_KEY_FILE.equals(name)) {
          return getContainerKey(container);
        }
View Full Code Here

    assertTrue(t.isAnonymous());
  }

  @Test
  public void testLoadFailure() throws Exception {
    ContainerConfig config = new AbstractContainerConfig() {
      @Override
      public Object getProperty(String container, String name) {
        if (BlobCrypterSecurityTokenDecoder.SECURITY_TOKEN_KEY_FILE.equals(name)) {
          return getContainerKey(container);
        }
View Full Code Here

  private static final Uri GADGET_URI = Uri.parse("http://example.com/gadget.xml");
 
  // makeJsUri tests
  @Test(expected = RuntimeException.class)
  public void makeMissingHostConfig() {
    ContainerConfig config = mockConfig(null, "/gadgets/js");
    DefaultJsUriManager manager = makeManager(config, null);
    Gadget gadget = mockGadget(false, false);
    manager.makeExternJsUri(gadget, null);
  }
View Full Code Here

    manager.makeExternJsUri(gadget, null);
  }
 
  @Test(expected = RuntimeException.class)
  public void makeMissingPathConfig() {
    ContainerConfig config = mockConfig("foo", null);
    DefaultJsUriManager manager = makeManager(config, null);
    Gadget gadget = mockGadget(false, false);
    manager.makeExternJsUri(gadget, null);
  }
View Full Code Here

    manager.makeExternJsUri(gadget, null);
  }
 
  @Test
  public void makeJsUriNoPathSlashNoVersion() {
    ContainerConfig config = mockConfig("http://www.js.org", "/gadgets/js/");
    TestDefaultJsUriManager manager = makeManager(config, null);
    Gadget gadget = mockGadget(false, false);
    List<String> extern = Lists.newArrayList("feature");
    Uri jsUri = manager.makeExternJsUri(gadget, extern);
    assertFalse(manager.hadError());
View Full Code Here

TOP

Related Classes of org.apache.shindig.config.ContainerConfig$ConfigObserver

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.