Business Process Automation With Codebeamer & Groovy (Updated)
Business Process Automation With Codebeamer & Groovy (Updated)
Business Process
Automation
O. David
Colorado State University
Dept. of Civil Engineering, Dept. of Computer Science
US Department of Agriculture
Objective
Automate and integrate software project
management practices using CB with respect
to
◦ Trackers
◦ Forums
◦ Builds
◦ Documents
◦ Users
use(TimeCategory) {
needsBuild = proj.trackers.find{it.name ==“Bugs"}.issues.any{
bug -> bug.status == "Fixed" && bug.submitted < 30.days.ago
&& bug.priority> LOW && bug.hasCommits
}
if (needsBuild) {
println “Starting build ....“
log = proj.builds.find{it.name == “BuildApp"}.invoke()
println " Build done: ${log.status} “
println " Output: ${log.stdOut} "
}
}
jf.logout();
cbscript
cb-api CB Server
Java API
-Low level, session centric, stateless
-For a wide range of applications
Docs DB SCM
// do some work.
jf.logout();
// find project(s)
assert jf.projects.find{it.name == "Moose"}.id == 2374
assert jf.projects.find{it.id == 2374}.name == "Moose“
// direct
jf.project(‘Moose’)
bugTracker.issues.findAll{
it.status != 'Closed'
}.each{
println it.name
}
bugs.submit(summary:"My Bug",
text:"This is a new Bug", priority:NORMAL)
bug.attach(file:”/tmp/spec-1.txt”)
newsForum.findAll{
post -> post.submitted > 8.hours.ago
}.each{
print it.text
}
news.post(subject:"New message",
text:"Content here ...")
new File('c:/tmp/test1').withOutputStream {
it.write doc.bytes
}
bug.relate(lib, RELATED)
String wikitext =
“””!!Milestone info
* Output Log Reference: ${CB.link(result)}
“””
// resolves to:
// “ Output Log Reference : [BUILDLOG:23456]”
Direct access to a
project/forum/tracker/issue/post/build/.. using its
‘Id’ or ‘name’ (projects only)
No traversing all higher level resources
necessary -> very efficient, but you need to
know the ID!!!
Resource Access Efficiency vs. Query Flexibility
Olaf David, CSU/USDA 30
Examples*
Problem elevation
SCRUM support
SCM commit control
Auditable Build Management
Tracker Status Statistics
Benefit
◦ Early problem detection, identification, and
communication
Benefit
◦ SCRUM coverage
◦ Sprint meeting preparation
println map
// [-7:10, -6:3, -5:12, -4:4, -3:10, -2:5, -1:1, 0:2]
f = new File(“burndown.dat”)
today = new Date()
f.append("${today} , ${hours}")
Benefit
◦ This developer’s shortcut saves time
DE Feature Implemente
d
V Requests
Commit
assoc.
Commi
t
Update
Push
Pull
SC
Repo M
// login to CB
jf = CB.login("http://localhost:8080", "bond", “pass")
...
Feature
Identif
y (2
DE MG
V Requests ) R
Milestones
Build-lib
SC
M
Docume
nts
DE Feature
Requests MG
V
Issue
(3 R
Milestones
build
)
3.2
Build-lib build
3.3
log
3.1
SC
checkout/update M
3.4
<cbrelease
Docume
nts
// build check
if (!readyList.empty) {
...
DE Feature
V Requests New milestone
build
(4 MG
R
)
Milestones
Build-lib
SC
M
Docume
nts
Build-lib
SC
M
Docume
nts
SC
M
ngmf.jar
Docume
nts
// build check
if (!readyList.empty) {
...
// chart
def chart = ChartFactory.createPieChart(“Bug Tracker Status", data,
false, true, true)
chart.plot.labelGenerator = new LG(' {0} - {1} ({2}) ')
// frame
def frame = new SwingBuilder().frame(title:’PieChart',
defaultCloseOperation:WC.EXIT_ON_CLOSE) {
widget(new ChartPanel(chart))
}
frame.pack()
frame.show()