Search in sources :

Example 6 with AlreadyExistsException

use of com.b2international.commons.exceptions.AlreadyExistsException in project snow-owl by b2ihealthcare.

the class SnowOwlAppRule method before.

@Override
protected void before() throws Throwable {
    super.before();
    snowowl = SnowOwl.create(this.plugins);
    if (clearResources) {
        final File resourceDirectory = snowowl.getEnviroment().getDataPath().toFile();
        FileUtils.cleanDirectory(resourceDirectory);
    }
    snowowl.bootstrap();
    snowowl.run();
    // inject the test user to the current identity provider
    try {
        ((IdentityWriter) ApplicationContext.getInstance().getServiceChecked(IdentityProvider.class)).addUser(RestExtensions.USER, RestExtensions.PASS);
    } catch (AlreadyExistsException e) {
    // ignore existing user
    }
}
Also used : AlreadyExistsException(com.b2international.commons.exceptions.AlreadyExistsException) IdentityWriter(com.b2international.snowowl.core.identity.IdentityWriter) IdentityProvider(com.b2international.snowowl.core.identity.IdentityProvider) File(java.io.File)

Aggregations

AlreadyExistsException (com.b2international.commons.exceptions.AlreadyExistsException)6 BadRequestException (com.b2international.commons.exceptions.BadRequestException)3 SnowowlRuntimeException (com.b2international.snowowl.core.api.SnowowlRuntimeException)2 Request (com.b2international.snowowl.core.events.Request)2 SnomedIdentifiers (com.b2international.snowowl.snomed.cis.SnomedIdentifiers)2 CompareUtils (com.b2international.commons.CompareUtils)1 NotFoundException (com.b2international.commons.exceptions.NotFoundException)1 NotImplementedException (com.b2international.commons.exceptions.NotImplementedException)1 Query (com.b2international.index.query.Query)1 BaseRevisionBranching (com.b2international.index.revision.BaseRevisionBranching)1 RevisionBranch (com.b2international.index.revision.RevisionBranch)1 RevisionSearcher (com.b2international.index.revision.RevisionSearcher)1 RevisionSegment (com.b2international.index.revision.RevisionSegment)1 ApplicationContext (com.b2international.snowowl.core.ApplicationContext)1 RepositoryManager (com.b2international.snowowl.core.RepositoryManager)1 ServiceProvider (com.b2international.snowowl.core.ServiceProvider)1 Branch (com.b2international.snowowl.core.branch.Branch)1 BranchPathUtils (com.b2international.snowowl.core.branch.BranchPathUtils)1 Branching (com.b2international.snowowl.core.branch.Branching)1 Merging (com.b2international.snowowl.core.branch.Merging)1