本文整理汇总了Java中javaposse.jobdsl.plugin.RemovedJobAction类的典型用法代码示例。如果您正苦于以下问题:Java RemovedJobAction类的具体用法?Java RemovedJobAction怎么用?Java RemovedJobAction使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RemovedJobAction类属于javaposse.jobdsl.plugin包,在下文中一共展示了RemovedJobAction类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: before
import javaposse.jobdsl.plugin.RemovedJobAction; //导入依赖的package包/类
private void before(Description description) throws Exception {
FreeStyleProject job = jRule.createFreeStyleProject();
String script = description.getAnnotation(WithJobDsl.class).value();
String scriptText = Resources.toString(Resources.getResource(script), Charsets.UTF_8);
job.getBuildersList().add(
new ExecuteDslScripts(
new ExecuteDslScripts.ScriptLocation(
null, null,
scriptText
),
false,
RemovedJobAction.DELETE,
RemovedViewAction.DELETE,
LookupStrategy.JENKINS_ROOT
)
);
jRule.buildAndAssertSuccess(job);
assertThat(jRule.getInstance().getJobNames(), hasItem(is(JOB_NAME_IN_DSL_SCRIPT)));
generated = jRule.getInstance().getItemByFullName(JOB_NAME_IN_DSL_SCRIPT, FreeStyleProject.class);
}
示例2: shouldCreateJobWithExtendedDsl
import javaposse.jobdsl.plugin.RemovedJobAction; //导入依赖的package包/类
@Test
public void shouldCreateJobWithExtendedDsl() throws Exception {
FreeStyleProject job = jenkins.createFreeStyleProject();
job.getBuildersList().add(
new ExecuteDslScripts(
new ExecuteDslScripts.ScriptLocation(
null, null,
IOUtils.toString(this
.getClass().getClassLoader().getResourceAsStream(JOB_DSL_GROOVY))
),
false,
RemovedJobAction.DELETE,
RemovedViewAction.DELETE,
LookupStrategy.JENKINS_ROOT
)
);
jenkins.buildAndAssertSuccess(job);
assertThat(jenkins.getInstance().getJobNames(), hasItem(is(JOB_NAME_IN_DSL_SCRIPT)));
FreeStyleProject generated = jenkins.getInstance()
.getItemByFullName(JOB_NAME_IN_DSL_SCRIPT, FreeStyleProject.class);
Collection<Trigger<?>> triggers = generated.getTriggers().values();
assertThat("Should add trigger", triggers, hasSize(1));
GitHubBranchTrigger trigger = (GitHubBranchTrigger) triggers.toArray()[0];
assertThat("Should add trigger of GHPR class", trigger, instanceOf(GitHubBranchTrigger.class));
assertThat("Should have pre status", trigger.isPreStatus(), equalTo(true));
assertThat("Should have cancel queued", trigger.isCancelQueued(), equalTo(true));
assertThat("Should add events", trigger.getEvents(), hasSize(5));
assertThat("Should set mode", trigger.getTriggerMode(), equalTo(HEAVY_HOOKS_CRON));
/*
* note: this are explicity placed in the first and second positions so it's easier to
* pluck them back out for explicit testing
*/
verifyBranchFilter(trigger.getEvents().get(0));
verifyCommitChecks(trigger.getEvents().get(1));
final List<GitHubRepoProvider> repoProviders = trigger.getRepoProviders();
assertThat("Should contain repoProvider", repoProviders, notNullValue());
assertThat("Should contain 1 repoProvider", repoProviders, hasSize(1));
final GitHubRepoProvider repoProvider = repoProviders.get(0);
assertThat(repoProvider, instanceOf(GitHubPluginRepoProvider.class));
final GitHubPluginRepoProvider provider = (GitHubPluginRepoProvider) repoProvider;
assertThat(provider.isCacheConnection(), is(false));
assertThat(provider.isManageHooks(), is(false));
assertThat(provider.getRepoPermission(), is(PULL));
}
示例3: shouldCreateJobWithExtendedDsl
import javaposse.jobdsl.plugin.RemovedJobAction; //导入依赖的package包/类
@Test
public void shouldCreateJobWithExtendedDsl() throws Exception {
FreeStyleProject job = jenkins.createFreeStyleProject();
job.getBuildersList().add(
new ExecuteDslScripts(
new ExecuteDslScripts.ScriptLocation(
null, null,
IOUtils.toString(this
.getClass().getClassLoader().getResourceAsStream(JOB_DSL_GROOVY))
),
false,
RemovedJobAction.DELETE,
RemovedViewAction.DELETE,
LookupStrategy.JENKINS_ROOT
)
);
jenkins.buildAndAssertSuccess(job);
assertThat(jenkins.getInstance().getJobNames(), hasItem(is(JOB_NAME_IN_DSL_SCRIPT)));
FreeStyleProject generated = jenkins.getInstance()
.getItemByFullName(JOB_NAME_IN_DSL_SCRIPT, FreeStyleProject.class);
final DescribableList<Builder, Descriptor<Builder>> builders = generated.getBuildersList();
assertThat("Should have builder", builders, hasSize(1));
assertThat("Should add status builder", builders.get(0), instanceOf(GitHubPRStatusBuilder.class));
assertThat("Should add message",
((GitHubPRStatusBuilder) builders.get(0)).getStatusMessage().getContent(),
equalTo(JOB_DSL_BUILDER_TEXT_CONTENT));
verifyPublishers(generated.getPublishersList());
Collection<Trigger<?>> triggers = generated.getTriggers().values();
assertThat("Should add trigger", triggers, hasSize(1));
GitHubPRTrigger trigger = (GitHubPRTrigger) triggers.toArray()[0];
assertThat("Should add trigger of GHPR class", trigger, instanceOf(GitHubPRTrigger.class));
assertThat("Should have pre status", trigger.isPreStatus(), equalTo(true));
assertThat("Should have cancel queued", trigger.isCancelQueued(), equalTo(true));
assertThat("Should set mode", trigger.getTriggerMode(), equalTo(HEAVY_HOOKS_CRON));
final List<GitHubRepoProvider> repoProviders = trigger.getRepoProviders();
assertThat("Should contain repoProvider", repoProviders, notNullValue());
assertThat("Should contain 1 repoProvider", repoProviders, hasSize(1));
final GitHubRepoProvider repoProvider = repoProviders.get(0);
assertThat(repoProvider, instanceOf(GitHubPluginRepoProvider.class));
final GitHubPluginRepoProvider provider = (GitHubPluginRepoProvider) repoProvider;
assertThat(provider.isCacheConnection(), is(false));
assertThat(provider.isManageHooks(), is(false));
assertThat(provider.getRepoPermission(), is(PUSH));
final List<GitHubPREvent> events = trigger.getEvents();
assertThat("Should add events", events, hasSize(17));
GitHubPREvent event = events.get(15);
assertThat(event, instanceOf(GitHubPRNumber.class));
assertThat(((GitHubPRNumber) event).isSkip(), is(false));
assertThat(((GitHubPRNumber) event).isMatch(), is(true));
event = events.get(16);
assertThat(event, instanceOf(GitHubPRNumber.class));
assertThat(((GitHubPRNumber) event).isSkip(), is(true));
assertThat(((GitHubPRNumber) event).isMatch(), is(true));
}