Search in sources :

Example 1 with PipelineExecutorTrace

use of org.guvnor.ala.pipeline.execution.PipelineExecutorTrace in project kie-wb-common by kiegroup.

the class VFSPipelineExecutorRegistryTest method testRegister.

@Test
@Override
public void testRegister() {
    prepareTargetPath();
    pipelineExecutorRegistry.register(trace);
    try {
        verify(registryHelper, times(1)).storeEntry(traceTargetPath, trace);
    } catch (Exception e) {
        // need to catch this exception because parent class method don't throws exceptions,
        // but this will never happen in this scenario.
        fail(e.getMessage());
    }
    PipelineExecutorTrace result = pipelineExecutorRegistry.getExecutorTrace(PIPELINE_EXECUTION_ID);
    assertEquals(trace, result);
}
Also used : PipelineExecutorTrace(org.guvnor.ala.pipeline.execution.PipelineExecutorTrace) ExpectedException(org.junit.rules.ExpectedException) Test(org.junit.Test) InMemoryPipelineExecutorRegistryTest(org.guvnor.ala.registry.inmemory.InMemoryPipelineExecutorRegistryTest)

Example 2 with PipelineExecutorTrace

use of org.guvnor.ala.pipeline.execution.PipelineExecutorTrace in project kie-wb-common by kiegroup.

the class VFSPipelineExecutorRegistryTest method testDeregister.

@Test
@Override
public void testDeregister() {
    prepareTargetPath();
    pipelineExecutorRegistry.register(trace);
    PipelineExecutorTrace result = pipelineExecutorRegistry.getExecutorTrace(PIPELINE_EXECUTION_ID);
    assertEquals(trace, result);
    pipelineExecutorRegistry.deregister(PIPELINE_EXECUTION_ID);
    verify(registryHelper, times(1)).deleteBatch(traceTargetPath);
    result = pipelineExecutorRegistry.getExecutorTrace(PIPELINE_EXECUTION_ID);
    assertNull(result);
}
Also used : PipelineExecutorTrace(org.guvnor.ala.pipeline.execution.PipelineExecutorTrace) Test(org.junit.Test) InMemoryPipelineExecutorRegistryTest(org.guvnor.ala.registry.inmemory.InMemoryPipelineExecutorRegistryTest)

Example 3 with PipelineExecutorTrace

use of org.guvnor.ala.pipeline.execution.PipelineExecutorTrace in project kie-wb-common by kiegroup.

the class RestRuntimeProvisioningServiceImpl method destroyRuntime.

@Override
public void destroyRuntime(String runtimeId, boolean forced) throws BusinessException {
    final Runtime runtimeById = runtimeRegistry.getRuntimeById(runtimeId);
    if (runtimeById == null) {
        throw new BusinessException("No runtime was found for runtimeId: " + runtimeId);
    }
    final PipelineExecutorTrace pipelineTrace = pipelineExecutorRegistry.getExecutorTrace(runtimeById);
    try {
        runtimeFactory.destroyRuntime(runtimeById);
    } catch (Exception e) {
        if (forced) {
            LOG.warn("Runtime destroy raised the following error for runtime: " + runtimeId + " but forced destroy will still remove the runtime from registry.", e);
            runtimeRegistry.deregisterRuntime(runtimeById);
        } else {
            throw e;
        }
    }
    if (pipelineTrace != null) {
        pipelineExecutorRegistry.deregister(pipelineTrace.getTaskId());
    }
}
Also used : Runtime(org.guvnor.ala.runtime.Runtime) BusinessException(org.guvnor.ala.services.exceptions.BusinessException) PipelineExecutorTrace(org.guvnor.ala.pipeline.execution.PipelineExecutorTrace) BusinessException(org.guvnor.ala.services.exceptions.BusinessException)

Example 4 with PipelineExecutorTrace

use of org.guvnor.ala.pipeline.execution.PipelineExecutorTrace in project kie-wb-common by kiegroup.

the class PipelineExecutorTaskManagerImplExecutionTest method testDeleteTaskInNonStopeableState.

private void testDeleteTaskInNonStopeableState(PipelineExecutorTask.Status nonStopeableStatus) throws Exception {
    PipelineExecutorTask task = mock(PipelineExecutorTask.class);
    when(task.getPipelineStatus()).thenReturn(nonStopeableStatus);
    PipelineExecutorTrace trace = mock(PipelineExecutorTrace.class);
    when(trace.getTask()).thenReturn(task);
    when(pipelineExecutorRegistry.getExecutorTrace(TASK_ID)).thenReturn(trace);
    expectedException.expectMessage(new StartsWith("A PipelineExecutorTask in status: " + nonStopeableStatus + " can not" + " be deleted. Delete operation is available for the following status set:"));
    taskManager.delete(TASK_ID);
}
Also used : PipelineExecutorTrace(org.guvnor.ala.pipeline.execution.PipelineExecutorTrace) PipelineExecutorTask(org.guvnor.ala.pipeline.execution.PipelineExecutorTask) StartsWith(org.mockito.internal.matchers.StartsWith)

Example 5 with PipelineExecutorTrace

use of org.guvnor.ala.pipeline.execution.PipelineExecutorTrace in project kie-wb-common by kiegroup.

the class InMemoryPipelineExecutorRegistryTest method testGetExecutorTrace.

@Test
public void testGetExecutorTrace() {
    pipelineExecutorRegistry.register(trace);
    PipelineExecutorTrace result = pipelineExecutorRegistry.getExecutorTrace(PIPELINE_EXECUTION_ID);
    assertEquals(trace, result);
}
Also used : PipelineExecutorTrace(org.guvnor.ala.pipeline.execution.PipelineExecutorTrace) Test(org.junit.Test)

Aggregations

PipelineExecutorTrace (org.guvnor.ala.pipeline.execution.PipelineExecutorTrace)12 Test (org.junit.Test)9 PipelineExecutorTask (org.guvnor.ala.pipeline.execution.PipelineExecutorTask)3 InMemoryPipelineExecutorRegistryTest (org.guvnor.ala.registry.inmemory.InMemoryPipelineExecutorRegistryTest)3 ArrayList (java.util.ArrayList)1 PipelineExecutorException (org.guvnor.ala.pipeline.execution.PipelineExecutorException)1 Runtime (org.guvnor.ala.runtime.Runtime)1 BusinessException (org.guvnor.ala.services.exceptions.BusinessException)1 ExpectedException (org.junit.rules.ExpectedException)1 StartsWith (org.mockito.internal.matchers.StartsWith)1