<commit_before># sparkIt
Simple Spark Java app with support for Selenium testing.

## Getting started

### Requirements
* Java JDK (openjdk-7-jdk recommended)

### Clone and run!
1. `git clone` this repo
2. `./gradlew run` in the repo's base folder
3. Check out a random joke on [localhost:4567](http://localhost:4567)
4. Check out a specific joke (number 5) on [localhost:4567/id/5](http://localhost:4567/id/5)

To run SparkApp on another port ID, export PORT environmental variable to a valid integer port and it will be used.

## Running tests

### Unit tests
1. `./gradlew test` - simple enough.

### Functional tests - Selenium

#### Requirements
1. For running locally on your Windows/MacOS/Linux computer, you'll need to install Firefox 28.0
    * Newer versions might work, but 28.0 will work, so ...
    * You can grab [Firefox 28.0 here](https://ftp.mozilla.org/pub/mozilla.org/firefox/releases/28.0/).
    * Friendly note: Make sure autoupdate is turned off.
    * For all systems you must expose Firefox in your path (how to do so depends on what OS you are running, so please Bing for answers).
2. For running on Servers (GreenQloud for example) where you do not have a GUI, you'll need to install X Virtual Frame Buffer (xvfb) and additional packages and Firefox 28.0.
    * `sudo apt-get install -y xvfb`
    * `sudo apt-get install -y xfonts-100dpi xfonts-75dpi xfonts-scalable xfonts-cyrillic`
    * `sudo apt-get install -y firefox=28.0+build2-0ubuntu2`

**Note** if installing firefox on the server doesn't work, you can do the following:

```sh
cd /tmp
wget https://ftp.mozilla.org/pub/mozilla.org/firefox/releases/28.0/linux-x86_64/en-US/firefox-28.0.tar.bz2
tar xvjf firefox-28.0.tar.bz2
sudo mv firefox/ /opt/firefox28
sudo ln -s /opt/firefox28/firefox /usr/bin/firefo
```

#### Run it!
1. Locally just do `./gradlew selenium`
2. Headless mode on servers:
    * `export DISPLAY=:99`
    * `./gradlew seleniumXvfb`

#### And what? ...<commit_msg>Add missing 'x' and port changing helper<commit_after># sparkIt
Simple Spark Java app with support for Selenium testing.

## Getting started

### Requirements
* Java JDK (openjdk-7-jdk recommended)

### Clone and run!
1. `git clone` this repo.
2. `./gradlew run` in the repo's base folder.
3. Check out a random joke on [localhost:4567](http://localhost:4567).
4. Check out a specific joke (number 5) on [localhost:4567/id/5](http://localhost:4567/id/5).

To run SparkApp on another port ID, export PORT environmental variable to a valid integer port and it will be used.

```sh
export PORT=1337
./gradlew run
```

## Running tests

### Unit tests
1. `./gradlew test` - simple enough.

### Functional tests - Selenium

#### Requirements
1. For running locally on your Windows/MacOS/Linux computer, you'll need to install Firefox 28.0
    * Newer versions might work, but 28.0 will work, so ...
    * You can grab [Firefox 28.0 here](https://ftp.mozilla.org/pub/mozilla.org/firefox/releases/28.0/).
    * Friendly note: Make sure autoupdate is turned off.
    * For all systems you must expose Firefox in your path (how to do so depends on what OS you are running, so please Bing for answers).
2. For running on Servers (GreenQloud for example) where you do not have a GUI, you'll need to install X Virtual Frame Buffer (xvfb) and additional packages and Firefox 28.0.
    * `sudo apt-get install -y xvfb`
    * `sudo apt-get install -y xfonts-100dpi xfonts-75dpi xfonts-scalable xfonts-cyrillic`
    * `sudo apt-get install -y firefox=28.0+build2-0ubuntu2`

**Note** if installing firefox on the server doesn't work, you can do the following:

```sh
cd /tmp
wget https://ftp.mozilla.org/pub/mozilla.org/firefox/releases/28.0/linux-x86_64/en-US/firefox-28.0.tar.bz2
tar xvjf firefox-28.0.tar.bz2
sudo mv firefox/ /opt/firefox28
sudo ln -s /opt/firefox28/firefox /usr/bin/firefox
```

#### Run it!
1. Locally just do `./gradlew selenium`
2. Headless mode on servers:
    * `export DISPLAY=:99`
    * `./gradlew seleniumXvfb`

#### And what? ...
{'fraction_non_alphanumeric': 0.11745635910224439, 'fraction_numerical': 0.03890274314214464, 'mean_word_length': 3.610344827586207, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, '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': '3326125', 'n_tokens_mistral': 1479, 'n_tokens_neox': 1297, 'n_words': 505}