tree: b2fef22c80c1fed60d1c9142f1d5d7f3ae283156 [path history] [tgz]
  1. src/
  2. pom.xml
  3. README.md
itests/README.md

Apache Unomi Integration tests

Information

You will likely run into situation where you need to wait for the execution of your test.
To do so please avoid long Thread.sleep(10000) it tend to make the test unstable, prefer a shorter sleep that you will repeat.
e.g:

boolean isDone = false;
while (!isDone) {
    importConfiguration = importConfigurationService.load(itemId);
    if (importConfiguration != null && importConfiguration.getStatus() != null) {
        isDone = importConfiguration.getStatus().equals(RouterConstants.CONFIG_STATUS_COMPLETE_SUCCESS);
    }
    Thread.sleep(1000);
}

NEVER create dependencies between your test, even in the same class, the execution order is not guaranteed therefore you may not have what you expect and it could work fine on your machine but not on others.

If possible clean what your test created at the end of its execution or at the very least make sure to use unique IDs

When you need a service from Unomi to execute your test inject it with a filer:

@Inject @Filter(timeout = 60000)
protected ProfileService profileService;

This will ensure the service is available before starting the test and if you need a resource like an URL you can do something like this:

@Inject @Filter(value="(configDiscriminator=IMPORT)", timeout = 60000)
protected ImportExportConfigurationService<ImportConfiguration> importConfigurationService;