use of org.kie.kogito.jobs.api.Job in project kogito-apps by kiegroup.
the class BaseJobResourceIT method getAfterCreate.
@Test
void getAfterCreate() throws Exception {
final String id = "3";
final Job job = getJob(id);
create(jobToJson(job));
assertGetScheduledJob(id);
}
use of org.kie.kogito.jobs.api.Job in project kogito-apps by kiegroup.
the class BaseJobResourceIT method patchInvalidAttributesTest.
@Test
void patchInvalidAttributesTest() throws Exception {
final String id = UUID.randomUUID().toString();
final Job job = getJob(id);
create(jobToJson(job));
final String newCallbackEndpoint = "http://localhost/newcallback";
Job toPatch = JobBuilder.builder().callbackEndpoint(newCallbackEndpoint).build();
assertPatch(id, toPatch, 500);
toPatch = JobBuilder.builder().processId(UUID.randomUUID().toString()).build();
assertPatch(id, toPatch, 500);
toPatch = JobBuilder.builder().rootProcessId(UUID.randomUUID().toString()).build();
assertPatch(id, toPatch, 500);
toPatch = JobBuilder.builder().rootProcessInstanceId(UUID.randomUUID().toString()).build();
assertPatch(id, toPatch, 500);
toPatch = JobBuilder.builder().processInstanceId(UUID.randomUUID().toString()).build();
assertPatch(id, toPatch, 500);
toPatch = JobBuilder.builder().priority(10).build();
assertPatch(id, toPatch, 500);
toPatch = JobBuilder.builder().repeatLimit(1).repeatInterval(1l).build();
assertPatch(id, toPatch, 200);
}
use of org.kie.kogito.jobs.api.Job in project kogito-apps by kiegroup.
the class BaseJobResourceIT method patchInvalidIdPathTest.
@Test
void patchInvalidIdPathTest() throws Exception {
final String id = UUID.randomUUID().toString();
final Job job = getJob(id);
create(jobToJson(job));
Job toPatch = JobBuilder.builder().expirationTime(DateUtil.now()).build();
// not found id on path
assertPatch("invalid", toPatch, 404);
// different id on the job object from path id
toPatch = JobBuilder.builder().id("differentId").build();
assertPatch(id, toPatch, 500);
}
use of org.kie.kogito.jobs.api.Job in project kogito-apps by kiegroup.
the class BaseKeycloakJobServiceIT method getAfterCreate.
@Test
void getAfterCreate() throws Exception {
final String id = "3";
final Job job = getJob(id);
createJob(jobToJson(job), getAccessToken("jdoe"), OK_CODE);
given().pathParam("id", id).when().get(JobResource.JOBS_PATH + "/{id}").then().statusCode(FORBIDDEN_CODE);
given().auth().oauth2(getAccessToken("alice")).pathParam("id", id).when().get(JobResource.JOBS_PATH + "/{id}").then().statusCode(UNAUTHORIZED_CODE);
final ScheduledJob scheduledJob = given().auth().oauth2(getAccessToken("jdoe")).pathParam("id", id).when().get(JobResource.JOBS_PATH + "/{id}").then().statusCode(OK_CODE).contentType(ContentType.JSON).assertThat().extract().as(ScheduledJob.class);
assertEquals(scheduledJob.getId(), job.getId());
}
use of org.kie.kogito.jobs.api.Job in project kogito-apps by kiegroup.
the class BaseKeycloakJobServiceIT method create.
@Test
void create() throws Exception {
final Job job = getJob("1");
createJob(jobToJson(job), getAccessToken("alice"), UNAUTHORIZED_CODE);
createJob(jobToJson(job), "", FORBIDDEN_CODE);
final ScheduledJob response = createJob(jobToJson(job), getAccessToken("jdoe"), OK_CODE).extract().as(ScheduledJob.class);
assertEquals(job, response);
}
Aggregations