Skip to content

Developing Collins

Bhaskar Maddala edited this page Sep 9, 2015 · 5 revisions

Requirements

Play is currently at version 2.3.9 requiring the following dependencies

"com.typesafe.play" %% "play-jdbc" % "2.3.9",
"com.typesafe.play" %% "play-cache" % "2.3.9",
"com.google.code.findbugs" % "jsr305" % "3.0.0"
ws

Connection pooling requires BoneCP

"com.jolbox" % "bonecp" % "0.8.0.RELEASE",

Guava library is used to implement in-memory model caching

"com.google.guava" % "guava" % "18.0",

Both H2 and MySQL databases are supported. H2 is used for unit and acceptance testing

"mysql" % "mysql-connector-java" % "5.1.35",
"com.h2database" % "h2" % "1.4.187",

Javascript and style artifacts rely on webjars. No custom styles are used within Colling

"org.webjars" % "bootstrap" % "3.3.4",
"org.webjars" % "bootstrap-datepicker" % "1.4.0",
"org.webjars" % "datatables" % "1.10.7",
"org.webjars" % "datatables-plugins" % "1.10.7",
"org.webjars" % "jquery" % "2.1.4",
"org.webjars" %% "webjars-play" % "2.3.0-3",

Solr is used for search in either embedded or external configuration

"org.apache.solr" % "solr-solrj" % "5.2.0",
"org.apache.solr" % "solr-core"  % "5.2.0",

Apache Http Components is used in multi-collins configuration and with the Softlayer plugin

"org.apache.httpcomponents" % "httpclient" % "4.5",
"org.apache.httpcomponents" % "httpmime" % "4.5",
"commons-net" % "commons-net" % "3.3",

Snakeyaml is used for parsing permissions.

"org.yaml" % "snakeyaml" % "1.15",

Squeryl is used for database access. Callbacks rely heavily on use of Squeryl

"org.squeryl" %% "squeryl" % "0.9.5-7",

Unit test are implemented in Specs2

"org.specs2" %% "specs2" % "2.3.13" % "test",

Encryption requires the use of Bouncy Castle

"org.bouncycastle" % "bcprov-jdk16" % "1.46",

Hazelcast is used in clustered mode for shared cache and to support the firehose

"com.hazelcast" % "hazelcast" % "3.5.1",

Reporting requires

"nl.grons" %% "metrics-scala" % "2.1.5",
"com.addthis.metrics" % "reporter-config" % "2.3.1",

The following dependencies, need to be verified

"org.jsoup" % "jsoup" % "1.8.2",
"com.gilt" %% "jerkson" % "0.6.6",

Coding

You can use any tool chain that you prefer for coding. However do not commit the toolchain artifacts into the repo.

Eclipse

You can generate eclipse project and workspace files in sbt/play-activator

➜  collins git:(bhaskar-moar-moar-tests) ~/Software/play-2.3.9/activator
[info] Loading global plugins from /Users/bhaskar/.sbt/0.13/plugins
[info] Loading project definition from /Users/bhaskar/workspace/collins/project
[info] Set current project to collins (in build file:/Users/bhaskar/workspace/collins/)
[collins] $ eclipse with-source=true with-javadoc=true

Collins is a combined Java and Play application and the eclipse command does not set up the source folders for Java files correctly. Ensure app/src/main/java is a source folder.

Building, Testing and Running

Use the sbt/play-activator console. Note: Some tests rely on the migrations script to set up their test data.

[collins] $ clean
[success] Total time: 1 s, completed Sep 9, 2015 12:25:31 PM
[collins] $ compile
[info] Updating {file:/Users/bhaskar/workspace/collins/}collins...
[info] Resolving jline#jline;2.12.1 ...
[info] Done updating.
[info] Compiling 323 Scala sources and 9 Java sources to /Users/bhaskar/workspace/collins/target/scala-2.11/classes...
[success] Total time: 70 s, completed Sep 9, 2015 12:26:42 PM
[collins] $ test
[info] Compiling 46 Scala sources to /Users/bhaskar/workspace/collins/target/scala-2.11/test-classes...
...
[info] Passed: Total 383, Failed 0, Errors 0, Passed 383
[success] Total time: 70 s, completed Sep 9, 2015 12:28:01 PM
[collins] $ run

--- (Running the application, auto-reloading is enabled) ---

[info] play - Listening for HTTP on /0:0:0:0:0:0:0:0:9000

(Server started, use Ctrl+D to stop and go back to the console...)

when executing run as above, Collins is launched in development mode. To populate some assets for testing make use of the populate script.

Following basic functionality must be verified for every change

  • Creating Assets (both via the populate script, which creates server node type asset, and configuration assets which can be created from the gui)
  • Intake
  • Provisioning
  • Deleting an asset
  • Setting of custom attributes
  • Querying assets by attribute

The last 2 of the tests must be done using the collins-client ruby gem

Verifying Docker

Most of the devs who work on Collins use OSx as their development platform. Docker isn't natively supported on osx, please refer to the docker documentation for your system. The docker container specification is in Dockerfile

docker-machine create collins --driver=virtualbox
docker-machine env collins
docker build .
➜  collins git:(bhaskar-moar-moar-tests) docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
<none>              <none>              87287108c131        36 minutes ago      1.319 GB
java                7                   ade42d38879d        2 weeks ago         587.4 MB

Note: the container run in production mode and not all the tests above can be accomplished. However please ensure you do the necessary verification.

Continous integration

Collins builds are registered on the docker registry and use the build infrastructure to generate containers on each commit to master

Clone this wiki locally