Package org.apache.hadoop.gateway.filter.rewrite.impl

Examples of org.apache.hadoop.gateway.filter.rewrite.impl.UrlRewriteRulesDescriptorImpl


  private UrlRewriteRulesDescriptorFactory() {
  }

  public static UrlRewriteRulesDescriptor create() {
    return new UrlRewriteRulesDescriptorImpl();
  }
View Full Code Here


  @Test
  public void testDeployment() throws IOException {
    WebArchive webArchive = ShrinkWrap.create( WebArchive.class, "test-acrhive" );

    UrlRewriteRulesDescriptorImpl rewriteRules = new UrlRewriteRulesDescriptorImpl();

    Map<String,String> providerParams = new HashMap<String, String>();
    providerParams.put( "test-host-external", "test-host-internal" );
    Provider provider = new Provider();
    provider.setEnabled( true );
    provider.setName( "hostmap" );
    provider.setParamsproviderParams );

    DeploymentContext context = EasyMock.createNiceMock( DeploymentContext.class );
    EasyMock.expect( context.getDescriptor( "rewrite" ) ).andReturn( rewriteRules ).anyTimes();
    EasyMock.expect( context.getWebArchive() ).andReturn( webArchive ).anyTimes();
    EasyMock.replay( context );

    HostmapDeploymentContributor contributor = new HostmapDeploymentContributor();

    assertThat( contributor.getRole(), is("hostmap") );
    assertThat( contributor.getName(), is( "static" ) );

    // Just make sure it doesn't blow up.
    contributor.contributeFilter( null, null, null, null, null );

    // Just make sure it doesn't blow up.
    contributor.initializeContribution( context );

    contributor.contributeProvider( context, provider );

    HostmapFunctionDescriptor funcDesc = rewriteRules.getFunction( "hostmap" );
    assertThat( funcDesc.config(), is( "/WEB-INF/hostmap.txt" ) );

    Node node = webArchive.get( "/WEB-INF/hostmap.txt" );
    String asset = IOUtils.toString( node.getAsset().openStream() );
    assertThat( asset, containsString( "test-host-external=test-host-internal" ) );
View Full Code Here

  @Test
  public void testLoadRulesFromTemplate() throws IOException, URISyntaxException {
    WebArchive webArchive = ShrinkWrap.create( WebArchive.class, "test-archive" );

    UrlRewriteRulesDescriptorImpl clusterRules = new UrlRewriteRulesDescriptorImpl();

    DeploymentContext context = EasyMock.createNiceMock( DeploymentContext.class );
    EasyMock.expect( context.getDescriptor( "rewrite" ) ).andReturn( clusterRules ).anyTimes();
    EasyMock.expect( context.getWebArchive() ).andReturn( webArchive ).anyTimes();
View Full Code Here

  private UrlRewriteRulesDescriptorFactory() {
  }

  public static UrlRewriteRulesDescriptor create() {
    return new UrlRewriteRulesDescriptorImpl();
  }
View Full Code Here

  @Test
  public void testDeployment() throws IOException {
    WebArchive webArchive = ShrinkWrap.create( WebArchive.class, "test-acrhive" );

    UrlRewriteRulesDescriptorImpl rewriteRules = new UrlRewriteRulesDescriptorImpl();

    Map<String,String> providerParams = new HashMap<String, String>();
    providerParams.put( "test-host-external", "test-host-internal" );
    Provider provider = new Provider();
    provider.setEnabled( true );
    provider.setName( "hostmap" );
    provider.setParamsproviderParams );

    DeploymentContext context = EasyMock.createNiceMock( DeploymentContext.class );
    EasyMock.expect( context.getDescriptor( "rewrite" ) ).andReturn( rewriteRules ).anyTimes();
    EasyMock.expect( context.getWebArchive() ).andReturn( webArchive ).anyTimes();
    EasyMock.replay( context );

    HostmapDeploymentContributor contributor = new HostmapDeploymentContributor();

    assertThat( contributor.getRole(), is("hostmap") );
    assertThat( contributor.getName(), is( "static" ) );

    // Just make sure it doesn't blow up.
    contributor.contributeFilter( null, null, null, null, null );

    // Just make sure it doesn't blow up.
    contributor.initializeContribution( context );

    contributor.contributeProvider( context, provider );

    HostmapFunctionDescriptor funcDesc = rewriteRules.getFunction( "hostmap" );
    assertThat( funcDesc.config(), is( "/WEB-INF/hostmap.txt" ) );

    Node node = webArchive.get( "/WEB-INF/hostmap.txt" );
    String asset = IOUtils.toString( node.getAsset().openStream() );
    assertThat( asset, containsString( "test-host-external=test-host-internal" ) );
View Full Code Here

  @Test
  public void testLoadRulesFromTemplate() throws IOException, URISyntaxException {
    WebArchive webArchive = ShrinkWrap.create( WebArchive.class, "test-archive" );

    UrlRewriteRulesDescriptorImpl clusterRules = new UrlRewriteRulesDescriptorImpl();

    DeploymentContext context = EasyMock.createNiceMock( DeploymentContext.class );
    EasyMock.expect( context.getDescriptor( "rewrite" ) ).andReturn( clusterRules ).anyTimes();
    EasyMock.expect( context.getWebArchive() ).andReturn( webArchive ).anyTimes();
View Full Code Here

  @Ignore
  @Test
  public void testDeployment() throws Exception {
    WebArchive webArchive = ShrinkWrap.create( WebArchive.class, "test-acrhive" );

    UrlRewriteRulesDescriptorImpl rules = new UrlRewriteRulesDescriptorImpl();

    DeploymentContext context = EasyMock.createNiceMock( DeploymentContext.class );
    EasyMock.expect( context.getDescriptor( "rewrite" ) ).andReturn( rules ).anyTimes();
    EasyMock.expect( context.getWebArchive() ).andReturn( webArchive ).anyTimes();
View Full Code Here

TOP

Related Classes of org.apache.hadoop.gateway.filter.rewrite.impl.UrlRewriteRulesDescriptorImpl

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.