-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ChangeBuildDescriptionActionDescriptor (#79)
- Loading branch information
1 parent
e5d2286
commit dd70567
Showing
6 changed files
with
98 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
/.idea | ||
/docs | ||
**/*.iml | ||
target/ |
26 changes: 26 additions & 0 deletions
26
...nkins/buildhistorymanager/descriptors/actions/ChangeBuildDescriptionActionDescriptor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package pl.damianszczepanik.jenkins.buildhistorymanager.descriptors.actions; | ||
|
||
import hudson.Extension; | ||
import hudson.model.Descriptor; | ||
import org.jenkinsci.Symbol; | ||
import pl.damianszczepanik.jenkins.buildhistorymanager.model.actions.Action; | ||
import pl.damianszczepanik.jenkins.buildhistorymanager.model.actions.ChangeBuildDescriptionAction; | ||
|
||
/** | ||
* Descriptor implementation needed to render UI for {@link ChangeBuildDescriptionAction}. | ||
* | ||
* @author Damian Szczepanik (damianszczepanik@github) | ||
*/ | ||
@Extension | ||
@Symbol("ChangeBuildDescription") | ||
public class ChangeBuildDescriptionActionDescriptor extends Descriptor<Action> { | ||
|
||
public ChangeBuildDescriptionActionDescriptor() { | ||
super(ChangeBuildDescriptionAction.class); | ||
} | ||
|
||
@Override | ||
public String getDisplayName() { | ||
return "Change build description"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
...czepanik/jenkins/buildhistorymanager/model/actions/ChangeBuildDescriptionAction/help.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<p><b>Description</b></p> | ||
<p>Updates build description.</p> | ||
|
||
<p><b>Use cases</b></p> | ||
<p>This action is helpful for testing and debugging. It does not change or delete the build what might be hard to | ||
rollback. Instead, it allows to test conditions before final action is used.</p> | ||
|
||
<p>The result of this action is a string <code>[build-history-manager]</code> which is prepend to job description.</p> | ||
<p>Use this action as long as the final result of condition is not examined. | ||
This is helpful also for users who do not have access to Jenkins logs.</p> |
32 changes: 32 additions & 0 deletions
32
...s/buildhistorymanager/descriptors/actions/ChangeBuildDescriptionActionDescriptorTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package pl.damianszczepanik.jenkins.buildhistorymanager.descriptors.actions; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import hudson.model.AbstractDescribableImpl; | ||
import hudson.model.Descriptor; | ||
import org.jenkinsci.plugins.structs.SymbolLookup; | ||
import org.junit.Rule; | ||
import org.junit.Test; | ||
import org.jvnet.hudson.test.JenkinsRule; | ||
|
||
/** | ||
* @author Damian Szczepanik (damianszczepanik@github) | ||
*/ | ||
public class ChangeBuildDescriptionActionDescriptorTest { | ||
|
||
@Rule | ||
public JenkinsRule j = new JenkinsRule(); | ||
|
||
@Test | ||
public void getDisplayName_ReturnsDescriptorName() { | ||
|
||
// given | ||
Descriptor descriptor = SymbolLookup.get().findDescriptor(AbstractDescribableImpl.class, "ChangeBuildDescription"); | ||
|
||
// when | ||
String displayName = descriptor.getDisplayName(); | ||
|
||
// then | ||
assertThat(displayName).isEqualTo("Change build description"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters