Search in sources :

Example 1 with JobRecord

use of io.zeebe.exporter.proto.Schema.JobRecord in project zeebe-exporter-protobuf by camunda-community-hub.

the class RecordTransformTest method shouldTransformJob.

@Test
public void shouldTransformJob() {
    // given
    final JobRecordValue jobRecordValue = mockJobRecordValue();
    final Record<JobRecordValue> mockedRecord = mockRecord(jobRecordValue, ValueType.JOB, JobIntent.CREATED);
    // when
    final Schema.JobRecord jobRecord = (Schema.JobRecord) RecordTransformer.toProtobufMessage(mockedRecord);
    // then
    assertMetadata(jobRecord.getMetadata(), "JOB", "CREATED");
    assertJobRecord(jobRecord);
}
Also used : JobRecordValue(io.camunda.zeebe.protocol.record.value.JobRecordValue) JobRecord(io.zeebe.exporter.proto.Schema.JobRecord) JobRecord(io.zeebe.exporter.proto.Schema.JobRecord) Test(org.junit.Test)

Example 2 with JobRecord

use of io.zeebe.exporter.proto.Schema.JobRecord in project zeebe-exporter-protobuf by camunda-community-hub.

the class RecordTransformTest method shouldTransformJobBatch.

@Test
public void shouldTransformJobBatch() {
    // given
    final JobBatchRecordValue jobBatchRecordValue = mockJobBatchRecordValue();
    final Record<JobBatchRecordValue> mockedRecord = mockRecord(jobBatchRecordValue, ValueType.JOB_BATCH, JobBatchIntent.ACTIVATED);
    // when
    final Schema.JobBatchRecord jobBatchRecord = (Schema.JobBatchRecord) RecordTransformer.toProtobufMessage(mockedRecord);
    // then
    assertMetadata(jobBatchRecord.getMetadata(), "JOB_BATCH", "ACTIVATED");
    assertThat(jobBatchRecord.getJobKeysList()).containsExactly(5L);
    assertThat(jobBatchRecord.getMaxJobsToActivate()).isEqualTo(1);
    assertThat(jobBatchRecord.getTimeout()).isEqualTo(1_000L);
    assertThat(jobBatchRecord.getType()).isEqualTo("jobType");
    assertThat(jobBatchRecord.getWorker()).isEqualTo("myveryownworker");
    assertThat(jobBatchRecord.getTruncated()).isTrue();
    assertThat(jobBatchRecord.getJobsList()).hasSize(1);
    final JobRecord jobRecord = jobBatchRecord.getJobsList().get(0);
    assertJobRecord(jobRecord);
}
Also used : JobBatchRecordValue(io.camunda.zeebe.protocol.record.value.JobBatchRecordValue) JobRecord(io.zeebe.exporter.proto.Schema.JobRecord) Test(org.junit.Test)

Aggregations

JobRecord (io.zeebe.exporter.proto.Schema.JobRecord)2 Test (org.junit.Test)2 JobBatchRecordValue (io.camunda.zeebe.protocol.record.value.JobBatchRecordValue)1 JobRecordValue (io.camunda.zeebe.protocol.record.value.JobRecordValue)1