Skip to content

Setting up the development environment

uekerman edited this page Feb 3, 2013 · 6 revisions

Prerequisites

You need the following tools:

  • a JDK
    
  • Eclipse
    
  • The Eclipse EGit plugin (available in Eclipse under Install software / Collaboration / Eclipse EGit)
    
  • m2e Eclipse plugin (Maven)
    
  • the Android SDK
    

Get the code

You have to clone 5 different repositories and create the corresponding Eclipse projects. All repositories are available on Github.

  • [bladenight/bladenightapp-common](https://github.com/bladenight/bladenightapp-common) : code shared between the client and the server
    
  • [bladenight/bladenightapp-android](https://github.com/bladenight/bladenightapp-android) : the Android client
    
  • [bladenight/bladenightapp-server](https://github.com/bladenight/bladenightapp-server) : the server, in Java
    
  • [bladenight/bladenightapp-replay](https://github.com/bladenight/bladenightapp-replay) : client capable of simulating several clients and replaying an entire bladenight from the log files of the last season (2012)
    
  • [ocroquette/wampoc](https://github.com/ocroquette/wampoc) : a Java library implementing the [WAMP protocol](http://wamp.ws/).
    

For each of them, follow these steps:

  • File / Import
    
  • Projects from Git
    
  • Select “URI”
    
  • Enter the following URI: ssh://github/<repository> (or https://... for anonymous access)
    
  • Finish with defaults
    

Note that due to the way EGit works, the source files may not be physically in your workspace (here they are in ~/git/).

Building

You should get a clean build in Eclipse for all projects "out of the box".

You can run the JUnit tests for bladenightapp-common:

  • Right click on the project
    
  • Run As
    
  • JUnit Test
    

Starting the server

  • Right click on bladenightapp-server / Run As / Java application
  • Select "App.java" as the main class
  • It will start and report an error (“please provide the path of the configuration file as Java system property (-Dbnserver.configuration=/path/...)”)

You have therefore to create your own configuration files. Go to the following directory:

bladenightapp-server/config/users/

and copy one of the existing directory for your own usage. You can modify the files in your own directory as required.

Then:

  • Edit the Run Configuration
  • Add the following VM argument (not program argument !) : -Dbnserver.configuration=config/users/<your login>/bnserver.properties
  • Start again. The server should be up and running

Open your browser, and open the following URL : http://localhost:8081/map.html

You should see a Google Map with the route displayed in magenta.

Starting the Android client

  • Right click on bladenightapp-android
    
  • Run as / Android Application
    

If your phone is connected via USB and recognized, the application will start on your phone. Otherwise it will start in the emulator.

Starting the replay client

The replay client is able to replay a full bladenight. For that, it reads the log files produced during the last season, and simulates the different clients it finds. For each of them, it creates a new connection to the server, and sends the coordinates as found in the log entries.

If you want to replay the last bladenight of the last season, call it with the following arguments:

--file bladenight-log-2012.log --fromtime "2012-09-10T21:05" --totime "2012-09-10T23:15" --timelapse 10

The last argument is the accelerator factor, because you probably don't want to wait 1h to see the participants reaching the finish line :)