Codota Logo
PipelineExecutorRegistry
Code IndexAdd Codota to your IDE (free)

How to use
PipelineExecutorRegistry
in
org.guvnor.ala.registry

Best Java code snippets using org.guvnor.ala.registry.PipelineExecutorRegistry (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Gson g =
  • Codota Iconnew Gson()
  • Codota IconGsonBuilder gsonBuilder;gsonBuilder.create()
  • Codota Iconnew GsonBuilder().create()
  • Smart code suggestions by Codota
}
origin: org.guvnor/guvnor-ala-spi

@Test
public void testDeleteTask() throws Exception {
  PipelineExecutorTrace trace = mock(PipelineExecutorTrace.class);
  PipelineExecutorTask task = mock(PipelineExecutorTask.class);
  PipelineExecutorTask.Status status = PipelineExecutorTask.Status.STOPPED;
  when(task.getPipelineStatus()).thenReturn(status);
  when(trace.getTask()).thenReturn(task);
  when(pipelineExecutorRegistry.getExecutorTrace(TASK_ID)).thenReturn(trace);
  taskManager.delete(TASK_ID);
  verify(pipelineExecutorRegistry,
      times(1)).deregister(TASK_ID);
}
origin: org.kie.workbench/kie-wb-common-ala-spi

private void updateExecutorRegistry(final PipelineExecutorTaskImpl task) {
  try {
    PipelineExecutorTaskImpl clone = (PipelineExecutorTaskImpl) task.clone();
    pipelineExecutorRegistry.register(new PipelineExecutorTraceImpl(clone));
  } catch (Exception e) {
    //clone is supported by construction, since PipelineExecutorTaskImpl is clonable.
    logger.error("Unexpected error: " + e.getMessage(),
           e);
  }
}
origin: org.guvnor/guvnor-ala-spi

@Test
public void testDestroyAsyncTask() throws PipelineExecutorException {
  when(taskManagerHelper.generateTaskId()).thenReturn(TASK_ID);
  taskManager.init();
  //prepare the input parameters.
  prepareExecution();
  Future future = mock(Future.class);
  when(executorService.submit(any(Runnable.class))).thenReturn(future);
  String result = taskManager.execute(taskDef,
                    PipelineExecutorTaskManager.ExecutionMode.ASYNCHRONOUS);
  assertEquals(TASK_ID,
         result);
  taskManager.destroy(TASK_ID);
  verify(future,
      times(1)).cancel(true);
  assertFalse(taskManager.currentTasks.containsKey(TASK_ID));
  verify(pipelineExecutorRegistry,
      times(1)).deregister(TASK_ID);
}
origin: org.kie.workbench/kie-wb-common-ala-spi

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);
}
origin: org.guvnor/guvnor-ala-services-rest

    .withPipelineId(query.getPipelineId());
final Collection<PipelineExecutorTrace> pipelineTraces = pipelineExecutorRegistry.getExecutorTraces().stream()
    .filter(traceFilter)
    .collect(Collectors.toList());
origin: org.kie.workbench/kie-wb-common-ala-spi

@Test
public void testDestroyAsyncTask() throws PipelineExecutorException {
  when(taskManagerHelper.generateTaskId()).thenReturn(TASK_ID);
  taskManager.init();
  //prepare the input parameters.
  prepareExecution();
  Future future = mock(Future.class);
  when(executorService.submit(any(Runnable.class))).thenReturn(future);
  String result = taskManager.execute(taskDef,
                    PipelineExecutorTaskManager.ExecutionMode.ASYNCHRONOUS);
  assertEquals(TASK_ID,
         result);
  taskManager.destroy(TASK_ID);
  verify(future,
      times(1)).cancel(true);
  assertFalse(taskManager.currentTasks.containsKey(TASK_ID));
  verify(pipelineExecutorRegistry,
      times(1)).deregister(TASK_ID);
}
origin: org.guvnor/guvnor-ala-spi

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);
}
origin: org.guvnor/guvnor-ala-services-rest

@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());
  }
}
origin: org.guvnor/guvnor-ala-spi

private void updateExecutorRegistry(final PipelineExecutorTaskImpl task) {
  try {
    PipelineExecutorTaskImpl clone = (PipelineExecutorTaskImpl) task.clone();
    pipelineExecutorRegistry.register(new PipelineExecutorTraceImpl(clone));
  } catch (Exception e) {
    //clone is supported by construction, since PipelineExecutorTaskImpl is clonable.
    logger.error("Unexpected error: " + e.getMessage(),
           e);
  }
}
origin: org.kie.workbench/kie-wb-common-ala-spi

@Override
public void destroy(final String taskId) throws PipelineExecutorException {
  final TaskEntry entry = getTaskEntry(taskId);
  if (entry == null) {
    throw new PipelineExecutorException("No PipelineExecutorTask was found for taskId: " + taskId);
  }
  if (!entry.isAsync()) {
    throw new PipelineExecutorException("Destroy operation is not available for taskId: " + taskId +
                          " running in SYNCHRONOUS mode");
  }
  destroyFutureTask(taskId);
  removeTaskEntry(taskId);
  pipelineExecutorRegistry.deregister(taskId);
}
origin: org.kie.workbench/kie-wb-common-ala-spi

@Test
public void testDeleteTask() throws Exception {
  PipelineExecutorTrace trace = mock(PipelineExecutorTrace.class);
  PipelineExecutorTask task = mock(PipelineExecutorTask.class);
  PipelineExecutorTask.Status status = PipelineExecutorTask.Status.STOPPED;
  when(task.getPipelineStatus()).thenReturn(status);
  when(trace.getTask()).thenReturn(task);
  when(pipelineExecutorRegistry.getExecutorTrace(TASK_ID)).thenReturn(trace);
  taskManager.delete(TASK_ID);
  verify(pipelineExecutorRegistry,
      times(1)).deregister(TASK_ID);
}
origin: org.kie.workbench/kie-wb-common-ala-spi

private void verifyExecutorRegistryUpdated(boolean async) {
  if (async) {
    //verify the pipeline executor registry was properly updated.
    verify(pipelineExecutorRegistry,
        times(1)).register(pipelineExecutorTraceCaptor.capture());
    assertHasSameInfo(task,
             pipelineExecutorTraceCaptor.getValue().getTask());
  } else {
    verify(pipelineExecutorRegistry,
        never()).register(anyObject());
  }
}
origin: org.guvnor/guvnor-ala-spi

@Override
public void destroy(final String taskId) throws PipelineExecutorException {
  final TaskEntry entry = getTaskEntry(taskId);
  if (entry == null) {
    throw new PipelineExecutorException("No PipelineExecutorTask was found for taskId: " + taskId);
  }
  if (!entry.isAsync()) {
    throw new PipelineExecutorException("Destroy operation is not available for taskId: " + taskId +
                          " running in SYNCHRONOUS mode");
  }
  destroyFutureTask(taskId);
  removeTaskEntry(taskId);
  pipelineExecutorRegistry.deregister(taskId);
}
origin: org.kie.workbench/kie-wb-common-ala-spi

@Override
public void delete(final String taskId) throws PipelineExecutorException {
  final TaskEntry entry = getTaskEntry(taskId);
  if (entry != null) {
    throw new PipelineExecutorException("An active PipelineExecutorTask was found for taskId: " + taskId +
                          " delete operation is only available for the following status set: " + deleteEnabledStatus);
  }
  final PipelineExecutorTrace trace = pipelineExecutorRegistry.getExecutorTrace(taskId);
  if (trace == null) {
    throw new PipelineExecutorException("No PipelineExecutorTask was found for taskId: " + taskId);
  } else {
    if (!deleteEnabledStatus.contains(trace.getTask().getPipelineStatus())) {
      throw new PipelineExecutorException("A PipelineExecutorTask in status: "
                            + trace.getTask().getPipelineStatus().name() + " can not" +
                            " be deleted. Delete operation is available for the following status set: " + deleteEnabledStatus);
    } else {
      pipelineExecutorRegistry.deregister(taskId);
    }
  }
}
origin: org.guvnor/guvnor-ala-spi

private void verifyExecutorRegistryUpdated(boolean async) {
  if (async) {
    //verify the pipeline executor registry was properly updated.
    verify(pipelineExecutorRegistry,
        times(1)).register(pipelineExecutorTraceCaptor.capture());
    assertHasSameInfo(task,
             pipelineExecutorTraceCaptor.getValue().getTask());
  } else {
    verify(pipelineExecutorRegistry,
        never()).register(anyObject());
  }
}
origin: org.guvnor/guvnor-ala-spi

@Override
public void delete(final String taskId) throws PipelineExecutorException {
  final TaskEntry entry = getTaskEntry(taskId);
  if (entry != null) {
    throw new PipelineExecutorException("An active PipelineExecutorTask was found for taskId: " + taskId +
                          " delete operation is only available for the following status set: " + deleteEnabledStatus);
  }
  final PipelineExecutorTrace trace = pipelineExecutorRegistry.getExecutorTrace(taskId);
  if (trace == null) {
    throw new PipelineExecutorException("No PipelineExecutorTask was found for taskId: " + taskId);
  } else {
    if (!deleteEnabledStatus.contains(trace.getTask().getPipelineStatus())) {
      throw new PipelineExecutorException("A PipelineExecutorTask in status: "
                            + trace.getTask().getPipelineStatus().name() + " can not" +
                            " be deleted. Delete operation is available for the following status set: " + deleteEnabledStatus);
    } else {
      pipelineExecutorRegistry.deregister(taskId);
    }
  }
}
origin: org.kie.workbench/kie-wb-common-ala-spi

               times(1)).setTaskInStoppedStatus(task));
verify(pipelineExecutorRegistry,
    times(5)).register(pipelineExecutorTraceCaptor.capture());
Map<String, PipelineExecutorTask> registeredTasks = new HashMap<>();
pipelineExecutorTraceCaptor.getAllValues().forEach(capture -> registeredTasks.put(capture.getTaskId(),
origin: org.guvnor/guvnor-ala-spi

               times(1)).setTaskInStoppedStatus(task));
verify(pipelineExecutorRegistry,
    times(5)).register(pipelineExecutorTraceCaptor.capture());
Map<String, PipelineExecutorTask> registeredTasks = new HashMap<>();
pipelineExecutorTraceCaptor.getAllValues().forEach(capture -> registeredTasks.put(capture.getTaskId(),
origin: org.guvnor/guvnor-ala-spi

@Test
public void testStopAsyncTask() throws PipelineExecutorException {
  when(taskManagerHelper.generateTaskId()).thenReturn(TASK_ID);
  taskManager.init();
  //prepare the input parameters.
  prepareExecution();
  Future future = mock(Future.class);
  when(executorService.submit(any(Runnable.class))).thenReturn(future);
  String result = taskManager.execute(taskDef,
                    PipelineExecutorTaskManager.ExecutionMode.ASYNCHRONOUS);
  assertEquals(TASK_ID,
         result);
  PipelineExecutorTaskManagerImpl.TaskEntry taskEntry = taskManager.currentTasks.get(TASK_ID);
  taskManager.stop(TASK_ID);
  verify(future,
      times(1)).cancel(true);
  assertFalse(taskManager.currentTasks.containsKey(TASK_ID));
  verify(taskManagerHelper,
      times(1)).setTaskInStoppedStatus(taskEntry.getTask());
  //verify the pipeline executor registry was properly updated.
  verify(pipelineExecutorRegistry,
      times(2)).register(pipelineExecutorTraceCaptor.capture());
  assertHasSameInfo(pipelineExecutorTraceCaptor.getAllValues().get(1).getTask(),
           pipelineExecutorTraceCaptor.getValue().getTask());
}
origin: org.kie.workbench/kie-wb-common-ala-spi

@Test
public void testStopAsyncTask() throws PipelineExecutorException {
  when(taskManagerHelper.generateTaskId()).thenReturn(TASK_ID);
  taskManager.init();
  //prepare the input parameters.
  prepareExecution();
  Future future = mock(Future.class);
  when(executorService.submit(any(Runnable.class))).thenReturn(future);
  String result = taskManager.execute(taskDef,
                    PipelineExecutorTaskManager.ExecutionMode.ASYNCHRONOUS);
  assertEquals(TASK_ID,
         result);
  PipelineExecutorTaskManagerImpl.TaskEntry taskEntry = taskManager.currentTasks.get(TASK_ID);
  taskManager.stop(TASK_ID);
  verify(future,
      times(1)).cancel(true);
  assertFalse(taskManager.currentTasks.containsKey(TASK_ID));
  verify(taskManagerHelper,
      times(1)).setTaskInStoppedStatus(taskEntry.getTask());
  //verify the pipeline executor registry was properly updated.
  verify(pipelineExecutorRegistry,
      times(2)).register(pipelineExecutorTraceCaptor.capture());
  assertHasSameInfo(pipelineExecutorTraceCaptor.getAllValues().get(1).getTask(),
           pipelineExecutorTraceCaptor.getValue().getTask());
}
org.guvnor.ala.registryPipelineExecutorRegistry

Javadoc

Registry for storing the pipeline execution traces produced by pipelines launched by the PipelineExecutorTaskManager.

Most used methods

  • deregister
    Deregisters a pipeline executor trace.
  • getExecutorTrace
    Gets the pipeline executor trace that produced a runtime.
  • register
    Registers a pipeline executor trace.
  • getExecutorTraces
    Get the currently registered pipeline executor traces.

Popular in Java

  • Running tasks concurrently on multiple threads
  • notifyDataSetChanged (ArrayAdapter)
  • getSharedPreferences (Context)
  • runOnUiThread (Activity)
  • Runnable (java.lang)
    Represents a command that can be executed. Often used to run code in a different Thread.
  • Proxy (java.net)
    This class represents proxy server settings. A created instance of Proxy stores a type and an addres
  • SortedMap (java.util)
    A map that has its keys ordered. The sorting is according to either the natural ordering of its keys
  • ExecutorService (java.util.concurrent)
    An Executor that provides methods to manage termination and methods that can produce a Future for tr
  • Stream (java.util.stream)
    A sequence of elements supporting sequential and parallel aggregate operations. The following exampl
  • JComboBox (javax.swing)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now