<commit_before>package org.torquebox.integration.arquillian;

import static org.junit.Assert.*;

import org.jboss.arquillian.api.Deployment;
import org.jboss.arquillian.api.Run;
import org.jboss.arquillian.api.RunModeType;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.junit.Test;
import org.openqa.selenium.Cookie;
import org.openqa.selenium.WebDriver.Options;
import org.openqa.selenium.WebElement;

@Run(RunModeType.AS_CLIENT)
public class SessionRails2Test extends AbstractIntegrationTest {

    @Deployment
    public static JavaArchive createDeployment() {
        return createDeployment("rails/2.3.8/basic-rails.yml");
    }

    @Test
    public void testHighLevel() {
        Options options = driver.manage();
        WebElement element = null;

        String cookieValue = null;

        driver.get("http://localhost:8080/basic-rails/sessioning/get_value");
        assertEquals(1, options.getCookies().size());
        assertNotNull(options.getCookieNamed("JSESSIONID"));
        cookieValue = options.getCookieNamed("JSESSIONID").getValue();

        assertNotNull(cookieValue);

        element = driver.findElementById("success");
        assertNotNull(element);
        assertEquals("", element.getText().trim());

        driver.get("http://localhost:8080/basic-rails/sessioning/set_value");
        assertEquals(1, options.getCookies().size());
        assertEquals(cookieValue, options.getCookieNamed("JSESSIONID").getValue());

        element = driver.findElementById("success");
        assertNotNull(element);
        assertEquals("the value", element.getText().trim());

        driver.get("http://localhost:8080/basic-rails/sessioning/get_value");
        assertEquals(1, options.getCookies().size());
        assertEquals(cookieValue, options.getCookieNamed("JSESSIONID").getValue());

        element = driver.findElementById("success");
        assertNotNull(element);
        assertEquals("the value", element.getText().trim());

        driver.get("http://localhost:8080/basic-rails/sessioning/clear_value");
        assertEquals(1, options.getCookies().size());
        assertEquals(cookieValue, options.getCookieNamed("JSESSIONID").getValue());

        element = driver.findElementById("success");
        assertNotNull(element);
        assertEquals("", element.getText().trim());

        driver.get("http://localhost:8080/basic-rails/sessioning/get_value");
        assertEquals(1, options.getCookies().size());
        assertEquals(cookieValue, options.getCookieNamed("JSESSIONID").getValue());

        element = driver.findElementById("success");
        assertNotNull(element);
        assertEquals("", element.getText().trim());
    }

    @Test
    @Ignore
    public void testResetSession() {
        WebElement element = null;

        // should have no value to begin with
        driver.get("http://localhost:8080/basic-rails/sessioning/get_value");
        element = driver.findElementById("success");
        assertNotNull(element);
        assertEquals("", element.getText().trim());

        // set a value in the session
        driver.get("http://localhost:8080/basic-rails/sessioning/set_value");
        element = driver.findElementById("success");
        assertNotNull(element);
        assertEquals("the value", element.getText().trim());

        // get value from session
        driver.get("http://localhost:8080/basic-rails/sessioning/get_value");
        element = driver.findElementById("success");
        assertNotNull(element);
        assertEquals("the value", element.getText().trim());

        // logout to reset the session
        driver.get("http://localhost:8080/basic-rails/sessioning/logout");

        // should have no value after resetting session
        driver.get("http://localhost:8080/basic-rails/sessioning/get_value");
        element = driver.findElementById("success");
        assertNotNull(element);
        assertEquals("", element.getText().trim());
    }

    @Test
    public void testSessionViaMatrixUrl() {

        WebElement element = null;
        Options options = driver.manage();

        // should have no value to begin with
        driver.get("http://localhost:8080/basic-rails/sessioning/get_value");
        element = driver.findElementById("success");
        assertNotNull(element);
        assertEquals("", element.getText().trim());

        // set a value in the session
        driver.get("http://localhost:8080/basic-rails/sessioning/set_value");
        element = driver.findElementById("success");
        assertNotNull(element);
        assertEquals("the value", element.getText().trim());

        // get value from session
        driver.get("http://localhost:8080/basic-rails/sessioning/get_value");
        element = driver.findElementById("success");
        assertNotNull(element);
        assertEquals("the value", element.getText().trim());

        String cookieValue = options.getCookieNamed("JSESSIONID").getValue();

        assertNotNull(cookieValue);
        assertFalse("".equals(cookieValue));

        options.deleteAllCookies();

        driver.get("http://localhost:8080/basic-rails/sessioning/get_value;jsessionid=" + cookieValue);
        element = driver.findElementById("success");
        assertNotNull(element);
        assertEquals("the value", element.getText().trim());

        element = driver.findElementById("session_id");
        assertNotNull(element);
        assertEquals(cookieValue, element.getText().trim());

        assertEquals(0, options.getCookies().size());
    }

}
<commit_msg>Gah, import @Ignore so it actually compiles.  My Bad!<commit_after>package org.torquebox.integration.arquillian;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;

import org.jboss.arquillian.api.Deployment;
import org.jboss.arquillian.api.Run;
import org.jboss.arquillian.api.RunModeType;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.junit.Ignore;
import org.junit.Test;
import org.openqa.selenium.WebDriver.Options;
import org.openqa.selenium.WebElement;

@Run(RunModeType.AS_CLIENT)
public class SessionRails2Test extends AbstractIntegrationTest {

    @Deployment
    public static JavaArchive createDeployment() {
        return createDeployment("rails/2.3.8/basic-rails.yml");
    }

    @Test
    public void testHighLevel() {
        Options options = driver.manage();
        WebElement element = null;

        String cookieValue = null;

        driver.get("http://localhost:8080/basic-rails/sessioning/get_value");
        assertEquals(1, options.getCookies().size());
        assertNotNull(options.getCookieNamed("JSESSIONID"));
        cookieValue = options.getCookieNamed("JSESSIONID").getValue();

        assertNotNull(cookieValue);

        element = driver.findElementById("success");
        assertNotNull(element);
        assertEquals("", element.getText().trim());

        driver.get("http://localhost:8080/basic-rails/sessioning/set_value");
        assertEquals(1, options.getCookies().size());
        assertEquals(cookieValue, options.getCookieNamed("JSESSIONID").getValue());

        element = driver.findElementById("success");
        assertNotNull(element);
        assertEquals("the value", element.getText().trim());

        driver.get("http://localhost:8080/basic-rails/sessioning/get_value");
        assertEquals(1, options.getCookies().size());
        assertEquals(cookieValue, options.getCookieNamed("JSESSIONID").getValue());

        element = driver.findElementById("success");
        assertNotNull(element);
        assertEquals("the value", element.getText().trim());

        driver.get("http://localhost:8080/basic-rails/sessioning/clear_value");
        assertEquals(1, options.getCookies().size());
        assertEquals(cookieValue, options.getCookieNamed("JSESSIONID").getValue());

        element = driver.findElementById("success");
        assertNotNull(element);
        assertEquals("", element.getText().trim());

        driver.get("http://localhost:8080/basic-rails/sessioning/get_value");
        assertEquals(1, options.getCookies().size());
        assertEquals(cookieValue, options.getCookieNamed("JSESSIONID").getValue());

        element = driver.findElementById("success");
        assertNotNull(element);
        assertEquals("", element.getText().trim());
    }

    @Test
    @Ignore
    public void testResetSession() {
        WebElement element = null;

        // should have no value to begin with
        driver.get("http://localhost:8080/basic-rails/sessioning/get_value");
        element = driver.findElementById("success");
        assertNotNull(element);
        assertEquals("", element.getText().trim());

        // set a value in the session
        driver.get("http://localhost:8080/basic-rails/sessioning/set_value");
        element = driver.findElementById("success");
        assertNotNull(element);
        assertEquals("the value", element.getText().trim());

        // get value from session
        driver.get("http://localhost:8080/basic-rails/sessioning/get_value");
        element = driver.findElementById("success");
        assertNotNull(element);
        assertEquals("the value", element.getText().trim());

        // logout to reset the session
        driver.get("http://localhost:8080/basic-rails/sessioning/logout");

        // should have no value after resetting session
        driver.get("http://localhost:8080/basic-rails/sessioning/get_value");
        element = driver.findElementById("success");
        assertNotNull(element);
        assertEquals("", element.getText().trim());
    }

    @Test
    public void testSessionViaMatrixUrl() {

        WebElement element = null;
        Options options = driver.manage();

        // should have no value to begin with
        driver.get("http://localhost:8080/basic-rails/sessioning/get_value");
        element = driver.findElementById("success");
        assertNotNull(element);
        assertEquals("", element.getText().trim());

        // set a value in the session
        driver.get("http://localhost:8080/basic-rails/sessioning/set_value");
        element = driver.findElementById("success");
        assertNotNull(element);
        assertEquals("the value", element.getText().trim());

        // get value from session
        driver.get("http://localhost:8080/basic-rails/sessioning/get_value");
        element = driver.findElementById("success");
        assertNotNull(element);
        assertEquals("the value", element.getText().trim());

        String cookieValue = options.getCookieNamed("JSESSIONID").getValue();

        assertNotNull(cookieValue);
        assertFalse("".equals(cookieValue));

        options.deleteAllCookies();

        driver.get("http://localhost:8080/basic-rails/sessioning/get_value;jsessionid=" + cookieValue);
        element = driver.findElementById("success");
        assertNotNull(element);
        assertEquals("the value", element.getText().trim());

        element = driver.findElementById("session_id");
        assertNotNull(element);
        assertEquals(cookieValue, element.getText().trim());

        assertEquals(0, options.getCookies().size());
    }

}

{'fraction_non_alphanumeric': 0.1395927802969681, 'fraction_numerical': 0.01173646305681515, 'mean_word_length': 3.316193399846508, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4377938', 'n_tokens_mistral': 3067, 'n_tokens_neox': 2853, 'n_words': 480}