A domain service for Apache Isis which generates random fake data for use in unit and integration tests.
Java HTML Clean Shell Other
Fetching latest commit…
Cannot retrieve the latest commit at this time.



Build Status

This module, intended for use with Apache Isis, provides a domain service that generates fake random data. The random values generated can then be used within unit and integration tests.

The module consists of a single domain service FakeDataDomainService. This can be injected into fixtures and integration tests just like any other domain service.

In addition, this module also acts as a useful regression suite for DataNucleus' persistence of value types (including our custom mappings of Isis' own value types).


The example app consists of a single domain entity that has a property for each of the value types supported by Isis.

Installing the fixture scenario:

will return an example demo object:

Fixtures and Integration Tests

Probably of more interest are the fixtures and integration tests that actually use the FakeDataService.

For example the FakeDataDemoObjectUpdate fixture script will update a demo object using the provided values (set as properties of the fixture script itself). However, if no value has been set by the calling test, then a random value, obtained from FakeDataService, will be used instead:

public class FakeDataDemoObjectUpdate extends DiscoverableFixtureScript {

    private FakeDataDemoObject fakeDataDemoObject; 
    public FakeDataDemoObject getFakeDataDemoObject() { ... }
    public void setFakeDataDemoObject(final FakeDataDemoObject fakeDataDemoObject) { ... }

    private Boolean someBoolean;
    public Boolean getSomeBoolean() { ... }
    public void setSomeBoolean(final Boolean someBoolean) { ... }

    private Character someChar;
    public Character getSomeChar() { ... }
    public void setSomeChar(final Character someChar) { ... }

    private Byte someByte;
    public Byte getSomeByte() { ... }
    public void setSomeByte(final Byte someByte) { ... }

    protected void execute(final ExecutionContext executionContext) {

        this.defaultParam("someBoolean", executionContext, fakeDataService.booleans().any());
        this.defaultParam("someChar", executionContext, fakeDataService.chars().any());
        this.defaultParam("someByte", executionContext, fakeDataService.bytes().any());

        // updates
        final FakeDataDemoObject fakeDataDemoObject = getFakeDataDemoObject();


    private FakeDataService fakeDataService;

The FakeDataService can also be used within integration tests. For example, in FakeDataDemoObjectsTest a fake value is used to obtain a blob for update:

    public void when_blob() throws Exception {

        // given

        final Blob theBlob = fakeDataService.isisBlobs().anyPdf();

        // when

        fixtureScripts.runFixtureScript(updateScript, null);


        // then
        fakeDataDemoObject = wrap(fakeDataDemoObjects).listAll().get(0);


Note the use of FakeDataService in the "given" to obtain a PDF blob.

How to run the Demo App

The prerequisite software is:

  • Java JDK 8 (>= 1.9.0) or Java JDK 7 (<= 1.8.0) ** note that the compile source and target remains at JDK 7
  • maven 3 (3.2.x is recommended).

To build the demo app:

git clone https://github.com/isisaddons/isis-module-fakedata.git
mvn clean install

To run the demo app:

mvn antrun:run -P self-host

Then log on using user: sven, password: pass

How to configure/use

You can either use this module "out-of-the-box", or you can fork this repo and extend to your own requirements.


To use "out-of-the-box":

  • update your classpath by adding this dependency in your project's dom module's pom.xml:

NB: not yet released, use -SNAPSHOT (below)

  • if using AppManifest, then update its getModules() method:

    @Override public List> getModules() { return Arrays.asList( ... org.isisaddons.module.fakedata.FakeDataModule.class, ... ); }

  • otherwise, update your WEB-INF/isis.properties:



"Out-of-the-box" (-SNAPSHOT)

If you want to use the current -SNAPSHOT, then the steps are the same as above, except:

  • when updating the classpath, specify the appropriate -SNAPSHOT version:
  • add the repository definition to pick up the most recent snapshot (we use the Cloudbees continuous integration service). We suggest defining the repository in a <profile>:

Forking the repo

If instead you want to extend this module's functionality, then we recommend that you fork this repo. The repo is structured as follows:

  • pom.xml - parent pom
  • dom - the module implementation, depends on Isis applib
  • fixture - fixtures, holding a sample domain objects and fixture scripts; depends on dom
  • integtests - integration tests for the module; depends on fixture
  • webapp - demo webapp (see above screenshots); depends on dom and fixture

Only the dom project is released to Maven Central Repo. The versions of the other modules are purposely left at 0.0.1-SNAPSHOT because they are not intended to be released.

API and Implementation

The FakeDataService defines the following API:

public interface FakeDataService {

    public Names name() { ... }
    public Comms comms() { ... }
    public Lorem lorem() { ... }
    public Addresses addresses() { ... }
    public CreditCards creditCard() { ... }
    public Books books() { ... }

    public Bytes bytes() { ... }
    public Shorts shorts() { ... }
    public Integers ints() { ... }
    public Longs longs() { ... }
    public Floats floats() { ... }
    public Doubles doubles() { ... }
    public Chars chars() { ... }
    public Booleans booleans() { ... }

    public Strings strings() { ... }

    public Collections collections() { ... }
    public Enums enums() { ... }

    public JavaUtilDates javaUtilDates() { ... }
    public JavaSqlDates javaSqlDates() { ... }
    public JavaSqlTimestamps javaSqlTimestamps() { ... }
    public JodaLocalDates jodaLocalDates() { ... }
    public JodaDateTimes jodaDateTimes() { ... }
    public JodaPeriods jodaPeriods() { ... }

    public BigDecimals bigDecimals() { ... }
    public BigIntegers bigIntegers() { ... }

    public Urls urls() { ... }
    public Uuids uuids() { ... }

    public IsisPasswords isisPasswords() { ... }
    public IsisMoneys isisMoneys() { ... }
    public IsisBlobs isisBlobs() { ... }
    public IsisClobs isisClobs() { ... }


where each of the returned classes then provides suitable methods for obtaining values within that domain of values.

For example, Names provides:

public class Names ... {
    public String fullName() { ... }
    public String firstName() { ... }
    public String lastName() { ... }
    public String prefix() { ... }
    public String suffix() { ... }

and IsisBlobs provides:

public class IsisBlobs ... {
    public Blob any() { ... }
    public Blob anyJpg() { ... }
    public Blob anyPdf() { ... }

and Collections API includes:

public class Collections ... {
    public <T> T anyOf(final Collection<T> collection) { ... }
    public <T> T anyOfExcept(final Collection<T> collection, final Predicate<T> except) { ... }
    public <T> T anyOf(final T... elements) { ... }
    public <T> T anyOfExcept(final T[] elements, final Predicate<T> except) { ... }
    public <E extends Enum<E>> E anyEnum(final Class<E> enumType) { ... }
    public <E extends Enum<E>> E anyEnumExcept(final Class<E> enumType, final Predicate<E> except) { ... }
    public <T> T anyBounded(final Class<T> cls) { ... }
    public <T> T anyBoundedExcept(final Class<T> cls, final Predicate<T> except) { ... }

with similar methods for all the primitives

Known issues

None currently.

Change Log

  • 1.13.0 - released against Isis 1.13.0
  • 1.12.0 - released against Isis 1.12.0
  • 1.11.0 - released against Isis 1.11.0
  • 1.10.0 - released against Isis 1.10.0
  • 1.9.0 - released against Isis 1.9.0

Legal Stuff


Copyright 2014-20116 Dan Haywood

Licensed under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License at


Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.


There are no third-party dependencies.

Maven deploy notes

Only the dom module is deployed, and is done so using Sonatype's OSS support (see user guide).

Release to Sonatype's Snapshot Repo

To deploy a snapshot, use:

pushd dom
mvn clean deploy

The artifacts should be available in Sonatype's Snapshot Repo.

Release an Interim Build

If you have commit access to this project (or a fork of your own) then you can create interim releases using the interim-release.sh script.

The idea is that this will - in a new branch - update the dom/pom.xml with a timestamped version (eg It then pushes the branch (and a tag) to the specified remote.

A CI server such as Jenkins can monitor the branches matching the wildcard origin/interim/* and create a build. These artifacts can then be published to a snapshot repository.

For example:

sh interim-release.sh 1.14.0 origin


  • 1.14.0 is the base release
  • origin is the name of the remote to which you have permissions to write to.

Release to Maven Central

The release.sh script automates the release process. It performs the following:

  • performs a sanity check (mvn clean install -o) that everything builds ok
  • bumps the pom.xml to a specified release version, and tag
  • performs a double check (mvn clean install -o) that everything still builds ok
  • releases the code using mvn clean deploy
  • bumps the pom.xml to a specified release version

For example:

sh release.sh 1.13.0 \
              1.14.0-SNAPSHOT \
              dan@haywood-associates.co.uk \
              "this is not really my passphrase"


  • $1 is the release version
  • $2 is the snapshot version
  • $3 is the email of the secret key (~/.gnupg/secring.gpg) to use for signing
  • $4 is the corresponding passphrase for that secret key.

Other ways of specifying the key and passphrase are available, see the pgp-maven-plugin's documentation).

If the script completes successfully, then push changes:

git push origin master
git push origin 1.13.0

If the script fails to complete, then identify the cause, perform a git reset --hard to start over and fix the issue before trying again. Note that in the dom's pom.xml the nexus-staging-maven-plugin has the autoReleaseAfterClose setting set to true (to automatically stage, close and the release the repo). You may want to set this to false if debugging an issue.

According to Sonatype's guide, it takes about 10 minutes to sync, but up to 2 hours to update search.