Search in sources :

Example 86 with JobDefinition

use of org.camunda.bpm.engine.management.JobDefinition in project camunda-bpm-platform by camunda.

the class MultiTenancyJobCmdsTenantCheckTest method testSetOverridingJobPriorityWithCascadeAndNoAuthenticatedTenant.

@Test
public void testSetOverridingJobPriorityWithCascadeAndNoAuthenticatedTenant() {
    JobDefinition jobDefinition = managementService.createJobDefinitionQuery().list().get(0);
    identityService.setAuthentication("aUserId", null);
    // then
    thrown.expect(ProcessEngineException.class);
    thrown.expectMessage("Cannot update the process definition '" + jobDefinition.getProcessDefinitionId() + "' because it belongs to no authenticated tenant.");
    managementService.setOverridingJobPriorityForJobDefinition(jobDefinition.getId(), 1701, true);
}
Also used : JobDefinition(org.camunda.bpm.engine.management.JobDefinition) Test(org.junit.Test)

Example 87 with JobDefinition

use of org.camunda.bpm.engine.management.JobDefinition in project camunda-bpm-platform by camunda.

the class MultiTenancyJobCmdsTenantCheckTest method testSetOverridingJobPriorityWithCascadeAndAuthenticatedTenant.

// setOverridingJobPriority with cascade
@Test
public void testSetOverridingJobPriorityWithCascadeAndAuthenticatedTenant() {
    JobDefinition jobDefinition = managementService.createJobDefinitionQuery().list().get(0);
    identityService.setAuthentication("aUserId", null, Arrays.asList(TENANT_ONE));
    managementService.setOverridingJobPriorityForJobDefinition(jobDefinition.getId(), 1701, true);
    // then
    assertThat(managementService.createJobDefinitionQuery().jobDefinitionId(jobDefinition.getId()).singleResult().getOverridingJobPriority(), is(1701L));
}
Also used : JobDefinition(org.camunda.bpm.engine.management.JobDefinition) Test(org.junit.Test)

Example 88 with JobDefinition

use of org.camunda.bpm.engine.management.JobDefinition in project camunda-bpm-platform by camunda.

the class MultiTenancyJobCmdsTenantCheckTest method testSetOverridingJobPriorityWithAuthenticatedTenant.

// setOverridingJobPriorityForJobDefinition without cascade
@Test
public void testSetOverridingJobPriorityWithAuthenticatedTenant() {
    JobDefinition jobDefinition = managementService.createJobDefinitionQuery().list().get(0);
    identityService.setAuthentication("aUserId", null, Arrays.asList(TENANT_ONE));
    managementService.setOverridingJobPriorityForJobDefinition(jobDefinition.getId(), 1701);
    // then
    assertThat(managementService.createJobDefinitionQuery().jobDefinitionId(jobDefinition.getId()).singleResult().getOverridingJobPriority(), is(1701L));
}
Also used : JobDefinition(org.camunda.bpm.engine.management.JobDefinition) Test(org.junit.Test)

Example 89 with JobDefinition

use of org.camunda.bpm.engine.management.JobDefinition in project camunda-bpm-platform by camunda.

the class MultiTenancyJobCmdsTenantCheckTest method testSetOverridingJobPriorityWithDisabledTenantCheck.

@Test
public void testSetOverridingJobPriorityWithDisabledTenantCheck() {
    JobDefinition jobDefinition = managementService.createJobDefinitionQuery().list().get(0);
    identityService.setAuthentication("aUserId", null);
    engineRule.getProcessEngineConfiguration().setTenantCheckEnabled(false);
    managementService.setOverridingJobPriorityForJobDefinition(jobDefinition.getId(), 1701);
    // then
    assertThat(managementService.createJobDefinitionQuery().jobDefinitionId(jobDefinition.getId()).singleResult().getOverridingJobPriority(), is(1701L));
}
Also used : JobDefinition(org.camunda.bpm.engine.management.JobDefinition) Test(org.junit.Test)

Example 90 with JobDefinition

use of org.camunda.bpm.engine.management.JobDefinition in project camunda-bpm-platform by camunda.

the class BatchMigrationTest method testSeedJobCreation.

@Test
public void testSeedJobCreation() {
    // when
    Batch batch = helper.migrateProcessInstancesAsync(10);
    // then there exists a seed job definition with the batch id as configuration
    JobDefinition seedJobDefinition = helper.getSeedJobDefinition(batch);
    assertNotNull(seedJobDefinition);
    assertEquals(batch.getId(), seedJobDefinition.getJobConfiguration());
    assertEquals(BatchSeedJobHandler.TYPE, seedJobDefinition.getJobType());
    // and there exists a migration job definition
    JobDefinition migrationJobDefinition = helper.getExecutionJobDefinition(batch);
    assertNotNull(migrationJobDefinition);
    assertEquals(Batch.TYPE_PROCESS_INSTANCE_MIGRATION, migrationJobDefinition.getJobType());
    // and a seed job with no relation to a process or execution etc.
    Job seedJob = helper.getSeedJob(batch);
    assertNotNull(seedJob);
    assertEquals(seedJobDefinition.getId(), seedJob.getJobDefinitionId());
    assertNull(seedJob.getDuedate());
    assertNull(seedJob.getDeploymentId());
    assertNull(seedJob.getProcessDefinitionId());
    assertNull(seedJob.getProcessDefinitionKey());
    assertNull(seedJob.getProcessInstanceId());
    assertNull(seedJob.getExecutionId());
    // but no migration jobs where created
    List<Job> migrationJobs = helper.getExecutionJobs(batch);
    assertEquals(0, migrationJobs.size());
}
Also used : Batch(org.camunda.bpm.engine.batch.Batch) Job(org.camunda.bpm.engine.runtime.Job) JobDefinition(org.camunda.bpm.engine.management.JobDefinition) Test(org.junit.Test)

Aggregations

JobDefinition (org.camunda.bpm.engine.management.JobDefinition)219 Job (org.camunda.bpm.engine.runtime.Job)135 Deployment (org.camunda.bpm.engine.test.Deployment)112 JobDefinitionQuery (org.camunda.bpm.engine.management.JobDefinitionQuery)86 JobQuery (org.camunda.bpm.engine.runtime.JobQuery)73 HashMap (java.util.HashMap)67 ProcessDefinition (org.camunda.bpm.engine.repository.ProcessDefinition)64 Test (org.junit.Test)63 Batch (org.camunda.bpm.engine.batch.Batch)28 ProcessInstance (org.camunda.bpm.engine.runtime.ProcessInstance)16 Date (java.util.Date)11 InputStream (java.io.InputStream)8 Deployment (org.camunda.bpm.engine.repository.Deployment)8 DeploymentBuilder (org.camunda.bpm.engine.repository.DeploymentBuilder)8 HistoricDecisionInstanceQuery (org.camunda.bpm.engine.history.HistoricDecisionInstanceQuery)6 UserOperationLogEntry (org.camunda.bpm.engine.history.UserOperationLogEntry)4 ScenarioUnderTest (org.camunda.bpm.qa.upgrade.ScenarioUnderTest)4 HistoricIncident (org.camunda.bpm.engine.history.HistoricIncident)3 CommandExecutor (org.camunda.bpm.engine.impl.interceptor.CommandExecutor)3 Response (com.jayway.restassured.response.Response)2