congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
PipelineExecutorRegistry
Code IndexAdd Tabnine 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)

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

  • Finding current android device location
  • getSharedPreferences (Context)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • scheduleAtFixedRate (Timer)
  • Pointer (com.sun.jna)
    An abstraction for a native pointer data type. A Pointer instance represents, on the Java side, a na
  • Window (java.awt)
    A Window object is a top-level window with no borders and no menubar. The default layout for a windo
  • URLConnection (java.net)
    A connection to a URL for reading or writing. For HTTP connections, see HttpURLConnection for docume
  • SecureRandom (java.security)
    This class generates cryptographically secure pseudo-random numbers. It is best to invoke SecureRand
  • NoSuchElementException (java.util)
    Thrown when trying to retrieve an element past the end of an Enumeration or Iterator.
  • CountDownLatch (java.util.concurrent)
    A synchronization aid that allows one or more threads to wait until a set of operations being perfor
  • From CI to AI: The AI layer in your organization
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now