This repository has been archived by the owner on Apr 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #313 from camunda-community-hub:8.2.1
8.2.1
- Loading branch information
Showing
11 changed files
with
300 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import { ZBClient } from '../..' | ||
// import { createUniqueTaskType } from '../../lib/createUniqueTaskType' | ||
import { CreateProcessInstanceResponse } from '../../lib/interfaces-grpc-1.0' | ||
|
||
process.env.ZEEBE_NODE_LOG_LEVEL = process.env.ZEEBE_NODE_LOG_LEVEL || 'NONE' | ||
jest.setTimeout(60000) | ||
|
||
|
||
let zbc: ZBClient | ||
let wf: CreateProcessInstanceResponse | undefined | ||
|
||
beforeEach(() => { | ||
zbc = new ZBClient() | ||
}) | ||
|
||
afterEach(async () => { | ||
try { | ||
if (wf?.processInstanceKey) { | ||
await zbc.cancelProcessInstance(wf.processInstanceKey) | ||
} | ||
} catch (e: any) { | ||
// console.log('Caught NOT FOUND') // @DEBUG | ||
} finally { | ||
await zbc.close() // Makes sure we don't forget to close connection | ||
} | ||
}) | ||
|
||
test('Can start a process with a signal', () => new Promise(async resolve => { | ||
zbc.createWorker({ | ||
taskType: 'signal-service-task', | ||
taskHandler: job => { | ||
const ack = job.complete() | ||
expect (job.variables.success).toBe(true) | ||
resolve(null) | ||
return ack | ||
} | ||
}) | ||
await zbc.deployResource({ | ||
processFilename: `./src/__tests__/testdata/Signal.bpmn` | ||
}) | ||
const res = await zbc.broadcastSignal({ | ||
signalName: 'test-signal', | ||
variables: { | ||
success: true | ||
} | ||
}) | ||
expect(res.key).toBeTruthy() | ||
}) | ||
) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { v4 as uuid } from 'uuid' | ||
import { ZBClient } from '../..' | ||
import { createUniqueTaskType } from '../../lib/createUniqueTaskType' | ||
|
||
process.env.ZEEBE_NODE_LOG_LEVEL = process.env.ZEEBE_NODE_LOG_LEVEL || 'NONE' | ||
jest.setTimeout(45000) | ||
let zbc: ZBClient | ||
|
||
beforeEach(async () => { | ||
zbc = new ZBClient() | ||
}) | ||
|
||
afterEach(async () => { | ||
await zbc.close() | ||
}) | ||
|
||
test('Can publish a message', () => | ||
new Promise(async done => { | ||
const { bpmn, taskTypes, processId, messages } = createUniqueTaskType({ | ||
bpmnFilePath: './src/__tests__/testdata/Client-MessageStart.bpmn', | ||
messages: ['MSG-START_JOB'], | ||
taskTypes: ['console-log-msg-start'], | ||
}) | ||
|
||
const deploy = await zbc.deployProcess({ | ||
definition: bpmn, | ||
name: `Client-MessageStart-${processId}.bpmn`, | ||
}) | ||
expect(deploy.key).toBeTruthy() | ||
|
||
const randomId = uuid() | ||
|
||
// Wait 1 second to make sure the deployment is complete | ||
await new Promise(res => setTimeout(() => res(null), 1000)) | ||
|
||
await zbc.publishMessage({ | ||
name: messages['MSG-START_JOB'], | ||
variables: { | ||
testKey: randomId, | ||
}, | ||
correlationKey: 'something' | ||
}) | ||
|
||
zbc.createWorker({ | ||
taskType: taskTypes['console-log-msg-start'], | ||
taskHandler: async job => { | ||
const res = await job.complete() | ||
expect(job.variables.testKey).toBe(randomId) // Makes sure the worker isn't responding to another message | ||
done(null) | ||
return res | ||
}, | ||
loglevel: 'NONE', | ||
}) | ||
})) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:zeebe="http://camunda.org/schema/zeebe/1.0" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_0ifk6nh" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="5.10.0" modeler:executionPlatform="Camunda Cloud" modeler:executionPlatformVersion="8.2.0"> | ||
<bpmn:process id="Signal" name="Signal" isExecutable="true"> | ||
<bpmn:startEvent id="StartEvent_1" name="Start"> | ||
<bpmn:outgoing>Flow_0dwell7</bpmn:outgoing> | ||
<bpmn:signalEventDefinition id="SignalEventDefinition_01pvmb3" signalRef="Signal_3c1lk35" /> | ||
</bpmn:startEvent> | ||
<bpmn:sequenceFlow id="Flow_0dwell7" sourceRef="StartEvent_1" targetRef="Activity_0iq5pp7" /> | ||
<bpmn:endEvent id="Event_0jluwfy" name="End"> | ||
<bpmn:incoming>Flow_16lx2ly</bpmn:incoming> | ||
</bpmn:endEvent> | ||
<bpmn:sequenceFlow id="Flow_16lx2ly" sourceRef="Activity_0iq5pp7" targetRef="Event_0jluwfy" /> | ||
<bpmn:serviceTask id="Activity_0iq5pp7" name="Signal Service Task"> | ||
<bpmn:extensionElements> | ||
<zeebe:taskDefinition type="signal-service-task" /> | ||
</bpmn:extensionElements> | ||
<bpmn:incoming>Flow_0dwell7</bpmn:incoming> | ||
<bpmn:outgoing>Flow_16lx2ly</bpmn:outgoing> | ||
</bpmn:serviceTask> | ||
</bpmn:process> | ||
<bpmn:signal id="Signal_3c1lk35" name="test-signal" /> | ||
<bpmndi:BPMNDiagram id="BPMNDiagram_1"> | ||
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Signal"> | ||
<bpmndi:BPMNShape id="Event_164ft84_di" bpmnElement="StartEvent_1"> | ||
<dc:Bounds x="179" y="99" width="36" height="36" /> | ||
<bpmndi:BPMNLabel> | ||
<dc:Bounds x="185" y="142" width="24" height="14" /> | ||
</bpmndi:BPMNLabel> | ||
</bpmndi:BPMNShape> | ||
<bpmndi:BPMNShape id="Event_0jluwfy_di" bpmnElement="Event_0jluwfy"> | ||
<dc:Bounds x="432" y="99" width="36" height="36" /> | ||
<bpmndi:BPMNLabel> | ||
<dc:Bounds x="440" y="142" width="20" height="14" /> | ||
</bpmndi:BPMNLabel> | ||
</bpmndi:BPMNShape> | ||
<bpmndi:BPMNShape id="Activity_1vptiif_di" bpmnElement="Activity_0iq5pp7"> | ||
<dc:Bounds x="270" y="77" width="100" height="80" /> | ||
<bpmndi:BPMNLabel /> | ||
</bpmndi:BPMNShape> | ||
<bpmndi:BPMNEdge id="Flow_0dwell7_di" bpmnElement="Flow_0dwell7"> | ||
<di:waypoint x="215" y="117" /> | ||
<di:waypoint x="270" y="117" /> | ||
</bpmndi:BPMNEdge> | ||
<bpmndi:BPMNEdge id="Flow_16lx2ly_di" bpmnElement="Flow_16lx2ly"> | ||
<di:waypoint x="370" y="117" /> | ||
<di:waypoint x="432" y="117" /> | ||
</bpmndi:BPMNEdge> | ||
</bpmndi:BPMNPlane> | ||
</bpmndi:BPMNDiagram> | ||
</bpmn:definitions> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.