A Vert.x busmod for mocking out the mongo-persistor using fongo
JavaScript Groovy Shell CoffeeScript
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
buildSrc/src/main/groovy/co/freeside/gradle
examples/webapp
gradle/wrapper
lib
src
.gitignore
LICENSE
build.gradle
gradlew
gradlew.bat
readme.md

readme.md

This is a Vert.x busmod providing a Fongo database. The primary intention is for replacing a real Mongo persistor busmod on the event bus in Java or Groovy unit tests. However, it is also possible to deploy as in a Vert.x container just like any other busmod.

Installing

  • Clone this repository.
  • Ensure that you have the environment variable VERTX_MODS set to the directory where you want mods to be installed.
  • Use ./gradlew install to install the busmod.

Using embedded

You can use the Fongo Persistor as an event bus handler when using embedded vert.x in your tests (see Testing With Embedded Vert.x).

JUnit

private Vertx vertx = Vertx.newVertx();
FongoPersistor persistor = new FongoPersistor();

@Before void startFongo() {
	persistor.setVertx(vertx);
	persistor.start();
}

@After void stopFongo() {
	persistor.stop();
}

Spock

@Shared Vertx vertx = Vertx.newVertx()
def persistor = new FongoPersistor()

void setup() {
	persistor.vertx = vertx.toJavaVertx()
	persistor.start()
}

void cleanup() {
	persistor.stop()
}

Using as a busmod

The Fongo Persistor needs to be installed in VERTX_MODS then you can simply register it as you would any other busmod using deployVerticle('fongo-persistor')

## Example app

There is an example app in examples/webapp. This is simply the standard Vert.x webapp example but using a fongo-persistor instead of a mongo-persistor.

To run the example ensure that you have the VERTX_MODS environment variable set, then:

./gradlew install
cd examples/web-app
vertx run App.groovy

then point your browser at https://localhost:8080/index.html