rubyjobbuilderdsl 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +13 -5
- 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.rb +2 -2
- 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.rb +140 -140
- 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/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.rb +160 -160
- 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/view.rb +14 -14
- data/lib/rubyjobbuilderdsl/xml_generator.rb +1 -1
- data/rubyjobbuilderdsl.gemspec +2 -2
- data/rubyjobbuilderdsl.sublime-project +14 -14
- data/run_tests.sh +7 -7
- data/sample/hello_mars.rb +27 -27
- data/sample/hello_mars.xml +18 -0
- data/sample/hello_world-post.xml +40 -0
- data/sample/local.ini +4 -4
- data/sample/test.xml +21 -0
- 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 +11 -10
- data/rubyjobbuilderdsl-0.0.3.gem +0 -0
- data/sample/Schedule-sample-pipeline.xml +0 -32
data/test/test_archive.rb
CHANGED
@@ -1,24 +1,24 @@
|
|
1
|
-
require_relative './test_xml_generator'
|
2
|
-
|
3
|
-
class TestXmlArchive < Test::Unit::TestCase
|
4
|
-
def test_postbuild_archive
|
5
|
-
builder = JenkinsJob::Builder.new
|
6
|
-
|
7
|
-
builder.freestyle 'foo' do
|
8
|
-
postbuild do
|
9
|
-
archive do
|
10
|
-
file 'a/**',
|
11
|
-
'b/**',
|
12
|
-
'c/lib/**'
|
13
|
-
latest_only true
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
actual = builder.config_as_xml_node('foo')
|
19
|
-
{ 'artifacts' => 'a/**,b/**,c/lib/**',
|
20
|
-
'latestOnly' => 'true' }.each do |k, v|
|
21
|
-
assert_equal v, actual.xpath("./project/publishers/hudson.tasks.ArtifactArchiver/#{k}").text, k
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
1
|
+
require_relative './test_xml_generator'
|
2
|
+
|
3
|
+
class TestXmlArchive < Test::Unit::TestCase
|
4
|
+
def test_postbuild_archive
|
5
|
+
builder = JenkinsJob::Builder.new
|
6
|
+
|
7
|
+
builder.freestyle 'foo' do
|
8
|
+
postbuild do
|
9
|
+
archive do
|
10
|
+
file 'a/**',
|
11
|
+
'b/**',
|
12
|
+
'c/lib/**'
|
13
|
+
latest_only true
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
actual = builder.config_as_xml_node('foo')
|
19
|
+
{ 'artifacts' => 'a/**,b/**,c/lib/**',
|
20
|
+
'latestOnly' => 'true' }.each do |k, v|
|
21
|
+
assert_equal v, actual.xpath("./project/publishers/hudson.tasks.ArtifactArchiver/#{k}").text, k
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
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
|