@@ -2575,7 +2575,7 @@ class PublisherContextSpec extends Specification {
25752575 then :
25762576 context. publisherNodes. size() == 1
25772577 context. publisherNodes[0 ]. name() == ' hudson.plugins.git.GitPublisher'
2578- context. publisherNodes[0 ]. children(). size() == 6
2578+ context. publisherNodes[0 ]. children(). size() == 7
25792579 context. publisherNodes[0 ]. configVersion[0 ]. value() == 2
25802580 context. publisherNodes[0 ]. pushMerge[0 ]. value() == false
25812581 context. publisherNodes[0 ]. pushOnlyIfSuccess[0 ]. value() == false
@@ -2594,6 +2594,10 @@ class PublisherContextSpec extends Specification {
25942594 create()
25952595 update()
25962596 }
2597+ note(' origin' , ' test' ) {
2598+ namespace(' test' )
2599+ replace()
2600+ }
25972601 branch(' origin' , ' master' )
25982602 }
25992603
@@ -2614,6 +2618,14 @@ class PublisherContextSpec extends Specification {
26142618 createTag[0 ]. value() == true
26152619 updateTag[0 ]. value() == true
26162620 }
2621+ notesToPush. size() == 1
2622+ notesToPush[0 ]. ' hudson.plugins.git.GitPublisher_-NoteToPush' . size() == 1
2623+ with(notesToPush[0 ]. ' hudson.plugins.git.GitPublisher_-NoteToPush' [0 ]) {
2624+ targetRepoName[0 ]. value() == ' origin'
2625+ noteNamespace[0 ]. value() == ' test'
2626+ noteMsg[0 ]. value() == ' test'
2627+ noteReplace[0 ]. value() == true
2628+ }
26172629 branchesToPush. size() == 1
26182630 branchesToPush[0 ]. ' hudson.plugins.git.GitPublisher_-BranchToPush' . size() == 1
26192631 with(branchesToPush[0 ]. ' hudson.plugins.git.GitPublisher_-BranchToPush' [0 ]) {
@@ -2687,6 +2699,96 @@ class PublisherContextSpec extends Specification {
26872699 thrown(DslScriptException )
26882700 }
26892701
2702+ def ' call git with minimal note options' () {
2703+ when :
2704+ context. git {
2705+ note(' origin' , ' test' )
2706+ }
2707+
2708+ then :
2709+ context. publisherNodes. size() == 1
2710+ with(context. publisherNodes[0 ]) {
2711+ name() == ' hudson.plugins.git.GitPublisher'
2712+ configVersion[0 ]. value() == 2
2713+ pushMerge[0 ]. value() == false
2714+ pushOnlyIfSuccess[0 ]. value() == false
2715+ forcePush[0 ]. value() == false
2716+ notesToPush. size() == 1
2717+ notesToPush[0 ]. ' hudson.plugins.git.GitPublisher_-NoteToPush' . size() == 1
2718+ with(notesToPush[0 ]. ' hudson.plugins.git.GitPublisher_-NoteToPush' [0 ]) {
2719+ targetRepoName[0 ]. value() == ' origin'
2720+ noteMsg[0 ]. value() == ' test'
2721+ noteNamespace[0 ]. value() == ' master'
2722+ noteReplace[0 ]. value() == false
2723+ }
2724+ }
2725+ 1 * jobManagement. requireMinimumPluginVersion(' git' , ' 2.5.3' )
2726+ }
2727+
2728+ def ' call git with note replace' () {
2729+ when :
2730+ context. git {
2731+ note(' origin' , ' test' ) {
2732+ replace()
2733+ }
2734+ }
2735+
2736+ then :
2737+ context. publisherNodes. size() == 1
2738+ with(context. publisherNodes[0 ]) {
2739+ name() == ' hudson.plugins.git.GitPublisher'
2740+ configVersion[0 ]. value() == 2
2741+ pushMerge[0 ]. value() == false
2742+ pushOnlyIfSuccess[0 ]. value() == false
2743+ forcePush[0 ]. value() == false
2744+ notesToPush. size() == 1
2745+ notesToPush[0 ]. ' hudson.plugins.git.GitPublisher_-NoteToPush' . size() == 1
2746+ with(notesToPush[0 ]. ' hudson.plugins.git.GitPublisher_-NoteToPush' [0 ]) {
2747+ targetRepoName[0 ]. value() == ' origin'
2748+ noteMsg[0 ]. value() == ' test'
2749+ noteNamespace[0 ]. value() == ' master'
2750+ noteReplace[0 ]. value() == true
2751+ }
2752+ }
2753+ 1 * jobManagement. requireMinimumPluginVersion(' git' , ' 2.5.3' )
2754+ }
2755+
2756+ def ' call git without note targetRepoName' () {
2757+ when :
2758+ context. git {
2759+ note(null , ' test' )
2760+ }
2761+
2762+ then :
2763+ thrown(DslScriptException )
2764+
2765+ when :
2766+ context. git {
2767+ note(' ' , ' test' )
2768+ }
2769+
2770+ then :
2771+ thrown(DslScriptException )
2772+ }
2773+
2774+ def ' call git without note message' () {
2775+ when :
2776+ context. git {
2777+ note(' origin' , null )
2778+ }
2779+
2780+ then :
2781+ thrown(DslScriptException )
2782+
2783+ when :
2784+ context. git {
2785+ note(' origin' , ' ' )
2786+ }
2787+
2788+ then :
2789+ thrown(DslScriptException )
2790+ }
2791+
26902792 def ' call git without branch targetRepoName' () {
26912793 when :
26922794 context. git {
0 commit comments