Search in sources :

Example 1 with ProcessInstanceDuplicatedException

use of org.kie.kogito.process.ProcessInstanceDuplicatedException in project kogito-runtimes by kiegroup.

the class FileSystemProcessInstances method create.

@SuppressWarnings("unchecked")
@Override
public void create(String id, ProcessInstance instance) {
    if (isActive(instance)) {
        Path processInstanceStorage = Paths.get(storage.toString(), id);
        if (Files.exists(processInstanceStorage)) {
            throw new ProcessInstanceDuplicatedException(id);
        }
        storeProcessInstance(processInstanceStorage, instance);
    }
}
Also used : Path(java.nio.file.Path) ProcessInstanceDuplicatedException(org.kie.kogito.process.ProcessInstanceDuplicatedException)

Example 2 with ProcessInstanceDuplicatedException

use of org.kie.kogito.process.ProcessInstanceDuplicatedException in project kogito-runtimes by kiegroup.

the class BaseExceptionHandlerTest method testMapProcessInstanceDuplicatedException.

@Test
void testMapProcessInstanceDuplicatedException() {
    Object response = tested.mapException(new ProcessInstanceDuplicatedException("processInstanceId"));
    assertThat(response).isEqualTo(conflictResponse);
}
Also used : ProcessInstanceDuplicatedException(org.kie.kogito.process.ProcessInstanceDuplicatedException) Test(org.junit.jupiter.api.Test)

Aggregations

ProcessInstanceDuplicatedException (org.kie.kogito.process.ProcessInstanceDuplicatedException)2 Path (java.nio.file.Path)1 Test (org.junit.jupiter.api.Test)1