// Path: src/main/java/com/raibledesigns/config/ResourcesConfig.java
// @Configuration
// public class ResourcesConfig {
// 
//     @Bean
//     public static PropertySourcesPlaceholderConfigurer properties() {
//         PropertySourcesPlaceholderConfigurer configurer = new PropertySourcesPlaceholderConfigurer();
//         configurer.setIgnoreUnresolvablePlaceholders(true);
//         configurer.setLocations(new ClassPathResource("mail.properties"));
//         return configurer;
//     }
// }
// 
// Path: src/main/java/com/raibledesigns/config/ServiceConfig.java
// @EnableTransactionManagement
// @EnableAspectJAutoProxy
// @Configuration
// @ComponentScan("com.raibledesigns.service")
// public class ServiceConfig {
// 
//     @Bean
//     @Autowired
//     public MailEngine mailEngine(VelocityEngine velocityEngine) {
//         MailEngine mailEngine = new MailEngine();
//         mailEngine.setVelocityEngine(velocityEngine);
//         mailEngine.setFrom("${mail.default.from}");
//         return mailEngine;
//     }
// 
//     @Bean
//     public JavaMailSenderImpl mailSender(@Value("${mail.host}") String mailHost) {
//         JavaMailSenderImpl mailSender = new JavaMailSenderImpl();
//         mailSender.setHost(mailHost);
//         mailSender.setDefaultEncoding("UTF-8");
//         return mailSender;
//     }
// 
//     @Bean
//     public VelocityEngineFactoryBean velocityEngine() {
//         VelocityEngineFactoryBean velocityEngineFactoryBean = new VelocityEngineFactoryBean();
//         Properties properties = new Properties();
//         properties.setProperty("resource.loader", "class");
//         properties.setProperty("class.resource.loader.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
//         properties.setProperty("velocimacro.library", "");
//         velocityEngineFactoryBean.setVelocityProperties(properties);
//         return velocityEngineFactoryBean;
//     }
// 
//     @Bean
//     @Scope("prototype")
//     public SimpleMailMessage mailMessage(@Value("${mail.default.from}") String defaultFrom) {
//         SimpleMailMessage mailMessage = new SimpleMailMessage();
//         mailMessage.setFrom(defaultFrom);
//         return mailMessage;
//     }
// 
//     @Bean
//     public PasswordEncoder passwordEncoder() {
//         return new BCryptPasswordEncoder();
//     }
// 
//     @Bean(name = "passwordTokenEncoder")
//     public PasswordEncoder passwordTokenEncoder() {
//         return new StandardPasswordEncoder();
//     }
// }
// 
// Path: src/main/java/com/raibledesigns/util/ConvertUtil.java
// public final class ConvertUtil {
//     private static final Log log = LogFactory.getLog(ConvertUtil.class);
// 
//     /**
//      * Checkstyle rule: utility classes should not have public constructor
//      */
//     private ConvertUtil() {
//     }
// 
//     /**
//      * Method to convert a ResourceBundle to a Map object.
//      *
//      * @param rb a given resource bundle
//      * @return Map a populated map
//      */
//     public static Map<String, String> convertBundleToMap(ResourceBundle rb) {
//         Map<String, String> map = new HashMap<String, String>();
// 
//         Enumeration<String> keys = rb.getKeys();
//         while (keys.hasMoreElements()) {
//             String key = keys.nextElement();
//             map.put(key, rb.getString(key));
//         }
// 
//         return map;
//     }
// 
//     /**
//      * Convert a java.util.List of LabelValue objects to a LinkedHashMap.
//      *
//      * @param list the list to convert
//      * @return the populated map with the label as the key
//      */
//     public static Map<String, String> convertListToMap(List<LabelValue> list) {
//         Map<String, String> map = new LinkedHashMap<String, String>();
// 
//         for (LabelValue option : list) {
//             map.put(option.getLabel(), option.getValue());
//         }
// 
//         return map;
//     }
// 
//     /**
//      * Method to convert a ResourceBundle to a Properties object.
//      *
//      * @param rb a given resource bundle
//      * @return Properties a populated properties object
//      */
//     public static Properties convertBundleToProperties(ResourceBundle rb) {
//         Properties props = new Properties();
// 
//         for (Enumeration<String> keys = rb.getKeys(); keys.hasMoreElements();) {
//             String key = keys.nextElement();
//             props.put(key, rb.getString(key));
//         }
// 
//         return props;
//     }
// 
//     /**
//      * Convenience method used by tests to populate an object from a
//      * ResourceBundle
//      *
//      * @param obj an initialized object
//      * @param rb a resource bundle
//      * @return a populated object
//      */
//     public static Object populateObject(Object obj, ResourceBundle rb) {
//         try {
//             Map<String, String> map = convertBundleToMap(rb);
//             BeanUtils.copyProperties(obj, map);
//         } catch (Exception e) {
//             e.printStackTrace();
//             log.error("Exception occurred populating object: " + e.getMessage());
//         }
// 
//         return obj;
//     }
// }


import com.raibledesigns.config.ResourcesConfig;
import com.raibledesigns.config.ServiceConfig;
import com.raibledesigns.util.ConvertUtil;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import javax.transaction.Transactional;
import java.util.Map;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
package com.raibledesigns.service;



@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {ResourcesConfig.class, ServiceConfig.class})
/**
 * Test classes can extend this manager based on a spring context.
 * This test class can be moved to the test tree.
 *
 * @author mraible
 */
// Path: src/main/java/com/raibledesigns/config/ResourcesConfig.java
// @Configuration
// public class ResourcesConfig {
// 
//     @Bean
//     public static PropertySourcesPlaceholderConfigurer properties() {
//         PropertySourcesPlaceholderConfigurer configurer = new PropertySourcesPlaceholderConfigurer();
//         configurer.setIgnoreUnresolvablePlaceholders(true);
//         configurer.setLocations(new ClassPathResource("mail.properties"));
//         return configurer;
//     }
// }
// 
// Path: src/main/java/com/raibledesigns/config/ServiceConfig.java
// @EnableTransactionManagement
// @EnableAspectJAutoProxy
// @Configuration
// @ComponentScan("com.raibledesigns.service")
// public class ServiceConfig {
// 
//     @Bean
//     @Autowired
//     public MailEngine mailEngine(VelocityEngine velocityEngine) {
//         MailEngine mailEngine = new MailEngine();
//         mailEngine.setVelocityEngine(velocityEngine);
//         mailEngine.setFrom("${mail.default.from}");
//         return mailEngine;
//     }
// 
//     @Bean
//     public JavaMailSenderImpl mailSender(@Value("${mail.host}") String mailHost) {
//         JavaMailSenderImpl mailSender = new JavaMailSenderImpl();
//         mailSender.setHost(mailHost);
//         mailSender.setDefaultEncoding("UTF-8");
//         return mailSender;
//     }
// 
//     @Bean
//     public VelocityEngineFactoryBean velocityEngine() {
//         VelocityEngineFactoryBean velocityEngineFactoryBean = new VelocityEngineFactoryBean();
//         Properties properties = new Properties();
//         properties.setProperty("resource.loader", "class");
//         properties.setProperty("class.resource.loader.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
//         properties.setProperty("velocimacro.library", "");
//         velocityEngineFactoryBean.setVelocityProperties(properties);
//         return velocityEngineFactoryBean;
//     }
// 
//     @Bean
//     @Scope("prototype")
//     public SimpleMailMessage mailMessage(@Value("${mail.default.from}") String defaultFrom) {
//         SimpleMailMessage mailMessage = new SimpleMailMessage();
//         mailMessage.setFrom(defaultFrom);
//         return mailMessage;
//     }
// 
//     @Bean
//     public PasswordEncoder passwordEncoder() {
//         return new BCryptPasswordEncoder();
//     }
// 
//     @Bean(name = "passwordTokenEncoder")
//     public PasswordEncoder passwordTokenEncoder() {
//         return new StandardPasswordEncoder();
//     }
// }
// 
// Path: src/main/java/com/raibledesigns/util/ConvertUtil.java
// public final class ConvertUtil {
//     private static final Log log = LogFactory.getLog(ConvertUtil.class);
// 
//     /**
//      * Checkstyle rule: utility classes should not have public constructor
//      */
//     private ConvertUtil() {
//     }
// 
//     /**
//      * Method to convert a ResourceBundle to a Map object.
//      *
//      * @param rb a given resource bundle
//      * @return Map a populated map
//      */
//     public static Map<String, String> convertBundleToMap(ResourceBundle rb) {
//         Map<String, String> map = new HashMap<String, String>();
// 
//         Enumeration<String> keys = rb.getKeys();
//         while (keys.hasMoreElements()) {
//             String key = keys.nextElement();
//             map.put(key, rb.getString(key));
//         }
// 
//         return map;
//     }
// 
//     /**
//      * Convert a java.util.List of LabelValue objects to a LinkedHashMap.
//      *
//      * @param list the list to convert
//      * @return the populated map with the label as the key
//      */
//     public static Map<String, String> convertListToMap(List<LabelValue> list) {
//         Map<String, String> map = new LinkedHashMap<String, String>();
// 
//         for (LabelValue option : list) {
//             map.put(option.getLabel(), option.getValue());
//         }
// 
//         return map;
//     }
// 
//     /**
//      * Method to convert a ResourceBundle to a Properties object.
//      *
//      * @param rb a given resource bundle
//      * @return Properties a populated properties object
//      */
//     public static Properties convertBundleToProperties(ResourceBundle rb) {
//         Properties props = new Properties();
// 
//         for (Enumeration<String> keys = rb.getKeys(); keys.hasMoreElements();) {
//             String key = keys.nextElement();
//             props.put(key, rb.getString(key));
//         }
// 
//         return props;
//     }
// 
//     /**
//      * Convenience method used by tests to populate an object from a
//      * ResourceBundle
//      *
//      * @param obj an initialized object
//      * @param rb a resource bundle
//      * @return a populated object
//      */
//     public static Object populateObject(Object obj, ResourceBundle rb) {
//         try {
//             Map<String, String> map = convertBundleToMap(rb);
//             BeanUtils.copyProperties(obj, map);
//         } catch (Exception e) {
//             e.printStackTrace();
//             log.error("Exception occurred populating object: " + e.getMessage());
//         }
// 
//         return obj;
//     }
// }


// Path: src/test/java/com/raibledesigns/service/BaseManagerTestCase.java
import com.raibledesigns.config.ResourcesConfig;
import com.raibledesigns.config.ServiceConfig;
import com.raibledesigns.util.ConvertUtil;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import javax.transaction.Transactional;
import java.util.Map;
import java.util.MissingResourceException;
import java.util.ResourceBundle;

package com.raibledesigns.service;



@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {ResourcesConfig.class, ServiceConfig.class})
/**
 * Test classes can extend this manager based on a spring context.
 * This test class can be moved to the test tree.
 *
 * @author mraible
 */
@Transactional