// Path: src/main/java/net/unicon/cas/addons/info/events/listeners/RedisStatsRecorderForServiceTicketValidatedEvents.java
// @ThreadSafe
// public class RedisStatsRecorderForServiceTicketValidatedEvents implements
//         ApplicationListener<CasServiceTicketValidatedEvent> {
// 
//     private static final Logger logger = LoggerFactory.getLogger(RedisStatsRecorderForServiceTicketValidatedEvents.class);
// 
//     private StringRedisTemplate redisTemplate;
// 
//     public RedisStatsRecorderForServiceTicketValidatedEvents(JedisConnectionFactory connectionFactory) {
//         this.redisTemplate = new StringRedisTemplate(connectionFactory);
//     }
// 
//     @Override
//     public void onApplicationEvent(CasServiceTicketValidatedEvent event) {
//         final String today = DateTime.now().toString("yyyy-MM-dd");
//         try {
//             logger.debug("Incrementing value for key 'cas:st-validated:{}' in Redis server...", today);
//             this.redisTemplate.opsForValue().increment("cas:st-validated:" + today, 1L);
//         }
//         catch (Throwable e) {
//             logger.warn("Unable to increment value for key 'cas:st-validated:'" + today + " in Redis. Caught the following exception: ", e);
//         }
//     }
// }
// 
// Path: src/main/java/net/unicon/cas/addons/info/events/listeners/RedisStatsRecorderForSsoSessionEstablishedEvents.java
// @ThreadSafe
// public class RedisStatsRecorderForSsoSessionEstablishedEvents implements
//         ApplicationListener<CasSsoSessionEstablishedEvent> {
// 
//     private static final Logger logger = LoggerFactory.getLogger(RedisStatsRecorderForSsoSessionEstablishedEvents.class);
// 
//     private StringRedisTemplate redisTemplate;
// 
//     public RedisStatsRecorderForSsoSessionEstablishedEvents(JedisConnectionFactory connectionFactory) {
//         this.redisTemplate = new StringRedisTemplate(connectionFactory);
//     }
// 
//     @Override
//     public void onApplicationEvent(CasSsoSessionEstablishedEvent event) {
//         final String today = DateTime.now().toString("yyyy-MM-dd");
//         try {
//             logger.debug("Incrementing value for key 'cas:sso-sessions-established:{}' in Redis server...", today);
//             this.redisTemplate.opsForValue().increment("cas:sso-sessions-established:" + today, 1L);
//         }
//         catch (Throwable e) {
//             logger.warn("Unable to increment value for key 'cas:sso-sessions-established:'" + today + " in Redis. Caught the following exception: ", e);
//         }
//     }
// }


import net.unicon.cas.addons.info.events.listeners.RedisStatsRecorderForServiceTicketValidatedEvents;
import net.unicon.cas.addons.info.events.listeners.RedisStatsRecorderForSsoSessionEstablishedEvents;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import static org.junit.Assert.assertTrue;
package net.unicon.cas.addons.config;



/**
 * @author Dmitriy Kopylenko
 * @author Unicon, inc.
 */
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration
public class CasNamespaceEventsRedisRecorderBeanDefinitionParserTests {

    @Autowired
    ApplicationContext applicationContext;

    @Test
    public void eventsRedisRecorderBeanDefinitionCorrectlyParsed() {
        assertTrue(applicationContext.getBeansOfType(RedisStatsRecorderForSsoSessionEstablishedEvents.class).size() == 1);
// Path: src/main/java/net/unicon/cas/addons/info/events/listeners/RedisStatsRecorderForServiceTicketValidatedEvents.java
// @ThreadSafe
// public class RedisStatsRecorderForServiceTicketValidatedEvents implements
//         ApplicationListener<CasServiceTicketValidatedEvent> {
// 
//     private static final Logger logger = LoggerFactory.getLogger(RedisStatsRecorderForServiceTicketValidatedEvents.class);
// 
//     private StringRedisTemplate redisTemplate;
// 
//     public RedisStatsRecorderForServiceTicketValidatedEvents(JedisConnectionFactory connectionFactory) {
//         this.redisTemplate = new StringRedisTemplate(connectionFactory);
//     }
// 
//     @Override
//     public void onApplicationEvent(CasServiceTicketValidatedEvent event) {
//         final String today = DateTime.now().toString("yyyy-MM-dd");
//         try {
//             logger.debug("Incrementing value for key 'cas:st-validated:{}' in Redis server...", today);
//             this.redisTemplate.opsForValue().increment("cas:st-validated:" + today, 1L);
//         }
//         catch (Throwable e) {
//             logger.warn("Unable to increment value for key 'cas:st-validated:'" + today + " in Redis. Caught the following exception: ", e);
//         }
//     }
// }
// 
// Path: src/main/java/net/unicon/cas/addons/info/events/listeners/RedisStatsRecorderForSsoSessionEstablishedEvents.java
// @ThreadSafe
// public class RedisStatsRecorderForSsoSessionEstablishedEvents implements
//         ApplicationListener<CasSsoSessionEstablishedEvent> {
// 
//     private static final Logger logger = LoggerFactory.getLogger(RedisStatsRecorderForSsoSessionEstablishedEvents.class);
// 
//     private StringRedisTemplate redisTemplate;
// 
//     public RedisStatsRecorderForSsoSessionEstablishedEvents(JedisConnectionFactory connectionFactory) {
//         this.redisTemplate = new StringRedisTemplate(connectionFactory);
//     }
// 
//     @Override
//     public void onApplicationEvent(CasSsoSessionEstablishedEvent event) {
//         final String today = DateTime.now().toString("yyyy-MM-dd");
//         try {
//             logger.debug("Incrementing value for key 'cas:sso-sessions-established:{}' in Redis server...", today);
//             this.redisTemplate.opsForValue().increment("cas:sso-sessions-established:" + today, 1L);
//         }
//         catch (Throwable e) {
//             logger.warn("Unable to increment value for key 'cas:sso-sessions-established:'" + today + " in Redis. Caught the following exception: ", e);
//         }
//     }
// }


// Path: src/test/java/net/unicon/cas/addons/config/CasNamespaceEventsRedisRecorderBeanDefinitionParserTests.java
import net.unicon.cas.addons.info.events.listeners.RedisStatsRecorderForServiceTicketValidatedEvents;
import net.unicon.cas.addons.info.events.listeners.RedisStatsRecorderForSsoSessionEstablishedEvents;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import static org.junit.Assert.assertTrue;

package net.unicon.cas.addons.config;



/**
 * @author Dmitriy Kopylenko
 * @author Unicon, inc.
 */
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration
public class CasNamespaceEventsRedisRecorderBeanDefinitionParserTests {

    @Autowired
    ApplicationContext applicationContext;

    @Test
    public void eventsRedisRecorderBeanDefinitionCorrectlyParsed() {
        assertTrue(applicationContext.getBeansOfType(RedisStatsRecorderForSsoSessionEstablishedEvents.class).size() == 1);
        assertTrue(applicationContext.getBeansOfType(RedisStatsRecorderForServiceTicketValidatedEvents.class).size() == 1);