Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not find camunda:decisionRef change #2

Open
romero83 opened this issue Mar 8, 2017 · 9 comments
Open

Not find camunda:decisionRef change #2

romero83 opened this issue Mar 8, 2017 · 9 comments
Labels
backlog Queued in backlog bug Something isn't working

Comments

@romero83
Copy link

romero83 commented Mar 8, 2017

Hi!

The differ cannot find camunda:decisionRef changes.

Can it be that differ not works in case of camunda namespace?

@nikku
Copy link
Member

nikku commented Nov 28, 2017

May be fixed with latest version of this library.

If that is not the case, add a pull request with a failing test case and we can fix this.

@nikku nikku added the bug Something isn't working label Nov 28, 2017
nikku added a commit that referenced this issue Nov 28, 2017
This may happen when importing unknown extension namespaces, i.e.
<camunda> without the moddle definition (camunda-bpmn-moddle).

Related to #2
@romero83
Copy link
Author

Hi!

I upgraded to 0.3.0 version, but unfortunately it is still not tracing camunda:decisionRef changes nor input/output parameters.

@nikku
Copy link
Member

nikku commented Nov 28, 2017

You'd need to add the camunda-bpmn-moddle extension in order to recognize camunda attributes. See this failing test case I've created.

@romero83
Copy link
Author

romero83 commented Nov 28, 2017

Thank you nikku!

Now it trace camunda:decisionRef change indeed.

I Used as following:

var BpmnModdle = require('bpmn-moddle'),
    BpmnCamundaModdleDescriptor = require('camunda-bpmn-moddle/resources/camunda');

new BpmnModdle({
       camunda: BpmnCamundaModdleDescriptor
}).fromXML(xml, function(err, definitions) {
...
}

However it is still not tracing input/output parameter changes.

@nikku
Copy link
Member

nikku commented Nov 28, 2017

Make sure you use the latest version of bpmn-moddle, too. We're at 1.1.1 right now.

@romero83
Copy link
Author

Ok, when I call
Differ.diff(adefs, bdefs)
on the two parsed BPMNs it returns and indicate the input/output parameter "_changed", but I see no old-new values descriptor in the "attrs" property.

@nikku
Copy link
Member

nikku commented Nov 29, 2017

Please provide a reproducible test case, including

  • before diagram
  • after diagram
  • expected changes

Cf. this example

@romero83
Copy link
Author

romero83 commented Nov 29, 2017

test/fixtures/extension-attributes/before.bpmn

<?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:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.11.2">
  <bpmn:process id="Process_1" isExecutable="true">
    <bpmn:businessRuleTask id="BusinessRuleTask" camunda:resultVariable="foo" camunda:decisionRef="foobar" camunda:mapDecisionResult="collectEntries" camunda:decisionRefTenantId="_0001">
      <bpmn:extensionElements>
        <camunda:inputOutput>
          <camunda:inputParameter name="firstInput">in1</camunda:inputParameter>
          <camunda:outputParameter name="firstOutput">out1</camunda:outputParameter>
          <camunda:outputParameter name="secondOutput">out2</camunda:outputParameter>
        </camunda:inputOutput>
      </bpmn:extensionElements>
    </bpmn:businessRuleTask>
  </bpmn:process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1">
      <bpmndi:BPMNShape id="BusinessRuleTask_1lqeokr_di" bpmnElement="BusinessRuleTask">
        <dc:Bounds x="396" y="134" width="100" height="80" />
      </bpmndi:BPMNShape>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</bpmn:definitions>

test/fixtures/extension-attributes/after.bpmn

<?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:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.11.2">
  <bpmn:process id="Process_1" isExecutable="true">
    <bpmn:businessRuleTask id="BusinessRuleTask" camunda:decisionRef="foobar">
      <bpmn:extensionElements>
        <camunda:inputOutput>
          <camunda:inputParameter name="firstInput">in1_modify</camunda:inputParameter>
          <camunda:inputParameter name="secondInput">in2</camunda:inputParameter>
          <camunda:outputParameter name="secondOutput">out2modify</camunda:outputParameter>
        </camunda:inputOutput>
      </bpmn:extensionElements>
    </bpmn:businessRuleTask>
  </bpmn:process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1">
      <bpmndi:BPMNShape id="BusinessRuleTask_1lqeokr_di" bpmnElement="BusinessRuleTask">
        <dc:Bounds x="396" y="134" width="100" height="80" />
      </bpmndi:BPMNShape>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</bpmn:definitions>

test/spec/differ.js

it.only('should diff extension attributes', function(done) {

      var aDiagram = fs.readFileSync('test/fixtures/extension-attributes/before.bpmn', 'utf-8');
      var bDiagram = fs.readFileSync('test/fixtures/extension-attributes/after.bpmn', 'utf-8');      

      // when
      diff(aDiagram, bDiagram, function(err, results, aDefinitions, bDefinitions) {

        if (err) {
          return done(err);
        }

        // then
        expect(results._added).to.be.empty;
        expect(results._removed).to.be.empty;
        expect(results._layoutChanged).to.be.empty;
		for (var key in results._changed) {
			console.log("_changed: " + JSON.stringify(results._changed[key], null, '\t'));
		}
        expect(results._changed).to.have.keys([ 'BusinessRuleTask' ]);

        done();
      });
});

I modified also BpmnModdle creation in the top of test/deffer.js to diff camunda specific namespace.

var BpmnModdle = require('bpmn-moddle');
var BpmnCamundaModdleDescriptor = require('camunda-bpmn-moddle/resources/camunda');

var Differ = require('../../lib/differ'),
    SimpleChangeHandler = require('../../lib/change-handler');


function importDiagrams(a, b, done) {

  new BpmnModdle({
	  camunda: BpmnCamundaModdleDescriptor
  }).fromXML(a, function(err, adefs) {

    if (err) {
      return done(err);
    }

    new BpmnModdle({
	  camunda: BpmnCamundaModdleDescriptor
	}).fromXML(b, function(err, bdefs) {
      if (err) {
        return done(err);
      } else {
        return done(null, adefs, bdefs);
      }
    });
  });
}

When I execute npm run test it prints all changed properties, but no information about input/output parameter changes. However if you look at before/after BPMN files, I also changed input/output parameters but in the "attrs array" they are not found.

@nikku nikku added bug Something isn't working backlog Queued in backlog and removed bug Something isn't working backlog Queued in backlog labels Feb 15, 2018
@Egoplayer
Copy link

Hi,
is there any progress on this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backlog Queued in backlog bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants