Skip to content

Commit

Permalink
revert(provider): scope variables to current element
Browse files Browse the repository at this point in the history
This reverts commit db4efee.

related to camunda/camunda-modeler#3728
  • Loading branch information
marstamm committed Aug 17, 2023
1 parent 8fc97bb commit 71723ef
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 68 deletions.
11 changes: 1 addition & 10 deletions lib/variableProvider/ExampleJsonProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,7 @@ export class ExampleJsonProvider extends VariableProvider {
}

const parsedData = getVariablesFromString(data);

// Scope data to current element only
const result = parsedData.map(variable => {
return {
...variable,
scope: element
};
});

return result;
return parsedData;
}
}

Expand Down
9 changes: 3 additions & 6 deletions test/fixtures/simple.bpmn
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
<?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:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:zeebe="http://camunda.org/schema/zeebe/1.0" xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_0uo7yqr" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="5.10.0" modeler:executionPlatform="Camunda Cloud" modeler:executionPlatformVersion="8.1.0">
<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:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:zeebe="http://camunda.org/schema/zeebe/1.0" xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_0uo7yqr" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="5.9.0-dev" modeler:executionPlatform="Camunda Cloud" modeler:executionPlatformVersion="8.1.0">
<bpmn:process id="Process_1" isExecutable="true">
<bpmn:startEvent id="StartEvent_1">
<bpmn:extensionElements>
<zeebe:properties>
<zeebe:property name="camundaModeler:exampleOutputJson" value="{&#10; &#34;startData&#34;: {&#10; &#34;foobar&#34;: 15&#10; }&#10;}" />
<zeebe:property name="camundaModeler:exampleOutputJson" value="{&#10; &#34;startData&#34;: &#34;foobar&#34; &#10;}" />
</zeebe:properties>
<zeebe:ioMapping>
<zeebe:output source="=startData" target="mappedStartData" />
</zeebe:ioMapping>
</bpmn:extensionElements>
<bpmn:outgoing>Flow_16gvdav</bpmn:outgoing>
</bpmn:startEvent>
Expand Down Expand Up @@ -48,4 +45,4 @@
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>
</bpmn:definitions>
35 changes: 5 additions & 30 deletions test/spec/integration.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,43 +137,18 @@ describe('Integration', function() {

beforeEach(() => createModeler(simpleXML));

it('should scope variables to element', inject(async function(elementRegistry, variableResolver) {
it('should supply variables to variableResolver', inject(async function(elementRegistry, variableResolver) {

// given
const process = elementRegistry.get('Process_1');
const task = elementRegistry.get('ServiceTask_1');

// when
const variables = await variableResolver.getProcessVariables(process);
const variables = await variableResolver.getVariablesForElement(task);

// then
expect(variables).to.variableEqual([
{ name: 'output', type: 'Number', scope: 'ServiceTask_1' },
{ name: 'startData', type: 'Context', scope: 'StartEvent_1' },
{ name: 'mappedStartData', type: 'Context', scope: 'Process_1' },
]);
}));


it('should keep info through mappings', inject(async function(elementRegistry, variableResolver) {

// given
const process = elementRegistry.get('Process_1');

// when
const variables = await variableResolver.getVariablesForElement(process);

// then
expect(variables).to.variableEqual([
{
name: 'mappedStartData',
type: 'Context',
entries: [
{
name: 'foobar',
type: 'Number'
}
]
}
{ name: 'output', type: 'Number' },
{ name: 'startData', type: 'String' }
]);
}));

Expand Down
22 changes: 0 additions & 22 deletions test/spec/variableProvider.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,28 +120,6 @@ describe('variable-provider', function() {
});


it('should scope variables to element', function() {

// given
const variables = JSON.stringify({
string: 'string',
});

const element = createElementWithVariables(variables);

// when
const result = provider.getVariables(element);

// then
expect(result).to.variableEqual([
{
name: 'string',
scope: element.id
}
]);
});


it('should NOT break with malformed JSON', function() {

// given
Expand Down

0 comments on commit 71723ef

Please sign in to comment.