Results 1 to 2 of 2

Thread: roo + spring 3.1 + environment profiles + auto generated tests

  1. #1
    Join Date
    Jun 2005
    Location
    Cincinnati Ohio
    Posts
    40

    Default roo + spring 3.1 + environment profiles + auto generated tests

    Spring 3.1 adds supports for environment profiles to context setup.


    At the end of this post is an example from the spring 3.1 docs.

    I am planning on using 3 environment profiles:
    1) dev - deployment to a dev server
    2) production - deployment to production server
    3) testing - unit test profile


    Is there a way to get roo to add the @ActiveProfile("testing") profile to the generated .aj files?

    It would be nice if roo supported profiles in the application context, but I am happy to do that manually.

    Thanks
    Mike
    ------------------------------------------------------------------------------------------------


    Code:
    <!-- app-config.xml -->
    <beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:jdbc="http://www.springframework.org/schema/jdbc"
        xmlns:jee="http://www.springframework.org/schema/jee"
        xsi:schemaLocation="...">
    
       ------ some lines deleted
    
        <beans profile="dev">
            <jdbc:embedded-database id="dataSource">
                <jdbc:script
                    location="classpath:com/bank/config/sql/schema.sql"/>
                <jdbc:script
                    location="classpath:com/bank/config/sql/test-data.sql"/>
            </jdbc:embedded-database>
        </beans>
    
        <beans profile="production">
            <jee:jndi-lookup id="dataSource"
                jndi-name="java:comp/env/jdbc/datasource"/>
        </beans>
    
    </beans>



    Code:
    package com.bank.service;
    
    @RunWith(SpringJUnit4ClassRunner.class)
    // ApplicationContext will be loaded from "classpath:/app-config.xml"
    @ContextConfiguration("/app-config.xml")
    @ActiveProfiles("dev")
    public class TransferServiceTest {
    
       @Autowired
       private TransferService transferService;
    
       @Test
       public void testTransferService() {
           // test the transferService
       }
    }
    Last edited by scmikes; Apr 3rd, 2012 at 01:42 PM. Reason: correct code markup
    The greatest performance improvement is the transition from a non-working state to the working state...

  2. #2
    Join Date
    May 2006
    Location
    Madrid
    Posts
    382

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •