Package org.torquebox.core.runtime

Examples of org.torquebox.core.runtime.RubyRuntimeMetaData


    public void testWithRuntimeMetaDataProfilingTrue() throws Exception {
        URL rubyYml = getClass().getResource( "ruby-profiling-true.yml" );
        MockDeploymentPhaseContext phaseContext = createPhaseContext( "torquebox.yml", rubyYml );
        MockDeploymentUnit unit = phaseContext.getMockDeploymentUnit();

        RubyRuntimeMetaData runtimeMetaData = new RubyRuntimeMetaData();
        unit.putAttachment( RubyRuntimeMetaData.ATTACHMENT_KEY, runtimeMetaData );

        deploy( phaseContext );

        RubyRuntimeMetaData runtimeMetaData2 = unit.getAttachment( RubyRuntimeMetaData.ATTACHMENT_KEY );

        assertSame( runtimeMetaData, runtimeMetaData2 );
        assertTrue( runtimeMetaData.isProfileApi() );
    }
View Full Code Here


    public void testWithRuntimeMetaDataProfilingFalse() throws Exception {
        URL rubyYml = getClass().getResource( "ruby-profiling-false.yml" );
        MockDeploymentPhaseContext phaseContext = createPhaseContext( "torquebox.yml", rubyYml );
        MockDeploymentUnit unit = phaseContext.getMockDeploymentUnit();

        RubyRuntimeMetaData runtimeMetaData = new RubyRuntimeMetaData();
        unit.putAttachment( RubyRuntimeMetaData.ATTACHMENT_KEY, runtimeMetaData );

        deploy( phaseContext );

        RubyRuntimeMetaData runtimeMetaData2 = unit.getAttachment( RubyRuntimeMetaData.ATTACHMENT_KEY );

        assertSame( runtimeMetaData, runtimeMetaData2 );
        assertFalse( runtimeMetaData.isProfileApi() );
    }
View Full Code Here

    public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
        DeploymentUnit unit = phaseContext.getDeploymentUnit();
        if (DeploymentUtils.isUnitRootless( unit )) {
            return;
        }
        RubyRuntimeMetaData runtimeMetaData = unit.getAttachment( RubyRuntimeMetaData.ATTACHMENT_KEY );
       
        if (runtimeMetaData != null) {
            try {
                runtimeMetaData.appendLoadPath( "app/services" );
                runtimeMetaData.appendLoadPath( "services" );
            } catch (Exception e) {
                throw new DeploymentUnitProcessingException( e );
            }
        }
    }
View Full Code Here

    public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
        DeploymentUnit unit = phaseContext.getDeploymentUnit();
        if (DeploymentUtils.isUnitRootless( unit )) {
            return;
        }
        RubyRuntimeMetaData runtimeMetaData = unit.getAttachment( RubyRuntimeMetaData.ATTACHMENT_KEY );
       
        if (runtimeMetaData != null && runtimeMetaData.getRuntimeInitializer() instanceof RailsRuntimeInitializer) {
            RailsRuntimeInitializer initializer = (RailsRuntimeInitializer) runtimeMetaData.getRuntimeInitializer();
            for (RubyLoadPathMetaData path : runtimeMetaData.getLoadPaths()) {
                if (path.isAutoload()) {
                    initializer.addAutoloadPath( path.getPath().getAbsolutePath() );
                }
            }
        }
View Full Code Here

    public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
        DeploymentUnit unit = phaseContext.getDeploymentUnit();
        if (DeploymentUtils.isUnitRootless( unit )) {
            return;
        }
        RubyRuntimeMetaData runtimeMetaData = unit.getAttachment( RubyRuntimeMetaData.ATTACHMENT_KEY );
       
        if (runtimeMetaData != null) {
            try {
                runtimeMetaData.appendLoadPath( "app/jobs" );
                runtimeMetaData.appendLoadPath( "jobs" );
            } catch (Exception e) {
                throw new DeploymentUnitProcessingException( e );
            }
        }
    }
View Full Code Here

    }

    @SuppressWarnings("unchecked")
    public void parse(DeploymentUnit unit, Object dataObj) throws Exception {

        RubyRuntimeMetaData runtimeMetaData = unit.getAttachment( RubyRuntimeMetaData.ATTACHMENT_KEY );
        if (runtimeMetaData == null) {
            log.debug( "Initializing ruby runtime metadata: " + unit );
            runtimeMetaData = new RubyRuntimeMetaData();
            unit.putAttachment( RubyRuntimeMetaData.ATTACHMENT_KEY, runtimeMetaData );
        }

        Map<String, Object> config = (Map<String, Object>) dataObj;

        Object version = config.get( "version" );
        if ("1.8".equals( "" + version )) {
            runtimeMetaData.setVersion( RubyRuntimeMetaData.Version.V1_8 );
        } else if ("1.9".equals( "" + version )) {
            runtimeMetaData.setVersion( RubyRuntimeMetaData.Version.V1_9 );
        } else if ("2.0".equals( "" + version )) {
            runtimeMetaData.setVersion( RubyRuntimeMetaData.Version.V2_0 );
        }

        Object compileMode = config.get( "compile_mode" );
        if ("false".equals( "" + compileMode )) { // 'off' becomes 'false' via
                                                  // the yml parser
            runtimeMetaData.setCompileMode( RubyRuntimeMetaData.CompileMode.OFF );
        } else if ("jit".equals( "" + compileMode )) {
            runtimeMetaData.setCompileMode( RubyRuntimeMetaData.CompileMode.JIT );
        } else if ("force".equals( "" + compileMode )) {
            runtimeMetaData.setCompileMode( RubyRuntimeMetaData.CompileMode.FORCE );
        }

        Object debug = config.get( "debug" );
        if ("false".equals( "" + debug )) {
            runtimeMetaData.setDebug( false );
        } else if ("true".equals( "" + debug )) {
            runtimeMetaData.setDebug( true );
        }

        Object interactive = config.get( "interactive" );
        if ("false".equals( "" + interactive )) {
            runtimeMetaData.setInteractive( false );
        } else if ("true".equals( "" + interactive )) {
            runtimeMetaData.setInteractive( true );
        }
       
        Object profileApi = config.get( "profile_api" );
        if (profileApi != null) {
            runtimeMetaData.setProfileApi( (Boolean) profileApi );
        }

    }
View Full Code Here

    public void testDeployment() throws Exception {
       
        MockDeploymentPhaseContext phaseContext = createPhaseContext();
        MockDeploymentUnit unit = phaseContext.getMockDeploymentUnit();

        RubyRuntimeMetaData metaData = new RubyRuntimeMetaData();
        unit.putAttachment( RubyRuntimeMetaData.ATTACHMENT_KEY, metaData );
       
        RubyAppMetaData rubyAppMetaData = new RubyAppMetaData( "foo" );
        rubyAppMetaData.attachTo( unit );
       
View Full Code Here

    public void testDeploymentWithNonDefaultRubyCompatibilityVersion() throws Exception {
       
        MockDeploymentPhaseContext phaseContext = createPhaseContext();
        MockDeploymentUnit unit = phaseContext.getMockDeploymentUnit();
       
        RubyRuntimeMetaData metaData = new RubyRuntimeMetaData();
        metaData.setVersion( RubyRuntimeMetaData.Version.V1_9 );
        unit.putAttachment( RubyRuntimeMetaData.ATTACHMENT_KEY, metaData );
       
        RubyAppMetaData rubyAppMetaData = new RubyAppMetaData( "foo");
        rubyAppMetaData.attachTo( unit );
               
View Full Code Here

    @Test
    public void testDeploymentWithJITCompileMode() throws Exception {
        MockDeploymentPhaseContext phaseContext = createPhaseContext();
        MockDeploymentUnit unit = phaseContext.getMockDeploymentUnit();
       
        RubyRuntimeMetaData metaData = new RubyRuntimeMetaData();
        metaData.setCompileMode( RubyRuntimeMetaData.CompileMode.JIT );
        unit.putAttachment( RubyRuntimeMetaData.ATTACHMENT_KEY, metaData );


        RubyAppMetaData rubyAppMetaData = new RubyAppMetaData( "foo");
        rubyAppMetaData.attachTo( unit );
View Full Code Here

    @Test
    public void testDeploymentWithOFFCompileMode() throws Exception {
        MockDeploymentPhaseContext phaseContext = createPhaseContext();
        MockDeploymentUnit unit = phaseContext.getMockDeploymentUnit();
       
        RubyRuntimeMetaData metaData = new RubyRuntimeMetaData();
        metaData.setCompileMode( RubyRuntimeMetaData.CompileMode.OFF );
        unit.putAttachment( RubyRuntimeMetaData.ATTACHMENT_KEY, metaData );


        RubyAppMetaData rubyAppMetaData = new RubyAppMetaData( "foo");
        rubyAppMetaData.attachTo( unit );
View Full Code Here

TOP

Related Classes of org.torquebox.core.runtime.RubyRuntimeMetaData

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.