rubyjobbuilderdsl 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -13
- data/Gemfile +6 -6
- data/Gemfile.lock +41 -41
- data/LICENSE +18 -18
- data/Rakefile +12 -12
- data/docs/common.md +313 -313
- data/docs/flow.md +17 -17
- data/docs/freestyle.md +100 -100
- data/docs/gerrit.md +70 -70
- data/docs/git.md +88 -88
- data/docs/multi.md +26 -26
- data/docs/overview.md +74 -74
- data/docs/postbuild.md +266 -266
- data/docs/view.md +13 -13
- data/lib/rubyjobbuilderdsl/buildstep/ant.rb +29 -29
- data/lib/rubyjobbuilderdsl/buildstep/copyartifact.rb +23 -23
- data/lib/rubyjobbuilderdsl/buildstep/inject_env.rb +18 -18
- data/lib/rubyjobbuilderdsl/buildstep/phase.rb +19 -19
- data/lib/rubyjobbuilderdsl/buildstep/phase_job.rb +26 -26
- data/lib/rubyjobbuilderdsl/buildstep/shell.rb +24 -24
- data/lib/rubyjobbuilderdsl/buildstep/xvfb.rb +46 -46
- data/lib/rubyjobbuilderdsl/common/artifactory.rb +33 -33
- data/lib/rubyjobbuilderdsl/common/blocking_job.rb +11 -11
- data/lib/rubyjobbuilderdsl/common/build_timeout.rb +23 -23
- data/lib/rubyjobbuilderdsl/common/gerrit.rb +53 -53
- data/lib/rubyjobbuilderdsl/common/git.rb +76 -76
- data/lib/rubyjobbuilderdsl/common/logrotate.rb +24 -24
- data/lib/rubyjobbuilderdsl/common/parameter.rb +22 -22
- data/lib/rubyjobbuilderdsl/common/password.rb +12 -12
- data/lib/rubyjobbuilderdsl/common/pollscm.rb +10 -10
- data/lib/rubyjobbuilderdsl/common/scms.rb +18 -18
- data/lib/rubyjobbuilderdsl/common/throttle.rb +24 -24
- data/lib/rubyjobbuilderdsl/common/timed.rb +10 -10
- data/lib/rubyjobbuilderdsl/common/timestamps.rb +6 -6
- data/lib/rubyjobbuilderdsl/common.rb +140 -140
- data/lib/rubyjobbuilderdsl/deployer.rb +95 -95
- data/lib/rubyjobbuilderdsl/flow.rb +14 -14
- data/lib/rubyjobbuilderdsl/freestyle.rb +65 -65
- data/lib/rubyjobbuilderdsl/jenkins_client.rb +203 -203
- data/lib/rubyjobbuilderdsl/multijob.rb +24 -24
- data/lib/rubyjobbuilderdsl/postbuild/archive.rb +23 -23
- data/lib/rubyjobbuilderdsl/postbuild/chucknorris_publisher.rb +6 -6
- data/lib/rubyjobbuilderdsl/postbuild/claim_publisher.rb +6 -6
- data/lib/rubyjobbuilderdsl/postbuild/cloverphp_publisher.rb +36 -36
- data/lib/rubyjobbuilderdsl/postbuild/cucumber_json_publisher.rb +20 -20
- data/lib/rubyjobbuilderdsl/postbuild/email_publisher.rb +23 -23
- data/lib/rubyjobbuilderdsl/postbuild/game_publisher.rb +6 -6
- data/lib/rubyjobbuilderdsl/postbuild/groovy.rb +10 -10
- data/lib/rubyjobbuilderdsl/postbuild/html_publisher.rb +27 -27
- data/lib/rubyjobbuilderdsl/postbuild/javadoc_publisher.rb +19 -19
- data/lib/rubyjobbuilderdsl/postbuild/logparser.rb +21 -21
- data/lib/rubyjobbuilderdsl/postbuild/nunit_publisher.rb +21 -21
- data/lib/rubyjobbuilderdsl/postbuild/pmd_publisher.rb +19 -19
- data/lib/rubyjobbuilderdsl/postbuild/script.rb +14 -14
- data/lib/rubyjobbuilderdsl/postbuild/tap_publisher.rb +44 -44
- data/lib/rubyjobbuilderdsl/postbuild/trigger.rb +38 -38
- data/lib/rubyjobbuilderdsl/postbuild/xunit_publisher.rb +35 -35
- data/lib/rubyjobbuilderdsl/postbuild.rb +160 -160
- data/lib/rubyjobbuilderdsl/view.rb +14 -14
- data/lib/rubyjobbuilderdsl/xml_generator.rb +1 -1
- data/lib/rubyjobbuilderdsl.rb +2 -2
- data/rubyjobbuilderdsl-0.0.3.gem +0 -0
- data/rubyjobbuilderdsl.gemspec +13 -13
- data/rubyjobbuilderdsl.sublime-project +14 -14
- data/run_tests.sh +7 -7
- data/sample/Schedule-sample-pipeline.xml +32 -0
- data/sample/hello_mars.rb +27 -27
- data/sample/local.ini +4 -4
- data/test/test_ant.rb +38 -38
- data/test/test_archive.rb +24 -24
- data/test/test_artifactory.rb +26 -26
- data/test/test_blocking_job.rb +18 -18
- data/test/test_chucknorris_publisher.rb +17 -17
- data/test/test_claim_publisher.rb +17 -17
- data/test/test_cloverphp.rb +33 -33
- data/test/test_concurrent.rb +44 -44
- data/test/test_copyartifact.rb +45 -45
- data/test/test_cucumber_json_publisher.rb +30 -30
- data/test/test_default_setting.rb +29 -29
- data/test/test_email_publisher.rb +44 -44
- data/test/test_flow.rb +19 -19
- data/test/test_freestyle.rb +52 -52
- data/test/test_game_publisher.rb +17 -17
- data/test/test_gerrit.rb +117 -117
- data/test/test_git.rb +80 -80
- data/test/test_html_publisher.rb +57 -57
- data/test/test_inject.rb +23 -23
- data/test/test_javadoc.rb +22 -22
- data/test/test_logparser.rb +24 -24
- data/test/test_logrotate.rb +22 -22
- data/test/test_multijob.rb +50 -50
- data/test/test_nunit_publisher.rb +20 -20
- data/test/test_parameter.rb +44 -44
- data/test/test_password.rb +17 -17
- data/test/test_pmd.rb +22 -22
- data/test/test_pollscm.rb +15 -15
- data/test/test_postbuild_groovy.rb +21 -21
- data/test/test_postbuild_script.rb +24 -24
- data/test/test_postbuild_trigger.rb +170 -170
- data/test/test_scms.rb +31 -31
- data/test/test_tap_publisher.rb +25 -25
- data/test/test_timed.rb +15 -15
- data/test/test_timeout.rb +20 -20
- data/test/test_timestamps.rb +14 -14
- data/test/test_xml_generator.rb +28 -28
- data/test/test_xunit_publisher.rb +22 -22
- data/test/test_xvfb.rb +35 -35
- metadata +9 -11
- data/sample/hello_mars.xml +0 -18
- data/sample/hello_world-post.xml +0 -40
- data/sample/sample_flow.rb +0 -15
- data/sample/test.xml +0 -21
data/test/test_artifactory.rb
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
require_relative './test_xml_generator'
|
|
2
|
-
|
|
3
|
-
class TestXmlArtifactory < Test::Unit::TestCase
|
|
4
|
-
def test_artifactory
|
|
5
|
-
builder = JenkinsJob::Builder.new
|
|
6
|
-
|
|
7
|
-
builder.freestyle 'foo' do
|
|
8
|
-
artifactory do
|
|
9
|
-
server 'artifactory.mycompany.com'
|
|
10
|
-
repository 'bar'
|
|
11
|
-
deploy '*.gz'
|
|
12
|
-
end
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
actual = builder.config_as_xml_node('foo')
|
|
16
|
-
{ 'details/artifactoryName' => 'artifactory.mycompany.com',
|
|
17
|
-
'details/repositoryKey' => 'bar',
|
|
18
|
-
'details/snapshotsRepositoryKey' => 'bar',
|
|
19
|
-
'deployPattern' => '*.gz',
|
|
20
|
-
'deployBuildInfo' => 'false',
|
|
21
|
-
'includeEnvVars' => 'false',
|
|
22
|
-
}.each do |k, v|
|
|
23
|
-
assert_equal v, actual.xpath("./project/buildWrappers/org.jfrog.hudson.generic.ArtifactoryGenericConfigurator/#{k}").text, k
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
end
|
|
1
|
+
require_relative './test_xml_generator'
|
|
2
|
+
|
|
3
|
+
class TestXmlArtifactory < Test::Unit::TestCase
|
|
4
|
+
def test_artifactory
|
|
5
|
+
builder = JenkinsJob::Builder.new
|
|
6
|
+
|
|
7
|
+
builder.freestyle 'foo' do
|
|
8
|
+
artifactory do
|
|
9
|
+
server 'artifactory.mycompany.com'
|
|
10
|
+
repository 'bar'
|
|
11
|
+
deploy '*.gz'
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
actual = builder.config_as_xml_node('foo')
|
|
16
|
+
{ 'details/artifactoryName' => 'artifactory.mycompany.com',
|
|
17
|
+
'details/repositoryKey' => 'bar',
|
|
18
|
+
'details/snapshotsRepositoryKey' => 'bar',
|
|
19
|
+
'deployPattern' => '*.gz',
|
|
20
|
+
'deployBuildInfo' => 'false',
|
|
21
|
+
'includeEnvVars' => 'false',
|
|
22
|
+
}.each do |k, v|
|
|
23
|
+
assert_equal v, actual.xpath("./project/buildWrappers/org.jfrog.hudson.generic.ArtifactoryGenericConfigurator/#{k}").text, k
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
data/test/test_blocking_job.rb
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
require_relative './test_xml_generator'
|
|
2
|
-
|
|
3
|
-
class TestXmlBlockingJob < Test::Unit::TestCase
|
|
4
|
-
def test_blocking_job
|
|
5
|
-
builder = JenkinsJob::Builder.new
|
|
6
|
-
|
|
7
|
-
builder.freestyle 'pre-deploy' do
|
|
8
|
-
blocked_by 'deploy', 'post-deploy'
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
actual = builder.config_as_xml_node('pre-deploy')
|
|
12
|
-
|
|
13
|
-
{ 'useBuildBlocker' => 'true',
|
|
14
|
-
'blockingJobs' => "deploy\npost-deploy" }.each do |k, v|
|
|
15
|
-
assert v, actual.xpath("./project/properties/hudson.plugins.buildblocker.BuildBlockerProperty/#{k}").text
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
end
|
|
1
|
+
require_relative './test_xml_generator'
|
|
2
|
+
|
|
3
|
+
class TestXmlBlockingJob < Test::Unit::TestCase
|
|
4
|
+
def test_blocking_job
|
|
5
|
+
builder = JenkinsJob::Builder.new
|
|
6
|
+
|
|
7
|
+
builder.freestyle 'pre-deploy' do
|
|
8
|
+
blocked_by 'deploy', 'post-deploy'
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
actual = builder.config_as_xml_node('pre-deploy')
|
|
12
|
+
|
|
13
|
+
{ 'useBuildBlocker' => 'true',
|
|
14
|
+
'blockingJobs' => "deploy\npost-deploy" }.each do |k, v|
|
|
15
|
+
assert v, actual.xpath("./project/properties/hudson.plugins.buildblocker.BuildBlockerProperty/#{k}").text
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
require_relative './test_xml_generator'
|
|
2
|
-
|
|
3
|
-
class TestChuckNorrisPublisher < Test::Unit::TestCase
|
|
4
|
-
def test_postbuild_chucknorris_publisher
|
|
5
|
-
builder = JenkinsJob::Builder.new
|
|
6
|
-
|
|
7
|
-
builder.freestyle 'foo' do
|
|
8
|
-
postbuild do
|
|
9
|
-
chucknorris
|
|
10
|
-
end
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
actual = builder.config_as_xml_node('foo')
|
|
14
|
-
|
|
15
|
-
assert actual.at('./project/publishers/hudson.plugins.chucknorris.CordellWalkerRecorder/factGenerator')
|
|
16
|
-
end
|
|
17
|
-
end
|
|
1
|
+
require_relative './test_xml_generator'
|
|
2
|
+
|
|
3
|
+
class TestChuckNorrisPublisher < Test::Unit::TestCase
|
|
4
|
+
def test_postbuild_chucknorris_publisher
|
|
5
|
+
builder = JenkinsJob::Builder.new
|
|
6
|
+
|
|
7
|
+
builder.freestyle 'foo' do
|
|
8
|
+
postbuild do
|
|
9
|
+
chucknorris
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
actual = builder.config_as_xml_node('foo')
|
|
14
|
+
|
|
15
|
+
assert actual.at('./project/publishers/hudson.plugins.chucknorris.CordellWalkerRecorder/factGenerator')
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
require_relative './test_xml_generator'
|
|
2
|
-
|
|
3
|
-
class TestXmlClaimPublisher < Test::Unit::TestCase
|
|
4
|
-
def test_postbuild_nunit_publisher
|
|
5
|
-
builder = JenkinsJob::Builder.new
|
|
6
|
-
|
|
7
|
-
builder.freestyle 'foo' do
|
|
8
|
-
postbuild do
|
|
9
|
-
allow_broken_build_claiming
|
|
10
|
-
end
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
actual = builder.config_as_xml_node('foo')
|
|
14
|
-
|
|
15
|
-
assert actual.at('./project/publishers/hudson.plugins.claim.ClaimPublisher')
|
|
16
|
-
end
|
|
17
|
-
end
|
|
1
|
+
require_relative './test_xml_generator'
|
|
2
|
+
|
|
3
|
+
class TestXmlClaimPublisher < Test::Unit::TestCase
|
|
4
|
+
def test_postbuild_nunit_publisher
|
|
5
|
+
builder = JenkinsJob::Builder.new
|
|
6
|
+
|
|
7
|
+
builder.freestyle 'foo' do
|
|
8
|
+
postbuild do
|
|
9
|
+
allow_broken_build_claiming
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
actual = builder.config_as_xml_node('foo')
|
|
14
|
+
|
|
15
|
+
assert actual.at('./project/publishers/hudson.plugins.claim.ClaimPublisher')
|
|
16
|
+
end
|
|
17
|
+
end
|
data/test/test_cloverphp.rb
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
require_relative './test_xml_generator'
|
|
2
|
-
|
|
3
|
-
class TestXmlCloverPhp < Test::Unit::TestCase
|
|
4
|
-
def test_clover_php
|
|
5
|
-
builder = JenkinsJob::Builder.new
|
|
6
|
-
|
|
7
|
-
builder.freestyle 'foo' do
|
|
8
|
-
postbuild do
|
|
9
|
-
publish_cloverphp do
|
|
10
|
-
xml_location 'build/coverage_clover.xml'
|
|
11
|
-
html_report_dir 'build/coverage'
|
|
12
|
-
healthy_target :method => 70, :statement => 80
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
actual = builder.config_as_xml_node('foo')
|
|
18
|
-
{ 'publishHtmlReport' => 'true',
|
|
19
|
-
'reportDir' => 'build/coverage',
|
|
20
|
-
'xmlLocation' => 'build/coverage_clover.xml',
|
|
21
|
-
'disableArchiving' => 'false' }.each do |k, v|
|
|
22
|
-
assert_equal v, actual.xpath("./project/publishers/org.jenkinsci.plugins.cloverphp.CloverPHPPublisher/#{k}").text, k
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
{ 'methodCoverage' => '70',
|
|
26
|
-
'statementCoverage' => '80' }.each do |k, v|
|
|
27
|
-
assert_equal v, actual.xpath("./project/publishers/org.jenkinsci.plugins.cloverphp.CloverPHPPublisher/healthyTarget/#{k}").text, k
|
|
28
|
-
end
|
|
29
|
-
%w(unhealthyTarget failingTarget).each do |target|
|
|
30
|
-
assert actual.at("./project/publishers/org.jenkinsci.plugins.cloverphp.CloverPHPPublisher/#{target}")
|
|
31
|
-
end
|
|
32
|
-
end
|
|
33
|
-
end
|
|
1
|
+
require_relative './test_xml_generator'
|
|
2
|
+
|
|
3
|
+
class TestXmlCloverPhp < Test::Unit::TestCase
|
|
4
|
+
def test_clover_php
|
|
5
|
+
builder = JenkinsJob::Builder.new
|
|
6
|
+
|
|
7
|
+
builder.freestyle 'foo' do
|
|
8
|
+
postbuild do
|
|
9
|
+
publish_cloverphp do
|
|
10
|
+
xml_location 'build/coverage_clover.xml'
|
|
11
|
+
html_report_dir 'build/coverage'
|
|
12
|
+
healthy_target :method => 70, :statement => 80
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
actual = builder.config_as_xml_node('foo')
|
|
18
|
+
{ 'publishHtmlReport' => 'true',
|
|
19
|
+
'reportDir' => 'build/coverage',
|
|
20
|
+
'xmlLocation' => 'build/coverage_clover.xml',
|
|
21
|
+
'disableArchiving' => 'false' }.each do |k, v|
|
|
22
|
+
assert_equal v, actual.xpath("./project/publishers/org.jenkinsci.plugins.cloverphp.CloverPHPPublisher/#{k}").text, k
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
{ 'methodCoverage' => '70',
|
|
26
|
+
'statementCoverage' => '80' }.each do |k, v|
|
|
27
|
+
assert_equal v, actual.xpath("./project/publishers/org.jenkinsci.plugins.cloverphp.CloverPHPPublisher/healthyTarget/#{k}").text, k
|
|
28
|
+
end
|
|
29
|
+
%w(unhealthyTarget failingTarget).each do |target|
|
|
30
|
+
assert actual.at("./project/publishers/org.jenkinsci.plugins.cloverphp.CloverPHPPublisher/#{target}")
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
data/test/test_concurrent.rb
CHANGED
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
require_relative './test_xml_generator'
|
|
2
|
-
|
|
3
|
-
class TestXmlConcurrent < Test::Unit::TestCase
|
|
4
|
-
def test_concurrent_per_project
|
|
5
|
-
builder = JenkinsJob::Builder.new
|
|
6
|
-
|
|
7
|
-
builder.freestyle 'foo' do
|
|
8
|
-
concurrent do
|
|
9
|
-
max_per_node 2
|
|
10
|
-
max_total 0
|
|
11
|
-
end
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
actual = builder.config_as_xml_node('foo')
|
|
15
|
-
|
|
16
|
-
assert_equal 'true', actual.xpath('./project/concurrentBuild').text
|
|
17
|
-
|
|
18
|
-
{ 'maxConcurrentPerNode' => '2', 'maxConcurrentTotal' => '0', 'throttleEnabled' => 'true',
|
|
19
|
-
'throttleOption' => 'project', 'configVersion' => '1' }.each do |k, v|
|
|
20
|
-
assert_equal v, actual.xpath("./project/properties/hudson.plugins.throttleconcurrents.ThrottleJobProperty/#{k}").text, k
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
def test_concurrent_per_category
|
|
25
|
-
builder = JenkinsJob::Builder.new
|
|
26
|
-
|
|
27
|
-
builder.freestyle 'foo' do
|
|
28
|
-
concurrent do
|
|
29
|
-
max_per_node 2
|
|
30
|
-
max_total 0
|
|
31
|
-
category 'servicetest'
|
|
32
|
-
end
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
actual = builder.config_as_xml_node('foo')
|
|
36
|
-
|
|
37
|
-
assert_equal 'true', actual.xpath('./project/concurrentBuild').text
|
|
38
|
-
|
|
39
|
-
{ 'maxConcurrentPerNode' => '2', 'maxConcurrentTotal' => '0', 'throttleEnabled' => 'true',
|
|
40
|
-
'throttleOption' => 'category', 'configVersion' => '1', 'categories/string' => 'servicetest' }.each do |k, v|
|
|
41
|
-
assert_equal v, actual.xpath("./project/properties/hudson.plugins.throttleconcurrents.ThrottleJobProperty/#{k}").text, k
|
|
42
|
-
end
|
|
43
|
-
end
|
|
44
|
-
end
|
|
1
|
+
require_relative './test_xml_generator'
|
|
2
|
+
|
|
3
|
+
class TestXmlConcurrent < Test::Unit::TestCase
|
|
4
|
+
def test_concurrent_per_project
|
|
5
|
+
builder = JenkinsJob::Builder.new
|
|
6
|
+
|
|
7
|
+
builder.freestyle 'foo' do
|
|
8
|
+
concurrent do
|
|
9
|
+
max_per_node 2
|
|
10
|
+
max_total 0
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
actual = builder.config_as_xml_node('foo')
|
|
15
|
+
|
|
16
|
+
assert_equal 'true', actual.xpath('./project/concurrentBuild').text
|
|
17
|
+
|
|
18
|
+
{ 'maxConcurrentPerNode' => '2', 'maxConcurrentTotal' => '0', 'throttleEnabled' => 'true',
|
|
19
|
+
'throttleOption' => 'project', 'configVersion' => '1' }.each do |k, v|
|
|
20
|
+
assert_equal v, actual.xpath("./project/properties/hudson.plugins.throttleconcurrents.ThrottleJobProperty/#{k}").text, k
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def test_concurrent_per_category
|
|
25
|
+
builder = JenkinsJob::Builder.new
|
|
26
|
+
|
|
27
|
+
builder.freestyle 'foo' do
|
|
28
|
+
concurrent do
|
|
29
|
+
max_per_node 2
|
|
30
|
+
max_total 0
|
|
31
|
+
category 'servicetest'
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
actual = builder.config_as_xml_node('foo')
|
|
36
|
+
|
|
37
|
+
assert_equal 'true', actual.xpath('./project/concurrentBuild').text
|
|
38
|
+
|
|
39
|
+
{ 'maxConcurrentPerNode' => '2', 'maxConcurrentTotal' => '0', 'throttleEnabled' => 'true',
|
|
40
|
+
'throttleOption' => 'category', 'configVersion' => '1', 'categories/string' => 'servicetest' }.each do |k, v|
|
|
41
|
+
assert_equal v, actual.xpath("./project/properties/hudson.plugins.throttleconcurrents.ThrottleJobProperty/#{k}").text, k
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
data/test/test_copyartifact.rb
CHANGED
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
require_relative './test_xml_generator'
|
|
2
|
-
|
|
3
|
-
class TestXmlCopyArtifact < Test::Unit::TestCase
|
|
4
|
-
def test_copy_lastest
|
|
5
|
-
builder = JenkinsJob::Builder.new
|
|
6
|
-
|
|
7
|
-
builder.freestyle 'foo' do
|
|
8
|
-
copyartifact 'bar' do
|
|
9
|
-
file 'a/**',
|
|
10
|
-
'b/**'
|
|
11
|
-
end
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
actual = builder.config_as_xml_node('foo')
|
|
15
|
-
|
|
16
|
-
assert_equal 'bar', actual.xpath('./project/builders/hudson.plugins.copyartifact.CopyArtifact/project').text
|
|
17
|
-
assert_equal 'a/**,b/**', actual.xpath('./project/builders/hudson.plugins.copyartifact.CopyArtifact/filter').text
|
|
18
|
-
assert actual.at('./project/builders/hudson.plugins.copyartifact.CopyArtifact/target')
|
|
19
|
-
|
|
20
|
-
assert_equal 'false', actual.xpath('./project/builders/hudson.plugins.copyartifact.CopyArtifact/flatten').text
|
|
21
|
-
assert_equal 'false', actual.xpath('./project/builders/hudson.plugins.copyartifact.CopyArtifact/optional').text
|
|
22
|
-
assert actual.at('./project/builders/hudson.plugins.copyartifact.CopyArtifact/parameters')
|
|
23
|
-
|
|
24
|
-
assert_equal 'false', actual.xpath('./project/builders/hudson.plugins.copyartifact.CopyArtifact/' \
|
|
25
|
-
"selector[contains(@class,'hudson.plugins.copyartifact.StatusBuildSelector')]/stable").text
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
def test_copy_specific_build
|
|
29
|
-
builder = JenkinsJob::Builder.new
|
|
30
|
-
|
|
31
|
-
builder.freestyle 'foo' do
|
|
32
|
-
copyartifact 'bar' do
|
|
33
|
-
build_number '$ARTIFACT_BUILD_NUMBER'
|
|
34
|
-
file 'a/**',
|
|
35
|
-
'b/**'
|
|
36
|
-
to '$BUILD_NUMBER'
|
|
37
|
-
end
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
actual = builder.config_as_xml_node('foo')
|
|
41
|
-
|
|
42
|
-
assert_equal '$ARTIFACT_BUILD_NUMBER', actual.xpath('./project/builders/hudson.plugins.copyartifact.CopyArtifact/' \
|
|
43
|
-
"selector[contains(@class,'hudson.plugins.copyartifact.SpecificBuildSelector')]/buildNumber").text
|
|
44
|
-
end
|
|
45
|
-
end
|
|
1
|
+
require_relative './test_xml_generator'
|
|
2
|
+
|
|
3
|
+
class TestXmlCopyArtifact < Test::Unit::TestCase
|
|
4
|
+
def test_copy_lastest
|
|
5
|
+
builder = JenkinsJob::Builder.new
|
|
6
|
+
|
|
7
|
+
builder.freestyle 'foo' do
|
|
8
|
+
copyartifact 'bar' do
|
|
9
|
+
file 'a/**',
|
|
10
|
+
'b/**'
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
actual = builder.config_as_xml_node('foo')
|
|
15
|
+
|
|
16
|
+
assert_equal 'bar', actual.xpath('./project/builders/hudson.plugins.copyartifact.CopyArtifact/project').text
|
|
17
|
+
assert_equal 'a/**,b/**', actual.xpath('./project/builders/hudson.plugins.copyartifact.CopyArtifact/filter').text
|
|
18
|
+
assert actual.at('./project/builders/hudson.plugins.copyartifact.CopyArtifact/target')
|
|
19
|
+
|
|
20
|
+
assert_equal 'false', actual.xpath('./project/builders/hudson.plugins.copyartifact.CopyArtifact/flatten').text
|
|
21
|
+
assert_equal 'false', actual.xpath('./project/builders/hudson.plugins.copyartifact.CopyArtifact/optional').text
|
|
22
|
+
assert actual.at('./project/builders/hudson.plugins.copyartifact.CopyArtifact/parameters')
|
|
23
|
+
|
|
24
|
+
assert_equal 'false', actual.xpath('./project/builders/hudson.plugins.copyartifact.CopyArtifact/' \
|
|
25
|
+
"selector[contains(@class,'hudson.plugins.copyartifact.StatusBuildSelector')]/stable").text
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def test_copy_specific_build
|
|
29
|
+
builder = JenkinsJob::Builder.new
|
|
30
|
+
|
|
31
|
+
builder.freestyle 'foo' do
|
|
32
|
+
copyartifact 'bar' do
|
|
33
|
+
build_number '$ARTIFACT_BUILD_NUMBER'
|
|
34
|
+
file 'a/**',
|
|
35
|
+
'b/**'
|
|
36
|
+
to '$BUILD_NUMBER'
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
actual = builder.config_as_xml_node('foo')
|
|
41
|
+
|
|
42
|
+
assert_equal '$ARTIFACT_BUILD_NUMBER', actual.xpath('./project/builders/hudson.plugins.copyartifact.CopyArtifact/' \
|
|
43
|
+
"selector[contains(@class,'hudson.plugins.copyartifact.SpecificBuildSelector')]/buildNumber").text
|
|
44
|
+
end
|
|
45
|
+
end
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
require_relative './test_xml_generator'
|
|
2
|
-
|
|
3
|
-
class TestCucumberPublisher < Test::Unit::TestCase
|
|
4
|
-
def test_postbuild_cucumber_json_publisher
|
|
5
|
-
file_location = 'cucumber/results.json'
|
|
6
|
-
ignore_bad_results = 'false'
|
|
7
|
-
|
|
8
|
-
builder = JenkinsJob::Builder.new
|
|
9
|
-
|
|
10
|
-
builder.freestyle 'foo' do
|
|
11
|
-
postbuild do
|
|
12
|
-
cucumber_json_publisher do
|
|
13
|
-
test_results file_location
|
|
14
|
-
ignore_bad_tests ignore_bad_results
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
actual = builder.config_as_xml_node('foo')
|
|
20
|
-
|
|
21
|
-
{
|
|
22
|
-
'testResults' => file_location,
|
|
23
|
-
'ignoreBadSteps' => ignore_bad_results,
|
|
24
|
-
}.each do |k, v|
|
|
25
|
-
path = ['./project/publishers/org.jenkinsci.plugins.cucumber.',
|
|
26
|
-
"jsontestsupport.CucumberTestResultArchiver/#{k}"].join('')
|
|
27
|
-
assert_equal v, actual.xpath(path).text
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
end
|
|
1
|
+
require_relative './test_xml_generator'
|
|
2
|
+
|
|
3
|
+
class TestCucumberPublisher < Test::Unit::TestCase
|
|
4
|
+
def test_postbuild_cucumber_json_publisher
|
|
5
|
+
file_location = 'cucumber/results.json'
|
|
6
|
+
ignore_bad_results = 'false'
|
|
7
|
+
|
|
8
|
+
builder = JenkinsJob::Builder.new
|
|
9
|
+
|
|
10
|
+
builder.freestyle 'foo' do
|
|
11
|
+
postbuild do
|
|
12
|
+
cucumber_json_publisher do
|
|
13
|
+
test_results file_location
|
|
14
|
+
ignore_bad_tests ignore_bad_results
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
actual = builder.config_as_xml_node('foo')
|
|
20
|
+
|
|
21
|
+
{
|
|
22
|
+
'testResults' => file_location,
|
|
23
|
+
'ignoreBadSteps' => ignore_bad_results,
|
|
24
|
+
}.each do |k, v|
|
|
25
|
+
path = ['./project/publishers/org.jenkinsci.plugins.cucumber.',
|
|
26
|
+
"jsontestsupport.CucumberTestResultArchiver/#{k}"].join('')
|
|
27
|
+
assert_equal v, actual.xpath(path).text
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
require_relative './test_xml_generator'
|
|
2
|
-
|
|
3
|
-
class TestXmlDefaultSetting < Test::Unit::TestCase
|
|
4
|
-
def test_created_jobs_inherit_default_setting
|
|
5
|
-
builder = JenkinsJob::Builder.new do
|
|
6
|
-
node 'windows'
|
|
7
|
-
quiet_period 5
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
builder.freestyle 'show-env' do
|
|
11
|
-
shell 'env'
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
builder.freestyle 'show-dir' do
|
|
15
|
-
shell 'pwd'
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
actual_show_env = builder.config_as_xml_node('show-env')
|
|
19
|
-
actual_show_dir = builder.config_as_xml_node('show-dir')
|
|
20
|
-
|
|
21
|
-
assert_equal '5', actual_show_env.xpath('./project/quietPeriod').text
|
|
22
|
-
assert_equal 'windows', actual_show_env.xpath('./project/assignedNode').text
|
|
23
|
-
assert_equal 'env', actual_show_env.xpath('./project/builders/hudson.tasks.Shell/command').text
|
|
24
|
-
|
|
25
|
-
assert_equal '5', actual_show_dir.xpath('./project/quietPeriod').text
|
|
26
|
-
assert_equal 'windows', actual_show_dir.xpath('./project/assignedNode').text
|
|
27
|
-
assert_equal 'pwd', actual_show_dir.xpath('./project/builders/hudson.tasks.Shell/command').text
|
|
28
|
-
end
|
|
29
|
-
end
|
|
1
|
+
require_relative './test_xml_generator'
|
|
2
|
+
|
|
3
|
+
class TestXmlDefaultSetting < Test::Unit::TestCase
|
|
4
|
+
def test_created_jobs_inherit_default_setting
|
|
5
|
+
builder = JenkinsJob::Builder.new do
|
|
6
|
+
node 'windows'
|
|
7
|
+
quiet_period 5
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
builder.freestyle 'show-env' do
|
|
11
|
+
shell 'env'
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
builder.freestyle 'show-dir' do
|
|
15
|
+
shell 'pwd'
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
actual_show_env = builder.config_as_xml_node('show-env')
|
|
19
|
+
actual_show_dir = builder.config_as_xml_node('show-dir')
|
|
20
|
+
|
|
21
|
+
assert_equal '5', actual_show_env.xpath('./project/quietPeriod').text
|
|
22
|
+
assert_equal 'windows', actual_show_env.xpath('./project/assignedNode').text
|
|
23
|
+
assert_equal 'env', actual_show_env.xpath('./project/builders/hudson.tasks.Shell/command').text
|
|
24
|
+
|
|
25
|
+
assert_equal '5', actual_show_dir.xpath('./project/quietPeriod').text
|
|
26
|
+
assert_equal 'windows', actual_show_dir.xpath('./project/assignedNode').text
|
|
27
|
+
assert_equal 'pwd', actual_show_dir.xpath('./project/builders/hudson.tasks.Shell/command').text
|
|
28
|
+
end
|
|
29
|
+
end
|
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
require_relative './test_xml_generator'
|
|
2
|
-
|
|
3
|
-
class TestXmlEmailPublisher < Test::Unit::TestCase
|
|
4
|
-
def test_postbuild_email_publisher
|
|
5
|
-
builder = JenkinsJob::Builder.new
|
|
6
|
-
|
|
7
|
-
builder.freestyle 'foo' do
|
|
8
|
-
postbuild do
|
|
9
|
-
send_email 'test@example.com' do
|
|
10
|
-
notify_every_unstable_build false
|
|
11
|
-
send_to_individuals true
|
|
12
|
-
end
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
actual = builder.config_as_xml_node('foo')
|
|
17
|
-
|
|
18
|
-
{ 'recipients' => 'test@example.com',
|
|
19
|
-
'dontNotifyEveryUnstableBuild' => 'true',
|
|
20
|
-
'sendToIndividuals' => 'true'
|
|
21
|
-
}.each do |k, v|
|
|
22
|
-
assert_equal v, actual.xpath("./project/publishers/hudson.tasks.Mailer/#{k}").text, k
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
def test_postbuild_email_publisher_defaults
|
|
27
|
-
builder = JenkinsJob::Builder.new
|
|
28
|
-
|
|
29
|
-
builder.freestyle 'foo' do
|
|
30
|
-
postbuild do
|
|
31
|
-
send_email 'test@example.com'
|
|
32
|
-
end
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
actual = builder.config_as_xml_node('foo')
|
|
36
|
-
|
|
37
|
-
{ 'recipients' => 'test@example.com',
|
|
38
|
-
'dontNotifyEveryUnstableBuild' => 'false',
|
|
39
|
-
'sendToIndividuals' => 'false'
|
|
40
|
-
}.each do |k, v|
|
|
41
|
-
assert_equal v, actual.xpath("./project/publishers/hudson.tasks.Mailer/#{k}").text, k
|
|
42
|
-
end
|
|
43
|
-
end
|
|
44
|
-
end
|
|
1
|
+
require_relative './test_xml_generator'
|
|
2
|
+
|
|
3
|
+
class TestXmlEmailPublisher < Test::Unit::TestCase
|
|
4
|
+
def test_postbuild_email_publisher
|
|
5
|
+
builder = JenkinsJob::Builder.new
|
|
6
|
+
|
|
7
|
+
builder.freestyle 'foo' do
|
|
8
|
+
postbuild do
|
|
9
|
+
send_email 'test@example.com' do
|
|
10
|
+
notify_every_unstable_build false
|
|
11
|
+
send_to_individuals true
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
actual = builder.config_as_xml_node('foo')
|
|
17
|
+
|
|
18
|
+
{ 'recipients' => 'test@example.com',
|
|
19
|
+
'dontNotifyEveryUnstableBuild' => 'true',
|
|
20
|
+
'sendToIndividuals' => 'true'
|
|
21
|
+
}.each do |k, v|
|
|
22
|
+
assert_equal v, actual.xpath("./project/publishers/hudson.tasks.Mailer/#{k}").text, k
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def test_postbuild_email_publisher_defaults
|
|
27
|
+
builder = JenkinsJob::Builder.new
|
|
28
|
+
|
|
29
|
+
builder.freestyle 'foo' do
|
|
30
|
+
postbuild do
|
|
31
|
+
send_email 'test@example.com'
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
actual = builder.config_as_xml_node('foo')
|
|
36
|
+
|
|
37
|
+
{ 'recipients' => 'test@example.com',
|
|
38
|
+
'dontNotifyEveryUnstableBuild' => 'false',
|
|
39
|
+
'sendToIndividuals' => 'false'
|
|
40
|
+
}.each do |k, v|
|
|
41
|
+
assert_equal v, actual.xpath("./project/publishers/hudson.tasks.Mailer/#{k}").text, k
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|