Coder Social home page Coder Social logo

sparkit's Introduction

sparkIt

Simple Spark Java app with support for Selenium testing. The App serves Chuck Norris jokes in a Web application.

Runs on (tested on):

  • ✓ Windows (8.1, x86)
  • ✓ Mac OS (Mavericks)
  • ✓ Linux (Ubuntu 14.04 and Ubuntu Server 12.04)

Screenshots

index.html specific.html
random specific

Getting started

Requirements

  • Java JDK (openjdk-7-jdk recommended) installed and accessible in the PATH

Clone and run!

  1. git clone this repo.
  2. ./gradlew run in the repo's base folder (gradlew run on Windows).
  3. Check out a random joke on localhost:4567.
  4. Check out a specific joke (number 5) on localhost:4567/id/5.

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

export PORT=1337
./gradlew run

Running tests

Unit tests

  1. ./gradlew test - simple enough. Or ./gradlew check. On Windows gradlew check works well.

Functional tests - Selenium

Requirements

  1. For running locally on your MacOS/Linux/Windows 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.
    • 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
  3. For running on Windows:
    • Java JDK 7 in your Path (Example C:\Program Files\Java\openjdk-7.0.71\bin)
    • Firefox 28.0 needs to be accesible from the Command Line

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

sudo apt-get purge firefox
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 or gradlew selenium on Windows.
  2. Headless mode on servers:
    • ./gradlew seleniumXvfb
    • Stop Java processes after run: sudo killall -9 java

And what? ...

Gradle creates test reports for us. Look at the build/reports folder for more sweet Gradle juice.

sparkit's People

Contributors

arnlaugsson avatar eggertj12 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.