Skip to content

Commit

Permalink
Updated with Junit Test, CoverageBuilderJavaBridge Class and bump to 0.6
Browse files Browse the repository at this point in the history
CoverageBuilderJavaBridge class provides a empty groovy class that implements the groovy trait, which allows Junit Java implementations to run the coverage generation
  • Loading branch information
StephenOTT committed Aug 29, 2018
1 parent 840447b commit 06947a0
Show file tree
Hide file tree
Showing 4 changed files with 96 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.github.digitalstate</groupId>
<artifactId>camunda-coverage-genertion-groovy</artifactId>
<version>v0.5</version>
<version>v0.6</version>
<packaging>jar</packaging>
<name>Camunda Converage Generation Groovy</name>

Expand Down Expand Up @@ -181,5 +181,12 @@
<scope>test</scope>
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
<version>4.11</version>
</dependency>

</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package io.digitalstate.camunda.coverage.bpmn


class CoverageBuilderJavaBridge implements CoverageBuilder {

}
44 changes: 44 additions & 0 deletions src/test/java/coveragetest/SimpleTestCase.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package coveragetest;

import io.digitalstate.camunda.coverage.bpmn.CoverageBuilderJavaBridge;
import org.camunda.bpm.engine.runtime.ProcessInstance;
import org.camunda.bpm.engine.test.Deployment;
import org.camunda.bpm.engine.test.ProcessEngineRule;

import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.*;

import org.junit.Rule;
import org.junit.Test;

/**
* @author Daniel Meyer
* @author Martin Schimak
*/
public class SimpleTestCase {

@Rule
public ProcessEngineRule rule = new ProcessEngineRule("camunda_config/camunda.cfg.xml");
CoverageBuilderJavaBridge coverageBuilder = new CoverageBuilderJavaBridge();

@Test
@Deployment(resources = {"testProcess.bpmn"})
public void shouldExecuteProcess() {
// Given we create a new process instance
ProcessInstance processInstance = runtimeService().startProcessInstanceByKey("testProcess");
// Then it should be active
assertThat(processInstance).isActive();
// And it should be the only instance
assertThat(processInstanceQuery().count()).isEqualTo(1);
// And there should exist just a single task within that process instance
assertThat(task(processInstance)).isNotNull();

// When we complete that task
complete(task(processInstance));
// Then the process instance should be ended
assertThat(processInstance).isEnded();
coverageBuilder.coverageSnapshot(processInstance);
coverageBuilder.saveCoverageSnapshots();

}

}
38 changes: 38 additions & 0 deletions src/test/resources/testProcess.bpmn
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="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" id="_7FrToMrfEeOyYYI9xhG4Cw" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.7.0-nightly" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
<bpmn2:process id="testProcess" isExecutable="true">
<bpmn2:startEvent id="StartEvent_1">
<bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing>
</bpmn2:startEvent>
<bpmn2:userTask id="UserTask_1" name="Handle &#10;Request">
<bpmn2:incoming>SequenceFlow_1</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_2</bpmn2:outgoing>
</bpmn2:userTask>
<bpmn2:sequenceFlow id="SequenceFlow_1" name="" sourceRef="StartEvent_1" targetRef="UserTask_1" />
<bpmn2:endEvent id="EndEvent_1">
<bpmn2:incoming>SequenceFlow_2</bpmn2:incoming>
</bpmn2:endEvent>
<bpmn2:sequenceFlow id="SequenceFlow_2" name="" sourceRef="UserTask_1" targetRef="EndEvent_1" />
</bpmn2:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="testProcess">
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_3" bpmnElement="StartEvent_1">
<dc:Bounds x="247" y="204" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_UserTask_2" bpmnElement="UserTask_1">
<dc:Bounds x="333" y="182" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_1" bpmnElement="SequenceFlow_1" sourceElement="_BPMNShape_StartEvent_3" targetElement="_BPMNShape_UserTask_2">
<di:waypoint xsi:type="dc:Point" x="283" y="222" />
<di:waypoint xsi:type="dc:Point" x="333" y="222" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="_BPMNShape_EndEvent_2" bpmnElement="EndEvent_1">
<dc:Bounds x="483" y="204" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_2" bpmnElement="SequenceFlow_2" sourceElement="_BPMNShape_UserTask_2" targetElement="_BPMNShape_EndEvent_2">
<di:waypoint xsi:type="dc:Point" x="433" y="222" />
<di:waypoint xsi:type="dc:Point" x="483" y="222" />
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn2:definitions>

0 comments on commit 06947a0

Please sign in to comment.