Skip to content

Commit

Permalink
Cleanup + bpmnjs file refinements + version bump
Browse files Browse the repository at this point in the history
- Cleaned up spacing
- Refined code that generates the local bpmnjs file so that only 1 version of the file is used. The bpmnjs folder is not located in the parent of the bpmn-coverage folder, rather than a copy of the bpmnjs file being located in each test folder.
- version upped to 0.8
- Updated readme with new version number
  • Loading branch information
StephenOTT committed Sep 13, 2018
1 parent 2f043d3 commit 615901f
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 36 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ Then add the following dependency:
<dependency>
<groupId>com.github.digitalstate</groupId>
<artifactId>camunda-coverage-generation-groovy</artifactId>
<version>v0.7</version>
<version>v0.8</version>
<scope>test</scope>
</dependency>
```
Expand Down
2 changes: 1 addition & 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.7</version>
<version>v0.8</version>
<packaging>jar</packaging>
<name>Camunda Converage Generation Groovy</name>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ trait CoverageBuilder implements TemplateGeneration{
// generate a folder name based on the calling class (the Test class name) - fully qualified
String folderName = ReflectionUtils.getCallingClass(2).getName()

// @TODO implement lots of cleanup around how CDN vs local file generation is implemented in this method and the coveragebulder/templateGeneration traits
// @TODO implement lots of cleanup around how CDN vs local file generation is implemented in this method and the coveragebulder/templateGeneration traits
if (!useCdn) {
setUseBpmnViewerCdn(false)
URL bpmnjsResource = getClass().getResource(getLocalBpmnViewerPath())
Expand All @@ -46,16 +46,14 @@ trait CoverageBuilder implements TemplateGeneration{

treeBuilder {
"${buildDir}" {
"bpmn-coverage" {
"${folderName}" {
"bpmnjs" {
file(bpmnJsFileName, bpmnJsInputStream.getText('UTF-8'))
}
}
"bpmn-coverage" {
"bpmnjs" {
file(bpmnJsFileName, bpmnJsInputStream.getText('UTF-8'))
}
}
}
}
}

data.eachWithIndex { key, value, index ->
// Generate the compiled template using the CoverageData
Expand Down Expand Up @@ -183,17 +181,17 @@ trait CoverageBuilder implements TemplateGeneration{
String processInstanceId = processInstance.getProcessInstanceId()

Collection<HistoricDetail> variableHistory = historyService().createHistoricDetailQuery()
.processInstanceId(processInstanceId)
.disableBinaryFetching()
.variableUpdates()
.list()
.processInstanceId(processInstanceId)
.disableBinaryFetching()
.variableUpdates()
.list()

ArrayList<Map<String, Object>> activityVariableMappings = variableHistory.collect { historyItem ->
[('activityId'): historyService().createHistoricActivityInstanceQuery()
.processInstanceId(processInstanceId)
.activityInstanceId(historyItem.getActivityInstanceId())
.singleResult()
.getActivityId(),
.processInstanceId(processInstanceId)
.activityInstanceId(historyItem.getActivityInstanceId())
.singleResult()
.getActivityId(),
('variableInstance') : historyItem.toString()
]
}
Expand All @@ -220,30 +218,30 @@ trait CoverageBuilder implements TemplateGeneration{
return coverageData
}

String compileTemplate(CoverageData coverageData){
def head = generateTemplateHead()
def body = generateTemplateBody(
"${UUID.randomUUID().toString().replaceAll("\\W", "")}", // Creates a UUID for the coverage name for uniqueness and removes all hyphens
coverageData.bpmnModel,
toJson(coverageData.modelUserTasks),
toJson(coverageData.activityInstancesFinished),
toJson(coverageData.sequenceFlowsFinished),
toJson(coverageData.modelAsyncData),
toJson(coverageData.modelReceiveTasks),
toJson(coverageData.modelExternalTasks),
toJson(coverageData.modelIntermediateCatchEvents),
toJson(coverageData.activityInstancesUnfinished),
toJson(coverageData.activityInstanceVariableMapping)
)
def footer = generateTemplateFooter()
String compileTemplate(CoverageData coverageData){
def head = generateTemplateHead()
def body = generateTemplateBody(
"${UUID.randomUUID().toString().replaceAll("\\W", "")}", // Creates a UUID for the coverage name for uniqueness and removes all hyphens
coverageData.bpmnModel,
toJson(coverageData.modelUserTasks),
toJson(coverageData.activityInstancesFinished),
toJson(coverageData.sequenceFlowsFinished),
toJson(coverageData.modelAsyncData),
toJson(coverageData.modelReceiveTasks),
toJson(coverageData.modelExternalTasks),
toJson(coverageData.modelIntermediateCatchEvents),
toJson(coverageData.activityInstancesUnfinished),
toJson(coverageData.activityInstanceVariableMapping)
)
def footer = generateTemplateFooter()
// @TODO Update Template Generation code to be a cleaner usage of scripting

return """
return """
${head}
${body}
${footer}
"""
}
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ trait TemplateGeneration{
if (this.useBpmnViewerCdn){
return this.bpmnViewerUrl
} else {
return ".${this.localBpmnViewerPath}"
return "..${this.localBpmnViewerPath}"
}
}

Expand Down

0 comments on commit 615901f

Please sign in to comment.