-
Notifications
You must be signed in to change notification settings - Fork 125
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
171 additions
and
99 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
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
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
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
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
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
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
25 changes: 25 additions & 0 deletions
25
src/main/java/org/codinjutsu/tools/jenkins/view/parameter/HiddenParameterRenderer.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,25 @@ | ||
package org.codinjutsu.tools.jenkins.view.parameter; | ||
|
||
import org.codinjutsu.tools.jenkins.model.JobParameter; | ||
import org.codinjutsu.tools.jenkins.model.JobParameterType; | ||
import org.codinjutsu.tools.jenkins.view.extension.JobParameterRenderer; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
import javax.swing.*; | ||
|
||
public class HiddenParameterRenderer implements JobParameterRenderer { | ||
|
||
static final JobParameterType TYPE = new JobParameterType("WHideParameterDefinition", | ||
"com.wangyin.parameter.WHideParameterDefinition"); | ||
|
||
@NotNull | ||
@Override | ||
public JobParameterComponent render(@NotNull JobParameter jobParameter) { | ||
return new JobParameterComponent(jobParameter, new JLabel(), false); | ||
} | ||
|
||
@Override | ||
public boolean isForJobParameter(@NotNull JobParameter jobParameter) { | ||
return TYPE.equals(jobParameter.getJobParameterType()); | ||
} | ||
} |
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
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
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
41 changes: 41 additions & 0 deletions
41
src/test/java/org/codinjutsu/tools/jenkins/view/parameter/HiddenParameterRendererTest.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,41 @@ | ||
package org.codinjutsu.tools.jenkins.view.parameter; | ||
|
||
import org.codinjutsu.tools.jenkins.model.BuildInJobParameter; | ||
import org.codinjutsu.tools.jenkins.model.JobParameter; | ||
import org.codinjutsu.tools.jenkins.model.JobParameterType; | ||
import org.junit.Test; | ||
|
||
import javax.swing.*; | ||
|
||
import static org.assertj.core.api.Assertions.*; | ||
|
||
public class HiddenParameterRendererTest implements JobParameterTest { | ||
|
||
private final HiddenParameterRenderer jobParameterRenderer = new HiddenParameterRenderer(); | ||
private final JobParameterType hiddenParameter = new JobParameterType("WHideParameterDefinition", | ||
"com.wangyin.parameter.WHideParameterDefinition"); | ||
|
||
@Test | ||
public void render() { | ||
final JobParameter jobParameter = createJobParameter(hiddenParameter); | ||
JobParameterComponent jobParameterComponent = jobParameterRenderer.render(jobParameter); | ||
assertThat(jobParameterComponent.getViewElement()).isInstanceOf(JLabel.class); | ||
assertThat(jobParameterComponent.isVisible()).isFalse(); | ||
|
||
jobParameterComponent = jobParameterRenderer.render(createJobParameter(BuildInJobParameter.ChoiceParameterDefinition)); | ||
assertThat(jobParameterComponent.getViewElement()).isInstanceOf(JLabel.class); | ||
assertThat(jobParameterComponent.isVisible()).isFalse(); | ||
} | ||
|
||
@Test | ||
public void isForJobParameter() { | ||
assertThat(jobParameterRenderer.isForJobParameter(createJobParameter(hiddenParameter))) | ||
.isTrue(); | ||
assertThat(jobParameterRenderer.isForJobParameter(createJobParameter(new JobParameterType("WHideParameterDefinition", | ||
"com.wangyin.parameter.invalid.WHideParameterDefinition")))) | ||
.isFalse(); | ||
assertThat(jobParameterRenderer.isForJobParameter(createJobParameter(BuildInJobParameter.ChoiceParameterDefinition))) | ||
.isFalse(); | ||
} | ||
|
||
} |
Oops, something went wrong.