Package org.torquebox.services

Examples of org.torquebox.services.ServiceMetaData


    @Test
    public void testPoolRequired() throws Exception {
        DeploymentPhaseContext phaseContext = createPhaseContext();
        DeploymentUnit unit = phaseContext.getDeploymentUnit();

        unit.addToAttachmentList( ServiceMetaData.ATTACHMENTS_KEY, new ServiceMetaData() );

        deploy( phaseContext );

        List<PoolMetaData> allPools = unit.getAttachmentList( PoolMetaData.ATTACHMENTS_KEY );
        assertEquals( 1, allPools.size() );
View Full Code Here


    protected void parse(DeploymentUnit unit, Object dataObj) throws Exception {
        Map<String, Map<String, Object>> results = (Map<String, Map<String, Object>>) dataObj;
        if (results != null) {
            for (String service : results.keySet()) {
                Map<String, Object> params = results.get( service );
                ServiceMetaData serviceMetaData = new ServiceMetaData();
                boolean requiresSingleton = requiresSingletonparams );
                serviceMetaData.setRequiresSingleton( requiresSingleton );

                String className = service;
                Map<String, Object> config = null;

                if (params != null) {
                    if (params.containsKey( "service" )) {
                        className = (String)params.remove( "service" );
                    }

                    if (params.containsKey( "config" )) {
                        config = (Map<String, Object>)params.remove( "config" );
                    } else {
                        if (!params.isEmpty()) {
                            logDeprecation( unit, "Use the config: key to pass configuration to a service - the method you are using has been deprecated (service: " + service + ")" );
                        }
                        config = params;
                    }
                }

                serviceMetaData.setClassName( className );
                serviceMetaData.setName( service );
                serviceMetaData.setParameters( config );
                serviceMetaData.setRubyRequirePath( StringUtils.underscore( className.trim() ) );

                unit.addToAttachmentList( ServiceMetaData.ATTACHMENTS_KEY, serviceMetaData );
            }
        }
    }
View Full Code Here

        MockDeploymentUnit unit = deployResourceAsTorqueboxYml( "named-service.yml" );
       
        List<ServiceMetaData> allMetaData = unit.getAttachmentList( ServiceMetaData.ATTACHMENTS_KEY );
       
        assertEquals( 1, allMetaData.size() );
        ServiceMetaData metaData = allMetaData.get( 0 );
       
        assertEquals( "FooService", metaData.getClassName() );
        assertEquals( "foo_service", metaData.getName() );
    }
View Full Code Here

TOP

Related Classes of org.torquebox.services.ServiceMetaData

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.