Tabnine Logo
Job.getId
Code IndexAdd Tabnine to your IDE (free)

How to use
getId
method
in
org.finra.herd.model.api.xml.Job

Best Java code snippets using org.finra.herd.model.api.xml.Job.getId (Showing top 20 results out of 315)

origin: FINRAOS/herd

private Map<String, Object> createJob(String clusterName, String dryRun, String contentType, String emrClusterDefinitionOverride) throws Exception
{
  List<Parameter> parameters = new ArrayList<>();
  parameters.add(new Parameter("clusterName", clusterName));
  parameters.add(new Parameter("dryRun", dryRun));
  parameters.add(new Parameter("contentType", contentType));
  parameters.add(new Parameter("emrClusterDefinitionOverride", emrClusterDefinitionOverride));
  // Run a job with Activiti XML that will start cluster.
  Job job = jobServiceTestHelper.createJobForCreateCluster(ACTIVITI_XML_CREATE_CLUSTER_WITH_CLASSPATH, parameters);
  assertNotNull(job);
  HistoricProcessInstance hisInstance =
    activitiHistoryService.createHistoricProcessInstanceQuery().processInstanceId(job.getId()).includeProcessVariables().singleResult();
  return hisInstance.getProcessVariables();
}
origin: FINRAOS/herd

@Test
public void testGetJobAssertAccessDeniedGivenJobCompletedAndUserDoesNotHavePermissions() throws Exception
{
  jobDefinitionServiceTestHelper.createJobDefinition(null);
  Job job = jobService.createAndStartJob(jobServiceTestHelper.createJobCreateRequest(TEST_ACTIVITI_NAMESPACE_CD, TEST_ACTIVITI_JOB_NAME));
  String username = "username";
  ApplicationUser applicationUser = new ApplicationUser(getClass());
  applicationUser.setUserId(username);
  applicationUser.setNamespaceAuthorizations(new HashSet<>());
  SecurityContextHolder.getContext().setAuthentication(
    new TestingAuthenticationToken(new SecurityUserWrapper(username, "password", false, false, false, false, Collections.emptyList(), applicationUser),
      null));
  try
  {
    jobService.getJob(job.getId(), false);
    fail();
  }
  catch (Exception e)
  {
    assertEquals(AccessDeniedException.class, e.getClass());
    assertEquals(String.format("User \"%s\" does not have \"[READ]\" permission(s) to the namespace \"%s\"", username, TEST_ACTIVITI_NAMESPACE_CD),
      e.getMessage());
  }
}
origin: FINRAOS/herd

@Test
public void testGetJobAssertAccessDeniedGivenJobRunningAndUserDoesNotHavePermissions() throws Exception
{
  jobDefinitionServiceTestHelper.createJobDefinition(ACTIVITI_XML_TEST_USER_TASK_WITH_CLASSPATH);
  Job job = jobService.createAndStartJob(jobServiceTestHelper.createJobCreateRequest(TEST_ACTIVITI_NAMESPACE_CD, TEST_ACTIVITI_JOB_NAME));
  String username = "username";
  ApplicationUser applicationUser = new ApplicationUser(getClass());
  applicationUser.setUserId(username);
  applicationUser.setNamespaceAuthorizations(new HashSet<>());
  SecurityContextHolder.getContext().setAuthentication(
    new TestingAuthenticationToken(new SecurityUserWrapper(username, "password", false, false, false, false, Collections.emptyList(), applicationUser),
      null));
  try
  {
    jobService.getJob(job.getId(), false);
    fail();
  }
  catch (Exception e)
  {
    assertEquals(AccessDeniedException.class, e.getClass());
    assertEquals(String.format("User \"%s\" does not have \"[READ]\" permission(s) to the namespace \"%s\"", username, TEST_ACTIVITI_NAMESPACE_CD),
      e.getMessage());
  }
}
origin: FINRAOS/herd

private void createJobAndCheckStepStatusSuccess(String activitiXml, List<Parameter> parameters) throws Exception
{
  Job job = jobServiceTestHelper.createJobForCreateClusterForActivitiXml(activitiXml, parameters);
  assertNotNull(job);
  HistoricProcessInstance hisInstance =
    activitiHistoryService.createHistoricProcessInstanceQuery().processInstanceId(job.getId()).includeProcessVariables().singleResult();
  Map<String, Object> variables = hisInstance.getProcessVariables();
  String addStepServiceTaskStatus =
    (String) variables.get("addStepServiceTask" + ActivitiRuntimeHelper.TASK_VARIABLE_MARKER + ActivitiRuntimeHelper.VARIABLE_STATUS);
  assertEquals(ActivitiRuntimeHelper.TASK_STATUS_SUCCESS, addStepServiceTaskStatus);
  String addStepId = (String) variables.get("addStepServiceTask" + ActivitiRuntimeHelper.TASK_VARIABLE_MARKER + BaseAddEmrStep.VARIABLE_EMR_STEP_ID);
  assertNotNull(addStepId);
}
origin: FINRAOS/herd

@Test
public void testGetJobAssertNoErrorGivenJobCompletedAndUserDoesHasPermissions() throws Exception
{
  jobDefinitionServiceTestHelper.createJobDefinition(null);
  Job job = jobService.createAndStartJob(jobServiceTestHelper.createJobCreateRequest(TEST_ACTIVITI_NAMESPACE_CD, TEST_ACTIVITI_JOB_NAME));
  String username = "username";
  ApplicationUser applicationUser = new ApplicationUser(getClass());
  applicationUser.setUserId(username);
  applicationUser.setNamespaceAuthorizations(new HashSet<>());
  applicationUser.getNamespaceAuthorizations().add(new NamespaceAuthorization(TEST_ACTIVITI_NAMESPACE_CD, Arrays.asList(NamespacePermissionEnum.READ)));
  SecurityContextHolder.getContext().setAuthentication(
    new TestingAuthenticationToken(new SecurityUserWrapper(username, "password", false, false, false, false, Collections.emptyList(), applicationUser),
      null));
  try
  {
    jobService.getJob(job.getId(), false);
  }
  catch (AccessDeniedException e)
  {
    fail();
  }
}
origin: FINRAOS/herd

@Test
public void testGetJobAssertNoErrorGivenJobRunningAndUserDoesHasPermissions() throws Exception
{
  jobDefinitionServiceTestHelper.createJobDefinition(ACTIVITI_XML_TEST_USER_TASK_WITH_CLASSPATH);
  Job job = jobService.createAndStartJob(jobServiceTestHelper.createJobCreateRequest(TEST_ACTIVITI_NAMESPACE_CD, TEST_ACTIVITI_JOB_NAME));
  String username = "username";
  ApplicationUser applicationUser = new ApplicationUser(getClass());
  applicationUser.setUserId(username);
  applicationUser.setNamespaceAuthorizations(new HashSet<>());
  applicationUser.getNamespaceAuthorizations().add(new NamespaceAuthorization(TEST_ACTIVITI_NAMESPACE_CD, Arrays.asList(NamespacePermissionEnum.READ)));
  SecurityContextHolder.getContext().setAuthentication(
    new TestingAuthenticationToken(new SecurityUserWrapper(username, "password", false, false, false, false, Collections.emptyList(), applicationUser),
      null));
  try
  {
    jobService.getJob(job.getId(), false);
  }
  catch (AccessDeniedException e)
  {
    fail();
  }
}
origin: FINRAOS/herd

@Test
public void testDeleteJobAssertAccessDeniedWhenUserHasNoPermissions() throws Exception
{
  // Start a job that will wait in a receive task
  jobDefinitionServiceTestHelper.createJobDefinition(ACTIVITI_XML_TEST_RECEIVE_TASK_WITH_CLASSPATH);
  Job job = jobService.createAndStartJob(jobServiceTestHelper.createJobCreateRequest(TEST_ACTIVITI_NAMESPACE_CD, TEST_ACTIVITI_JOB_NAME));
  String username = "username";
  ApplicationUser applicationUser = new ApplicationUser(getClass());
  applicationUser.setUserId(username);
  applicationUser.setNamespaceAuthorizations(new HashSet<>());
  SecurityContextHolder.getContext().setAuthentication(
    new TestingAuthenticationToken(new SecurityUserWrapper(username, "password", false, false, false, false, Collections.emptyList(), applicationUser),
      null));
  try
  {
    jobService.deleteJob(job.getId(), new JobDeleteRequest("test delete reason"));
    fail();
  }
  catch (Exception e)
  {
    assertEquals(AccessDeniedException.class, e.getClass());
    assertEquals(String.format("User \"%s\" does not have \"[EXECUTE]\" permission(s) to the namespace \"%s\"", username, TEST_ACTIVITI_NAMESPACE_CD),
      e.getMessage());
  }
}
origin: FINRAOS/herd

@Test
public void testCheckCluster() throws Exception
{
  // Run a job with Activiti XML that will start cluster, check status and terminate.
  Job job = jobServiceTestHelper.createJobForCreateCluster(ACTIVITI_XML_CHECK_CLUSTER_WITH_CLASSPATH, getParameters(true, "", "false"));
  assertNotNull(job);
  HistoricProcessInstance hisInstance =
    activitiHistoryService.createHistoricProcessInstanceQuery().processInstanceId(job.getId()).includeProcessVariables().singleResult();
  Map<String, Object> variables = hisInstance.getProcessVariables();
  //check to be sure fields exist.  These should exist whether verbose is set or not
  assertTrue(variables.containsKey(taskName + ActivitiRuntimeHelper.TASK_VARIABLE_MARKER + CheckEmrCluster.VARIABLE_EMR_CLUSTER_ID));
  assertTrue(variables.containsKey(taskName + ActivitiRuntimeHelper.TASK_VARIABLE_MARKER + CheckEmrCluster.VARIABLE_EMR_CLUSTER_STATUS));
  assertTrue(variables.containsKey(taskName + ActivitiRuntimeHelper.TASK_VARIABLE_MARKER + CheckEmrCluster.VARIABLE_EMR_CLUSTER_CREATION_TIME));
  assertTrue(variables.containsKey(taskName + ActivitiRuntimeHelper.TASK_VARIABLE_MARKER + CheckEmrCluster.VARIABLE_EMR_CLUSTER_READY_TIME));
  assertTrue(variables.containsKey(taskName + ActivitiRuntimeHelper.TASK_VARIABLE_MARKER + CheckEmrCluster.VARIABLE_EMR_CLUSTER_END_TIME));
  assertTrue(
    variables.containsKey(taskName + ActivitiRuntimeHelper.TASK_VARIABLE_MARKER + CheckEmrCluster.VARIABLE_EMR_CLUSTER_STATUS_CHANGE_REASON_CODE));
  assertTrue(
    variables.containsKey(taskName + ActivitiRuntimeHelper.TASK_VARIABLE_MARKER + CheckEmrCluster.VARIABLE_EMR_CLUSTER_STATUS_CHANGE_REASON_MESSAGE));
}
origin: FINRAOS/herd

private void createJobAndCheckStepStatusFailure(String activitiXml, List<Parameter> parameters) throws Exception
{
  Job job = jobServiceTestHelper.createJobForCreateClusterForActivitiXml(activitiXml, parameters);
  assertNotNull(job);
  HistoricProcessInstance hisInstance =
    activitiHistoryService.createHistoricProcessInstanceQuery().processInstanceId(job.getId()).includeProcessVariables().singleResult();
  Map<String, Object> variables = hisInstance.getProcessVariables();
  String addStepServiceTaskStatus =
    (String) variables.get("addStepServiceTask" + ActivitiRuntimeHelper.TASK_VARIABLE_MARKER + ActivitiRuntimeHelper.VARIABLE_STATUS);
  assertEquals(ActivitiRuntimeHelper.TASK_STATUS_ERROR, addStepServiceTaskStatus);
}
origin: FINRAOS/herd

@Test
public void testDeleteJobAssertNoErrorWhenUserHasPermissions() throws Exception
{
  // Start a job that will wait in a receive task
  jobDefinitionServiceTestHelper.createJobDefinition(ACTIVITI_XML_TEST_RECEIVE_TASK_WITH_CLASSPATH);
  Job job = jobService.createAndStartJob(jobServiceTestHelper.createJobCreateRequest(TEST_ACTIVITI_NAMESPACE_CD, TEST_ACTIVITI_JOB_NAME));
  String username = "username";
  ApplicationUser applicationUser = new ApplicationUser(getClass());
  applicationUser.setUserId(username);
  applicationUser.setNamespaceAuthorizations(new HashSet<>());
  applicationUser.getNamespaceAuthorizations()
    .add(new NamespaceAuthorization(TEST_ACTIVITI_NAMESPACE_CD, Arrays.asList(NamespacePermissionEnum.EXECUTE)));
  SecurityContextHolder.getContext().setAuthentication(
    new TestingAuthenticationToken(new SecurityUserWrapper(username, "password", false, false, false, false, Collections.emptyList(), applicationUser),
      null));
  try
  {
    jobService.deleteJob(job.getId(), new JobDeleteRequest("test delete reason"));
  }
  catch (AccessDeniedException e)
  {
    fail();
  }
}
origin: FINRAOS/herd

/**
 * Asserts that the deleteJob call will throw an error when delete reason is blank.
 *
 * @throws Exception
 */
@Test
public void testDeleteJobAssertErrorDeleteReasonBlank() throws Exception
{
  // Start a job that will wait in a receive task
  jobDefinitionServiceTestHelper.createJobDefinition(ACTIVITI_XML_TEST_RECEIVE_TASK_WITH_CLASSPATH);
  Job job = jobService.createAndStartJob(jobServiceTestHelper.createJobCreateRequest(TEST_ACTIVITI_NAMESPACE_CD, TEST_ACTIVITI_JOB_NAME));
  // Create a job delete request
  JobDeleteRequest jobDeleteRequest = new JobDeleteRequest();
  jobDeleteRequest.setDeleteReason(BLANK_TEXT);
  try
  {
    jobService.deleteJob(job.getId(), jobDeleteRequest);
  }
  catch (Exception e)
  {
    assertEquals(IllegalArgumentException.class, e.getClass());
    assertEquals("deleteReason must be specified", e.getMessage());
  }
}
origin: FINRAOS/herd

@Test
public void testSignalJob() throws Exception
{
  jobDefinitionServiceTestHelper.createJobDefinition(ACTIVITI_XML_TEST_RECEIVE_TASK_WITH_CLASSPATH);
  // Start the job.
  Job job = jobService.createAndStartJob(jobServiceTestHelper.createJobCreateRequest(TEST_ACTIVITI_NAMESPACE_CD, TEST_ACTIVITI_JOB_NAME));
  // Job should be waiting at Receive task.
  Job jobGet = jobService.getJob(job.getId(), false);
  assertEquals(JobStatusEnum.RUNNING, jobGet.getStatus());
  assertEquals("receivetask1", jobGet.getCurrentWorkflowStep().getId());
  // Signal job to continue.
  List<Parameter> signalParameters = new ArrayList<>();
  Parameter signalPameter1 = new Parameter("UT_SIGNAL_PARAM_1", "UT_SIGNAL_VALUE_1");
  signalParameters.add(signalPameter1);
  JobSignalRequest jobSignalRequest = new JobSignalRequest(job.getId(), "receivetask1", signalParameters, null);
  Job signalJob = jobService.signalJob(jobSignalRequest);
  assertEquals(JobStatusEnum.RUNNING, signalJob.getStatus());
  assertEquals("receivetask1", signalJob.getCurrentWorkflowStep().getId());
  assertTrue(signalJob.getParameters().contains(signalPameter1));
  // Job should have been completed.
  jobGet = jobService.getJob(job.getId(), true);
  assertEquals(JobStatusEnum.COMPLETED, jobGet.getStatus());
  assertTrue(jobGet.getParameters().contains(signalPameter1));
}
origin: FINRAOS/herd

@Test
public void testGetJobIntermediateTimer() throws Exception
{
  jobDefinitionServiceTestHelper.createJobDefinition(ACTIVITI_XML_HERD_INTERMEDIATE_TIMER_WITH_CLASSPATH);
  Job job = jobService.createAndStartJob(jobServiceTestHelper.createJobCreateRequest(TEST_ACTIVITI_NAMESPACE_CD, TEST_ACTIVITI_JOB_NAME));
  String activitiXml = IOUtils.toString(resourceLoader.getResource(ACTIVITI_XML_HERD_INTERMEDIATE_TIMER_WITH_CLASSPATH).getInputStream());
  // Job should be waiting at User task.
  // Get job status
  Job jobGet = jobService.getJob(job.getId(), true);
  assertEquals(JobStatusEnum.RUNNING, jobGet.getStatus());
  assertNotNull(jobGet.getActivitiJobXml());
  assertEquals(activitiXml, jobGet.getActivitiJobXml());
  assertTrue(jobGet.getCompletedWorkflowSteps().size() > 0);
  // Current workflow step will be null
  assertNull(jobGet.getCurrentWorkflowStep());
  org.activiti.engine.runtime.Job timer = activitiManagementService.createJobQuery().processInstanceId(job.getId()).timers().singleResult();
  if (timer != null)
  {
    activitiManagementService.executeJob(timer.getId());
  }
  // Get the job status again. job should have completed now.
  jobGet = jobService.getJob(job.getId(), false);
  assertEquals(JobStatusEnum.COMPLETED, jobGet.getStatus());
  assertNull(jobGet.getCurrentWorkflowStep());
}
origin: FINRAOS/herd

@Test
public void testCheckClusterByClusterIdStepIdNoActiveStep() throws Exception
{
  List<FieldExtension> fieldExtensions = getOptionalFieldExtensions();
  FieldExtension fieldExtension = new FieldExtension();
  fieldExtension.setFieldName("emrStepId");
  fieldExtension.setExpression("${addHiveStepServiceTask_emrStepId}");
  fieldExtensions.add(fieldExtension);
  // Run a job with Activiti XML that will start cluster, check status and terminate.
  Job job =
    jobServiceTestHelper.createJobForCreateClusterForActivitiXml(getCheckClusterActivitiXml(fieldExtensions), getParameters(false, "false", "false"));
  assertNotNull(job);
  HistoricProcessInstance hisInstance =
    activitiHistoryService.createHistoricProcessInstanceQuery().processInstanceId(job.getId()).includeProcessVariables().singleResult();
  Map<String, Object> variables = hisInstance.getProcessVariables();
  String hiveStepId = (String) variables.get("addHiveStepServiceTask" + ActivitiRuntimeHelper.TASK_VARIABLE_MARKER + "emrStepId");
  assertNotNull(hiveStepId);
  String emrStepId = (String) variables.get("checkClusterServiceTask" + ActivitiRuntimeHelper.TASK_VARIABLE_MARKER + "step_id");
  assertEquals(hiveStepId, emrStepId);
  String emrStepJarLocation = (String) variables.get("checkClusterServiceTask" + ActivitiRuntimeHelper.TASK_VARIABLE_MARKER + "step_jarLocation");
  assertNull(emrStepJarLocation);
  String activeStepId = (String) variables.get("checkClusterServiceTask" + ActivitiRuntimeHelper.TASK_VARIABLE_MARKER + "activeStep_id");
  assertNull(activeStepId);
}
origin: FINRAOS/herd

@Test
public void testSignalJobNoParameters() throws Exception
{
  jobDefinitionServiceTestHelper.createJobDefinition(ACTIVITI_XML_TEST_RECEIVE_TASK_WITH_CLASSPATH);
  // Start the job.
  Job job = jobService.createAndStartJob(jobServiceTestHelper.createJobCreateRequest(TEST_ACTIVITI_NAMESPACE_CD, TEST_ACTIVITI_JOB_NAME));
  // Job should be waiting at Receive task.
  Job jobGet = jobService.getJob(job.getId(), false);
  assertEquals(JobStatusEnum.RUNNING, jobGet.getStatus());
  assertEquals("receivetask1", jobGet.getCurrentWorkflowStep().getId());
  // Signal job to continue.
  JobSignalRequest jobSignalRequest = new JobSignalRequest(job.getId(), "receivetask1", null, null);
  Job signalJob = jobService.signalJob(jobSignalRequest);
  assertEquals(JobStatusEnum.RUNNING, signalJob.getStatus());
  assertEquals("receivetask1", signalJob.getCurrentWorkflowStep().getId());
  // Job should have been completed.
  jobGet = jobService.getJob(job.getId(), true);
  assertEquals(JobStatusEnum.COMPLETED, jobGet.getStatus());
}
origin: FINRAOS/herd

@Test
public void testCheckClusterByRetrieveInstanceFleets() throws Exception
{
  // Run a job with Activiti XML that will start cluster, check status and terminate.
  List<FieldExtension> fieldExtensions = getOptionalFieldExtensions();
  FieldExtension fieldExtension = new FieldExtension();
  fieldExtension.setFieldName("emrStepId");
  fieldExtension.setExpression("${addHiveStepServiceTask_emrStepId}");
  fieldExtensions.add(fieldExtension);
  Job job =
    jobServiceTestHelper.createJobForCreateClusterForActivitiXml(getCheckClusterActivitiXml(fieldExtensions), getParameters(true, "true", "true"));
  assertNotNull(job);
  HistoricProcessInstance hisInstance =
    activitiHistoryService.createHistoricProcessInstanceQuery().processInstanceId(job.getId()).includeProcessVariables().singleResult();
  Map<String, Object> variables = hisInstance.getProcessVariables();
  String emrClusterInstanceFleetJson = (String) variables.get("checkClusterServiceTask" + ActivitiRuntimeHelper.TASK_VARIABLE_MARKER + "instance_fleets");
  assertNotNull(emrClusterInstanceFleetJson);
}
origin: FINRAOS/herd

/**
 * Signals job with both S3 properties and request parameters set. If there are name clashes, the request parameter should take precedence.
 *
 * @throws Exception
 */
@Test
public void testSignalJobWithS3PropertiesPrecedenceRequestParamsOverridesS3() throws Exception
{
  jobDefinitionServiceTestHelper.createJobDefinition(ACTIVITI_XML_TEST_RECEIVE_TASK_WITH_CLASSPATH);
  Parameter s3Parameter = new Parameter("testName", "testValue");
  Parameter requestParameter = new Parameter("testName", "expectedValue");
  S3PropertiesLocation s3PropertiesLocation = getS3PropertiesLocation("s3BucketName", "s3ObjectKey", s3Parameter);
  // Start the job.
  Job job = jobService.createAndStartJob(jobServiceTestHelper.createJobCreateRequest(TEST_ACTIVITI_NAMESPACE_CD, TEST_ACTIVITI_JOB_NAME));
  JobSignalRequest jobSignalRequest = new JobSignalRequest(job.getId(), "receivetask1", null, null);
  jobSignalRequest.setS3PropertiesLocation(s3PropertiesLocation);
  jobSignalRequest.setParameters(Arrays.asList(requestParameter));
  Job signalJob = jobService.signalJob(jobSignalRequest);
  assertParameterEquals(requestParameter, signalJob.getParameters());
}
origin: FINRAOS/herd

/**
 * Signals job with S3 properties set. Parameters should be populated from the properties.
 *
 * @throws Exception
 */
@Test
public void testSignalJobWithS3Properties() throws Exception
{
  jobDefinitionServiceTestHelper.createJobDefinition(ACTIVITI_XML_TEST_RECEIVE_TASK_WITH_CLASSPATH);
  Parameter parameter = new Parameter("testName", "testValue");
  S3PropertiesLocation s3PropertiesLocation = getS3PropertiesLocation("s3BucketName", "s3ObjectKey", parameter);
  // Start the job.
  Job job = jobService.createAndStartJob(jobServiceTestHelper.createJobCreateRequest(TEST_ACTIVITI_NAMESPACE_CD, TEST_ACTIVITI_JOB_NAME));
  JobSignalRequest jobSignalRequest = new JobSignalRequest(job.getId(), "receivetask1", null, null);
  jobSignalRequest.setS3PropertiesLocation(s3PropertiesLocation);
  Job signalJob = jobService.signalJob(jobSignalRequest);
  assertParameterEquals(parameter, signalJob.getParameters());
}
origin: FINRAOS/herd

/**
 * This method tests the timer execution in a workflow.
 */
@Test
public void testTimerJob() throws Exception
{
  // Create and start the workflow.
  jobDefinitionServiceTestHelper.createJobDefinition(ACTIVITI_XML_HERD_TIMER_WITH_CLASSPATH);
  Job job = jobService.createAndStartJob(jobServiceTestHelper.createJobCreateRequest(TEST_ACTIVITI_NAMESPACE_CD, TEST_ACTIVITI_JOB_NAME));
  assertNotNull(job);
  // This workflow would normally automatically start a timer which would eventually complete the workflow, however, since
  // this test method is running within our own transaction, the timer would never go off since it is run in a different thread which is outside of
  // our transaction which didn't commit yet. As a result, we need to manually run the timer job to simulate what would happen if the timer
  // went off by itself.
  org.activiti.engine.runtime.Job timer = activitiManagementService.createJobQuery().processInstanceId(job.getId()).timers().singleResult();
  if (timer != null)
  {
    activitiManagementService.executeJob(timer.getId());
  }
}
origin: FINRAOS/herd

/**
 * This method tests the scenario when an workflow related error is throws while workflow is executing an Async type task like Timer. This error is logged
 * as WARN.
 */
@Test(expected = ActivitiException.class)
public void testActivitiUnReportableError() throws Exception
{
  BpmnModel bpmnModel = getBpmnModelForXmlResource(ACTIVITI_XML_HERD_TIMER_WITH_CLASSPATH);
  ServiceTask serviceTask = (ServiceTask) bpmnModel.getProcesses().get(0).getFlowElement("servicetask1");
  serviceTask.setImplementationType(ImplementationType.IMPLEMENTATION_TYPE_EXPRESSION);
  serviceTask.setImplementation("${BeanNotAvailable}");
  jobDefinitionServiceTestHelper.createJobDefinitionForActivitiXml(getActivitiXmlFromBpmnModel(bpmnModel));
  Job job = jobService.createAndStartJob(jobServiceTestHelper.createJobCreateRequest(TEST_ACTIVITI_NAMESPACE_CD, TEST_ACTIVITI_JOB_NAME, null));
  org.activiti.engine.runtime.Job timer = activitiManagementService.createJobQuery().processInstanceId(job.getId()).timers().singleResult();
  if (timer != null)
  {
    executeWithoutLogging(TimerExecuteNestedActivityJobHandler.class, () -> {
      activitiManagementService.executeJob(timer.getId());
    });
  }
}
org.finra.herd.model.api.xmlJobgetId

Javadoc

Gets the value of the id property.

Popular methods of Job

  • <init>
    Fully-initialising value constructor
  • getParameters
  • setId
    Sets the value of the id property.
  • getActivitiJobXml
    Gets the value of the activitiJobXml property.
  • getCompletedWorkflowSteps
  • getCurrentWorkflowStep
    Gets the value of the currentWorkflowStep property.
  • getDeleteReason
    Gets the value of the deleteReason property.
  • getEndTime
    Gets the value of the endTime property.
  • getJobName
    Gets the value of the jobName property.
  • getNamespace
    Gets the value of the namespace property.
  • getStartTime
    Gets the value of the startTime property.
  • getStatus
    Gets the value of the status property.
  • getStartTime,
  • getStatus,
  • setActivitiJobXml,
  • setCompletedWorkflowSteps,
  • setCurrentWorkflowStep,
  • setDeleteReason,
  • setEndTime,
  • setJobName,
  • setNamespace

Popular in Java

  • Reading from database using SQL prepared statement
  • notifyDataSetChanged (ArrayAdapter)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • findViewById (Activity)
  • Pointer (com.sun.jna)
    An abstraction for a native pointer data type. A Pointer instance represents, on the Java side, a na
  • Font (java.awt)
    The Font class represents fonts, which are used to render text in a visible way. A font provides the
  • Rectangle (java.awt)
    A Rectangle specifies an area in a coordinate space that is enclosed by the Rectangle object's top-
  • Time (java.sql)
    Java representation of an SQL TIME value. Provides utilities to format and parse the time's represen
  • MessageFormat (java.text)
    Produces concatenated messages in language-neutral way. New code should probably use java.util.Forma
  • Modifier (javassist)
    The Modifier class provides static methods and constants to decode class and member access modifiers
  • Top PhpStorm plugins
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