Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @RunWith(SpringJUnit4ClassRunner.class)
- @SpringApplicationConfiguration(classes = {
- Application.class,
- TrivialIT.PostConfiguration.class
- })
- @WebAppConfiguration
- @IntegrationTest("server.port=0")
- @ActiveProfiles({"default", "test"})
- @ConfigurationProperties("application.yml")
- public class TrivialIT {
- Logger LOG = LoggerFactory.getLogger(TrivialIT.class);
- @Autowired
- ApplicationContext context;
- @Test
- public void should_load_all_the_beans() throws Exception {
- LOG.info("\n\n");
- LOG.info("Beans report ****************************************");
- for (String beanName : context.getBeanDefinitionNames()) {
- LOG.info("Bean: {} -> {}", beanName, context.getBean(beanName).getClass().getName());
- };
- LOG.info("\n\n");
- LOG.info("Profiles report ************************************");
- for (String profile : context.getEnvironment().getActiveProfiles()) {
- LOG.info("Profile: {}", profile);
- }
- LOG.info("\n\n");
- }
- @Configuration
- @Import({
- JmsAutoConfiguration.class,
- ActiveMQAutoConfiguration.class
- })
- public static class PostConfiguration {
- @Bean
- RestTemplate restTemplate() {
- return new RestTemplate();
- }
- @Bean(name = "connectionFactory")
- UserCredentialsConnectionFactoryAdapter userCredentialsConnectionFactoryAdapter(ActiveMQConnectionFactory jmsConnectionFactory) throws NamingException {
- UserCredentialsConnectionFactoryAdapter factoryAdapter = new UserCredentialsConnectionFactoryAdapter();
- factoryAdapter.setTargetConnectionFactory(jmsConnectionFactory);
- return factoryAdapter;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement