<commit_before>/*
 * <p>Title: StripesUtils</p>
 * <p>Description: </p>
 * <p>Copyright: Copyright (c) 2007</p>
 * <p>Company: Institut de recherches cliniques de Montr&eacute;al (IRCM)</p>
 */
package org.stripesstuff.tests.session;

import java.util.HashMap;
import java.util.Map;

import org.stripesstuff.plugin.session.SessionStoreInterceptor;
import org.stripesstuff.tests.session.action.Child1PersonActionBean;
import org.stripesstuff.tests.session.action.Child2PersonActionBean;
import org.stripesstuff.tests.session.action.FirstKeyActionBean;
import org.stripesstuff.tests.session.action.ListActionBean;
import org.stripesstuff.tests.session.action.LongMaxTimeActionBean;
import org.stripesstuff.tests.session.action.MaxTimeActionBean;
import org.stripesstuff.tests.session.action.MockHttpSessionWithEvent;
import org.stripesstuff.tests.session.action.NegativeMaxTimeActionBean;
import org.stripesstuff.tests.session.action.NoNegativeActionBean;
import org.stripesstuff.tests.session.action.NoResolutionActionBean;
import org.stripesstuff.tests.session.action.NonSerializeActionBean;
import org.stripesstuff.tests.session.action.PersonActionBean;
import org.stripesstuff.tests.session.action.PrimitiveActionBean;
import org.stripesstuff.tests.session.action.SecondKeyActionBean;
import org.stripesstuff.tests.session.action.SerializeActionBean;
import org.stripesstuff.tests.session.action.SessionActionBean;
import org.stripesstuff.tests.session.action.ZeroMaxTimeActionBean;
import org.stripesstuff.tests.session.bean.Person;
import org.testng.Assert;
import org.testng.annotations.AfterGroups;
import org.testng.annotations.BeforeGroups;
import org.testng.annotations.Test;

import net.sourceforge.stripes.controller.DispatcherServlet;
import net.sourceforge.stripes.controller.StripesFilter;
import net.sourceforge.stripes.mock.MockRoundtrip;
import net.sourceforge.stripes.mock.MockServletContext;

/**
 * Test session interceptor.
 * 
 * @author <NAME>
 */
public class SessionTest {
    
    MockServletContext context;
    
    @BeforeGroups("session")
    public void setupContext() {
        context = new MockServletContext("test");
        
        // Add the Stripes Filter
        Map<String,String> filterParams = new HashMap<String,String>();
        filterParams.put("Interceptor.Classes",
                "org.stripesstuff.plugin.session.SessionStoreInterceptor");
        filterParams.put("ActionResolver.Packages",
                "org.stripesstuff.tests.session");
        context.addFilter(StripesFilter.class, "StripesFilter", filterParams);
        
        // Add the Stripes Dispatcher
        context.setServlet(DispatcherServlet.class, "StripesDispatcher", null);
    }
    @AfterGroups("session")
    public void releaseContext() {
        context = null;
    }
    
    
    /**<commit_msg>Session tests should run in session servlet context.<commit_after>/*
 * <p>Title: StripesUtils</p>
 * <p>Description: </p>
 * <p>Copyright: Copyright (c) 2007</p>
 * <p>Company: Institut de recherches cliniques de Montr&eacute;al (IRCM)</p>
 */
package org.stripesstuff.tests.session;

import java.util.HashMap;
import java.util.Map;

import org.stripesstuff.plugin.session.SessionStoreInterceptor;
import org.stripesstuff.tests.session.action.Child1PersonActionBean;
import org.stripesstuff.tests.session.action.Child2PersonActionBean;
import org.stripesstuff.tests.session.action.FirstKeyActionBean;
import org.stripesstuff.tests.session.action.ListActionBean;
import org.stripesstuff.tests.session.action.LongMaxTimeActionBean;
import org.stripesstuff.tests.session.action.MaxTimeActionBean;
import org.stripesstuff.tests.session.action.MockHttpSessionWithEvent;
import org.stripesstuff.tests.session.action.NegativeMaxTimeActionBean;
import org.stripesstuff.tests.session.action.NoNegativeActionBean;
import org.stripesstuff.tests.session.action.NoResolutionActionBean;
import org.stripesstuff.tests.session.action.NonSerializeActionBean;
import org.stripesstuff.tests.session.action.PersonActionBean;
import org.stripesstuff.tests.session.action.PrimitiveActionBean;
import org.stripesstuff.tests.session.action.SecondKeyActionBean;
import org.stripesstuff.tests.session.action.SerializeActionBean;
import org.stripesstuff.tests.session.action.SessionActionBean;
import org.stripesstuff.tests.session.action.ZeroMaxTimeActionBean;
import org.stripesstuff.tests.session.bean.Person;
import org.testng.Assert;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

import net.sourceforge.stripes.controller.DispatcherServlet;
import net.sourceforge.stripes.controller.StripesFilter;
import net.sourceforge.stripes.mock.MockRoundtrip;
import net.sourceforge.stripes.mock.MockServletContext;

/**
 * Test session interceptor.
 * 
 * @author <NAME>
 */
public class SessionTest {
    
    MockServletContext context;
    
    @BeforeClass
    public void setupContext() {
        context = new MockServletContext("session");
        
        // Add the Stripes Filter
        Map<String,String> filterParams = new HashMap<String,String>();
        filterParams.put("Interceptor.Classes",
                "org.stripesstuff.plugin.session.SessionStoreInterceptor");
        filterParams.put("ActionResolver.Packages",
                "org.stripesstuff.tests.session");
        context.addFilter(StripesFilter.class, "StripesFilter", filterParams);
        
        // Add the Stripes Dispatcher
        context.setServlet(DispatcherServlet.class, "StripesDispatcher", null);
    }
    @AfterClass
    public void releaseContext() {
        context = null;
    }
    
    
    /**
{'fraction_non_alphanumeric': 0.10490126939351199, 'fraction_numerical': 0.0021156558533145277, 'mean_word_length': 4.771108850457782, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6717631', 'n_tokens_mistral': 1713, 'n_tokens_neox': 1636, 'n_words': 251}