| 1 | 
    
            
    
     | 
    
           | 
  
            
  
    | 2 | 
    
            
    
     | 
    
           | 
  
            
  
    | 3 | 
    
            
    
     | 
    
           | 
  
            
  
    | 4 | 
    
            
    
     | 
    
           | 
  
            
  
    | 5 | 
    
            
    
     | 
    
           | 
  
            
  
    | 6 | 
    
            
    
     | 
    
           | 
  
            
  
    | 7 | 
    
            
    
     | 
    
           | 
  
            
  
    | 8 | 
    
            
    
     | 
    
           | 
  
            
  
    | 9 | 
    
            
    
     | 
    
           | 
  
            
  
    | 10 | 
    
            
    
     | 
    
           | 
  
            
  
    | 11 | 
    
            
    
     | 
    
           | 
  
            
  
    | 12 | 
    
            
    
     | 
    
           | 
  
            
  
    | 13 | 
    
            
    
     | 
    
           | 
  
            
  
    | 14 | 
    
            
    
     | 
    
           | 
  
            
  
    | 15 | 
    
            
    
     | 
    
           | 
  
            
  
    | 16 | 
    
            
    
     | 
    
      package edu.sampleu.travel.infrastructure;     | 
  
            
  
    | 17 | 
    
            
    
     | 
    
           | 
  
            
  
    | 18 | 
    
            
    
     | 
    
      import org.apache.commons.lang.StringUtils;     | 
  
            
  
    | 19 | 
    
            
    
     | 
    
      import org.apache.log4j.Logger;     | 
  
            
  
    | 20 | 
    
            
    
     | 
    
      import org.springframework.context.ConfigurableApplicationContext;     | 
  
            
  
    | 21 | 
    
            
    
     | 
    
      import org.springframework.context.support.ClassPathXmlApplicationContext;     | 
  
            
  
    | 22 | 
    
            
    
     | 
    
           | 
  
            
  
    | 23 | 
    
            
    
     | 
    
           | 
  
            
  
    | 24 | 
    
            
    
     | 
    
           | 
  
            
  
    | 25 | 
    
            
    
     | 
    
      @author     | 
  
            
  
    | 26 | 
    
            
    
     | 
    
           | 
  
               
        | 
             
         | 
        
       
        | 
       
           
           
            | 0% | 
           Uncovered Elements: 14 (14) | 
           Complexity: 4 | 
           Complexity Density: 0.5 | 
                        
            
        | 
    
  
  
    | 27 | 
    
            
    
     | 
    
      public class TravelServiceLocator {     | 
  
            
  
    | 28 | 
    
            
    
     | 
    
          private static final Logger LOG = Logger.getLogger(TravelServiceLocator.class);     | 
  
            
  
    | 29 | 
    
            
    
     | 
    
           | 
  
            
  
    | 30 | 
    
            
    
     | 
    
          private static final String STANDARD_CONTEXT = "classpath:SampleAppBeans.xml";     | 
  
            
  
    | 31 | 
    
            
    
     | 
    
          private static final String TEST_CONTEXT = "classpath:SampleAppBeans-test.xml";     | 
  
            
  
    | 32 | 
    
            
    
     | 
    
           | 
  
            
  
    | 33 | 
    
            
    
     | 
    
          private static ConfigurableApplicationContext appContext;     | 
  
            
  
    | 34 | 
    
            
    
     | 
    
           | 
  
               
        | 
             
         | 
        
       
        | 
       
           
           
            | 0% | 
           Uncovered Elements: 11 (11) | 
           Complexity: 3 | 
           Complexity Density: 0.43 | 
                        
            
        | 
    
  
  
    | 35 | 
    
           0
    
     | 
    
           public static synchronized void initialize(boolean test) {...     | 
  
            
  
    | 36 | 
    
           0
    
     | 
    
              if (appContext == null) {     | 
  
            
  
    | 37 | 
    
           0
    
     | 
    
                  final String[] resources;     | 
  
            
  
    | 38 | 
    
            
    
     | 
    
                       | 
  
            
  
    | 39 | 
    
           0
    
     | 
    
                  if (test) {     | 
  
            
  
    | 40 | 
    
           0
    
     | 
    
                      resources = new String[] { STANDARD_CONTEXT, TEST_CONTEXT };     | 
  
            
  
    | 41 | 
    
            
    
     | 
    
                  } else {     | 
  
            
  
    | 42 | 
    
           0
    
     | 
    
                      resources = new String[] { STANDARD_CONTEXT };     | 
  
            
  
    | 43 | 
    
            
    
     | 
    
                  }     | 
  
            
  
    | 44 | 
    
           0
    
     | 
    
                  LOG.info("Loading contexts: " + StringUtils.join(resources, ", "));     | 
  
            
  
    | 45 | 
    
           0
    
     | 
    
                  appContext = new ClassPathXmlApplicationContext(resources);     | 
  
            
  
    | 46 | 
    
            
    
     | 
    
              }     | 
  
            
  
    | 47 | 
    
            
    
     | 
    
          }     | 
  
            
  
    | 48 | 
    
            
    
     | 
    
           | 
  
               
        | 
             
         | 
        
       
        | 
       
           
           
            | 0% | 
           Uncovered Elements: 1 (1) | 
           Complexity: 1 | 
           Complexity Density: 1 | 
                        
            
        | 
    
  
  
    | 49 | 
    
           0
    
     | 
    
           public static synchronized ConfigurableApplicationContext getAppContext() {...     | 
  
            
  
    | 50 | 
    
           0
    
     | 
    
              return appContext;     | 
  
            
  
    | 51 | 
    
            
    
     | 
    
          }         | 
  
            
  
    | 52 | 
    
            
    
     | 
    
      }     |