Git Product home page Git Product logo

whiskey-directory's Introduction

Whiskey Directory

The goal of this application is to create a way for people in a city to add and talk about drinks they’ve had in the city.

Testing

Specs

BDD Specs are written with the help of the specs library available on Google Code. The specs are executed as JUnit tests during Maven’s test phase. This means the Maven build outputs information about tests run, passed and failed rather than information about what how the specs are defined. To see the specs executed as JUnit tests execute the `mvn clean test` command from the command prompt.

In order to run the specs as specs first execute `mvn package` which will build the war file and a directory with the war contents. Once the package is built run a command similar to:


	scala -cp target/whiskey-directory/WEB-INF/lib/*:target/classes/:target/test-classes/:$M2_REPOSITORY/org/specs/specs/1.4.3/specs-1.4.3.jar {SpecificationObject}
	

In the above command {SpecificationObject} is the full path of any object which extends org.specs.Specification, and $M2_REPOSITORY is an environment variable set to the root of the local Maven repository. On OSX $M2_REPOSITORY will probably be ~/.m2/repository but the tilde must be replaced with /Users/username.

With the above guidelines a full command may look like:


	scala -cp target/whiskey-directory/WEB-INF/lib/*:target/classes/:target/test-classes/:$M2_REPOSITORY/org/specs/specs/1.4.3/specs-1.4.3.jar com.whiskeydirectory.model.DrinkSpecs
	

Building – Ant

AppEngine jars

In order to make the datanucleus class enhancing work the jars of version 1.1.0 in the AppEngine SDK needed to be replaced with the same jars of version 1.1.2 available in datanucleus’ Maven2 repository. The jars are in {sdk.home}/lib/tools/orm/ and {sdk.home}/user/orm/. The only datanucleus jar which should not be replaced is datanucleus-appengine-1.0.0.final.jar.

WARNING: Performing this replacement however makes the data retrieval mechanisms of the AppEngine unusable. Hopefully there is another way to do this.

ant.properties

Ant’s build.xml file looks for an ant.properties file at the same level as build.xml (project root) and expects the following properties to be defined:

  • sdk.dir – location of the appengine sdk
  • scala.compile.jar – location of the Scala compile jar
  • scala.library.jar – location of the Scala library jar
  • scala.src – top level Scala source directory (.scala files)
  • scala.test – top level Scala test source directory (.scala files)
  • java.src – top level Java source directory (.java files)
  • java.test – top level Java test source directory (.java files)
  • resources.src – top level resource directory (get copied into build.dir)
  • webapp.src – top level webapp directory (files get copied into war.dir)
  • war.dir – top level packaging directory
  • test.jars – JUnit and Specs jars
  • test.dir – where to compile test source to (.class files)
  • build.dir – compile source files to here (.class files)
  • lib.dir – copy library files to here (.jar files)

The build.xml defines several targets, what they do is outlined below:

  • clean – no dependencies – delete the directory specified by war.dir property
  • init – no dependencies – creates the directory specified by war.dir and copies all files in webapp.src into it
  • copyjars – depends on init – copies jar files in sdk.dir/lib/user and scala.library.jar into lib.dir
  • compile – depends on copyjars – compiles scala and java src into build.dir and copies resources.src into build.dir
  • test-compile – depends on compile – compiles java.test and scala.test into test.dir
  • package – depends on compile – runs the enhance_war task defined in sdk.dir/config/user/ant-macros.xml
  • test – depends on test-compile – executes tests compiled in test-compile using JUnit
  • dev – no dependencies – starts the dev_appserver jetty server
  • install – depends on clean, package and test – pushes war to app engine servers

Building – Maven

AppEngine jars

In order to build an Java AppEngine project with Maven (2.0.10) first the jars from the SDK need to be installed in the local repository. To do this first navigate to where the Java AppEngine SDK are located and then run the following four commands.


	mvn install:install-file -Dfile=lib/user/orm/datanucleus-appengine-1.0.0.final.jar -DgroupId=org.datanucleus -DartifactId=datanucleus-appengine -Dversion=1.0.0.final -Dpackaging=jar -DgeneratePom=true
	mvn install:install-file -Dfile=lib/user/appengine-api-1.0-sdk-1.2.0.jar -DgroupId=com.google -DartifactId=appengine-api-1.0-sdk -Dversion=1.2.0 -Dpackaging=jar -DgeneratePom=true
	mvn install:install-file -Dfile=lib/shared/appengine-local-runtime-shared.jar -DgroupId=com.google -DartifactId=appengine-local-runtime-shared -Dversion=1.2.0 -Dpackaging=jar -DgeneratePom=true
	mvn install:install-file -Dfile=lib/appengine-tools-api.jar -DgroupId=com.google -DartifactId=appengine-tools -Dversion=1.2.0 -Dpackaging=jar -DgeneratePom=true
	

Scala jars

The Scala jars, including the specs library, should be located by Maven in the declared repositories in the pom.xml.

whiskey-directory's People

Contributors

bryanjswift avatar

Stargazers

Angus H. avatar  avatar

Watchers

 avatar James Cloos avatar  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.