Package org.torquebox.web.rack

Examples of org.torquebox.web.rack.RackMetaData


    @Test
    public void testNoUnitsSessionTimeout() throws Exception {
        MockDeploymentUnit unit = deployResourceAsTorqueboxYml( "timeout-nounits-web.yml" );

        RackMetaData rackMetaData = unit.getAttachment( RackMetaData.ATTACHMENT_KEY );

        assertNotNull( rackMetaData );

        assertEquals( "/tengwar", rackMetaData.getContextPath() );
        assertEquals( 1, rackMetaData.getHosts().size() );
        assertEquals( "mordor.com", rackMetaData.getHosts().get( 0 ) );
        assertNull( rackMetaData.getStaticPathPrefix() );
        assertEquals( 600, rackMetaData.getSessionTimeout() );
    }
View Full Code Here


   
    @Test
    public void testOldStyleDashedSessionTimeout() throws Exception {
        MockDeploymentUnit unit = deployResourceAsTorqueboxYml( "timeout-dashed-web.yml" );

        RackMetaData rackMetaData = unit.getAttachment( RackMetaData.ATTACHMENT_KEY );

        assertNotNull( rackMetaData );

        assertEquals( 600, rackMetaData.getSessionTimeout() );
    }
View Full Code Here

   
    @Test
    public void testValidWebYmlCustomStaticPathPrefix() throws Exception {
        MockDeploymentUnit unit = deployResourceAsTorqueboxYml( "static-path-web.yml" );

        RackMetaData rackMetaData = unit.getAttachment( RackMetaData.ATTACHMENT_KEY );

        assertNotNull( rackMetaData );

        assertEquals( "/tacos", rackMetaData.getContextPath() );
        assertEquals( 1, rackMetaData.getHosts().size() );
        assertEquals( "foobar.com", rackMetaData.getHosts().get( 0 ) );
        assertEquals( "/elsewhere", rackMetaData.getStaticPathPrefix() );
    }
View Full Code Here

    }

    @Test
    public void testValidContextPathWithSlashes() throws Exception {
        MockDeploymentUnit unit = deployResourceAsTorqueboxYml( "context-path-slashes.yml" );
        RackMetaData rackMetaData = unit.getAttachment( RackMetaData.ATTACHMENT_KEY );
        assertNotNull( rackMetaData );
        assertEquals( "/tacos/and/bacon", rackMetaData.getContextPath() );
    }
View Full Code Here

    @Test
    public void testHappy() throws Exception {
        environment.put( "SOME_VAR", "gassy" );
        RubyAppMetaData rubyAppMetaData = new RubyAppMetaData( "app_name");
        RackMetaData rackAppMetaData = new RackMetaData();

        rubyAppMetaData.setRoot( this.root );
        rubyAppMetaData.setEnvironmentVariables( environment );

        MockDeploymentPhaseContext phaseContext = createPhaseContext();
        MockDeploymentUnit unit = phaseContext.getMockDeploymentUnit();

        rubyAppMetaData.attachTo( unit );
        rackAppMetaData.attachTo( unit );

        deploy( phaseContext );
       
        RubyRuntimeMetaData runtimeMetaData = unit.getAttachment( RubyRuntimeMetaData.ATTACHMENT_KEY );
        assertNotNull( runtimeMetaData );
View Full Code Here

    }

    @Test
    public void testWithExistingRubyRuntimeMD() throws Exception {
        RubyAppMetaData rubyAppMetaData = new RubyAppMetaData( "app_name");
        RackMetaData rackAppMetaData = new RackMetaData();

        rubyAppMetaData.setRoot( this.root );

        MockDeploymentPhaseContext phaseContext = createPhaseContext();
        MockDeploymentUnit unit = phaseContext.getMockDeploymentUnit();

        RubyRuntimeMetaData originalRuntimeMD = new RubyRuntimeMetaData();
        unit.putAttachment( RubyRuntimeMetaData.ATTACHMENT_KEY, originalRuntimeMD );
        rubyAppMetaData.attachTo( unit );
        rackAppMetaData.attachTo( unit );

        deploy( phaseContext );

        RubyRuntimeMetaData runtimeMetaData = unit.getAttachment( RubyRuntimeMetaData.ATTACHMENT_KEY );
        assertNotNull( runtimeMetaData );
View Full Code Here

    }

    @Test
    public void testWithExistingTypedRubyRuntimeMD() throws Exception {
        RubyAppMetaData rubyAppMetaData = new RubyAppMetaData( "app_name" );
        RackMetaData rackAppMetaData = new RackMetaData();

        rubyAppMetaData.setRoot( this.root );
       
        MockDeploymentPhaseContext phaseContext = createPhaseContext();
        MockDeploymentUnit unit = phaseContext.getMockDeploymentUnit();

        RubyRuntimeMetaData originalRuntimeMD = new RubyRuntimeMetaData();
        originalRuntimeMD.setRuntimeType( RubyRuntimeMetaData.RuntimeType.BARE );

        unit.putAttachment( RubyRuntimeMetaData.ATTACHMENT_KEY, originalRuntimeMD );
        rubyAppMetaData.attachTo( unit );
        rackAppMetaData.attachTo( unit );

        deploy( phaseContext );

        RubyRuntimeMetaData runtimeMetaData = unit.getAttachment( RubyRuntimeMetaData.ATTACHMENT_KEY );
        assertNotNull( runtimeMetaData );
View Full Code Here

        DeploymentUnit unit = phaseContext.getDeploymentUnit();
        if (DeploymentUtils.isUnitRootless( unit )) {
            return;
        }
        ResourceRoot resourceRoot = unit.getAttachment( Attachments.DEPLOYMENT_ROOT );
        RackMetaData rackAppMetaData = unit.getAttachment( RackMetaData.ATTACHMENT_KEY );
        RailsMetaData railsAppMetaData = unit.getAttachment( RailsMetaData.ATTACHMENT_KEY );

        if (rackAppMetaData == null) {
            return;
        }

        unit.addToAttachmentList( Attachments.RESOURCE_ROOTS, resourceRoot );

        WarMetaData warMetaData = unit.getAttachment( WarMetaData.ATTACHMENT_KEY );
        WebMetaData webMetaData = warMetaData.getWebMetaData();

        if (webMetaData == null) {
            webMetaData = new WebMetaData();
            ServiceName jgroups = ChannelFactoryService.getServiceName( null );
            if (phaseContext.getServiceRegistry().getService( jgroups ) != null) {
                webMetaData.setDistributable( new EmptyMetaData() );
            }
            warMetaData.setWebMetaData( webMetaData );
        }

        Map<String, WebFragmentMetaData> webFragmentsMetaData = warMetaData.getWebFragmentsMetaData();

        if (webFragmentsMetaData == null) {
            webFragmentsMetaData = new HashMap<String, WebFragmentMetaData>();
            warMetaData.setWebFragmentsMetaData( webFragmentsMetaData );
        }

        JBossWebMetaData jbossWebMetaData = warMetaData.getJBossWebMetaData();

        if (jbossWebMetaData == null) {
            jbossWebMetaData = new JBossWebMetaData();
            warMetaData.setJBossWebMetaData( jbossWebMetaData );
        }

        setUpSessionConfig( jbossWebMetaData, rackAppMetaData );

        setUpSendfileFilter( webMetaData );
        setUpRackFilter( unit, rackAppMetaData, webMetaData );
        setUpStaticResourceServlet( rackAppMetaData, webMetaData, railsAppMetaData != null );
        ensureSomeServlet( rackAppMetaData, webMetaData );
        try {
            jbossWebMetaData.setContextRoot( rackAppMetaData.getContextPath() );
            setUpPoolDependency( rackAppMetaData, jbossWebMetaData );
        } catch (Exception e) {
            throw new DeploymentUnitProcessingException( e );
        }

        jbossWebMetaData.setVirtualHosts( rackAppMetaData.getHosts() );

        ServletContextAttribute serviceRegistryValue = new ServletContextAttribute( "service.registry", unit.getServiceRegistry() );
        unit.addToAttachmentList( ServletContextAttribute.ATTACHMENT_KEY, serviceRegistryValue );

        ServletContextAttribute componentResolverNameValue = new ServletContextAttribute( "component.resolver.service-name",
View Full Code Here

        DeploymentUnit unit = phaseContext.getDeploymentUnit();
        if (DeploymentUtils.isUnitRootless( unit )) {
            return;
        }
        RubyAppMetaData rubyAppMetaData = unit.getAttachment( RubyAppMetaData.ATTACHMENT_KEY );
        RackMetaData rackAppMetaData = unit.getAttachment( RackMetaData.ATTACHMENT_KEY );
        RailsMetaData railsAppMetaData = unit.getAttachment( RailsMetaData.ATTACHMENT_KEY );

        if ( rubyAppMetaData == null || rackAppMetaData == null || railsAppMetaData == null ) {
            return;
        }
View Full Code Here

        DeploymentUnit unit = phaseContext.getDeploymentUnit();
        if (DeploymentUtils.isUnitRootless( unit )) {
            return;
        }
        RubyAppMetaData rubyAppMetaData = unit.getAttachment( RubyAppMetaData.ATTACHMENT_KEY );
        RackMetaData rackAppMetaData = unit.getAttachment( RackMetaData.ATTACHMENT_KEY );
       
        if ( rubyAppMetaData == null || rackAppMetaData == null ) {
            return;
        }
       
View Full Code Here

TOP

Related Classes of org.torquebox.web.rack.RackMetaData

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.