本文整理汇总了Java中hudson.tasks.BuildTrigger类的典型用法代码示例。如果您正苦于以下问题:Java BuildTrigger类的具体用法?Java BuildTrigger怎么用?Java BuildTrigger使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
BuildTrigger类属于hudson.tasks包,在下文中一共展示了BuildTrigger类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testTagTranslations
import hudson.tasks.BuildTrigger; //导入依赖的package包/类
@Test
public void testTagTranslations() throws Exception {
YamlToJson underTest = new YamlToJson.Default(
ImmutableList.<YamlTransform>of(
new HelperTransform("!freestyle", FreeStyleProject.class),
new HelperTransform("!maven", Maven.class),
new HelperTransform("!git", GitSCM.class) {
@Override
public String construct(String value) {
assertEquals("scm", value);
return clazz.getName();
}
},
new HelperTransform("!shell", Shell.class),
new HelperTransform("!trigger", BuildTrigger.class),
new HelperTransform("!mailer", Mailer.class)));
for (String test : TAG_TESTS) {
testOneTranslation(underTest, test);
}
}
示例2: testTagTranslations
import hudson.tasks.BuildTrigger; //导入依赖的package包/类
@Test
public void testTagTranslations() throws Exception {
JsonToYaml underTest = new JsonToYaml.Default(
ImmutableList.<YamlTransform>of(
new HelperTransform("!freestyle", FreeStyleProject.class),
new HelperTransform("!maven", Maven.class),
new HelperTransform("!git", GitSCM.class) {
@Override
public String represent(Class clazz) {
assertEquals(this.clazz, clazz);
return "scm";
}
@Override
public String construct(String value) {
assertEquals("scm", value);
return this.clazz.getName();
}
},
new HelperTransform("!shell", Shell.class),
new HelperTransform("!trigger", BuildTrigger.class),
new HelperTransform("!mailer", Mailer.class)));
for (String test : TAG_TESTS) {
testOneTranslation(underTest, test);
}
}
示例3: testWithBuildNameSetterPlugin
import hudson.tasks.BuildTrigger; //导入依赖的package包/类
@Test
public void testWithBuildNameSetterPlugin() throws Exception {
FreeStyleProject a = jenkins.createFreeStyleProject("a");
FreeStyleProject b = jenkins.createFreeStyleProject("b");
a.getPublishersList().add(new BuildTrigger("b", false));
a.getBuildWrappersList().add(new PipelineVersionContributor(true, "1.0.0.$BUILD_NUMBER"));
b.getBuildWrappersList().add(new BuildNameSetter("$PIPELINE_VERSION"));
jenkins.getInstance().rebuildDependencyGraph();
jenkins.setQuietPeriod(0);
jenkins.buildAndAssertSuccess(a);
jenkins.waitUntilNoActivity();
assertEquals("1.0.0.1", a.getLastBuild().getDisplayName());
assertEquals("1.0.0.1", b.getLastBuild().getDisplayName());
}
示例4: testVersionContributorNotConfigured
import hudson.tasks.BuildTrigger; //导入依赖的package包/类
@Test
public void testVersionContributorNotConfigured() throws Exception {
final FreeStyleProject firstProject = jenkins.createFreeStyleProject("firstProject");
final FreeStyleProject secondProject = jenkins.createFreeStyleProject("secondProject");
firstProject.getPublishersList().add(new BuildTrigger("secondProject", false));
firstProject.save();
firstProject.getBuildersList().add(new AssertNoPipelineVersion());
secondProject.getBuildersList().add(new AssertNoPipelineVersion());
jenkins.setQuietPeriod(0);
jenkins.getInstance().rebuildDependencyGraph();
jenkins.buildAndAssertSuccess(firstProject);
jenkins.waitUntilNoActivity();
assertNotNull(firstProject.getLastBuild());
assertNotNull(secondProject.getLastBuild());
}
示例5: testVersionNoDisplayname
import hudson.tasks.BuildTrigger; //导入依赖的package包/类
@Test
public void testVersionNoDisplayname() throws Exception {
FreeStyleProject firstProject = jenkins.createFreeStyleProject("firstProject");
FreeStyleProject secondProject = jenkins.createFreeStyleProject("secondProject");
firstProject.getPublishersList().add(new BuildTrigger("secondProject", false));
firstProject.getBuildWrappersList().add(new PipelineVersionContributor(false, "1.0.0.${BUILD_NUMBER}"));
firstProject.getBuildersList().add(new AssertPipelineVersion("1.0.0.1"));
secondProject.getBuildersList().add(new AssertPipelineVersion("1.0.0.1"));
jenkins.setQuietPeriod(0);
jenkins.getInstance().rebuildDependencyGraph();
jenkins.buildAndAssertSuccess(firstProject);
jenkins.waitUntilNoActivity();
assertNotNull(firstProject.getLastBuild());
assertNotNull(secondProject.getLastBuild());
assertEquals("#1", firstProject.getLastBuild().getDisplayName());
}
示例6: testVersionContributorConfigured
import hudson.tasks.BuildTrigger; //导入依赖的package包/类
@Test
public void testVersionContributorConfigured() throws Exception {
FreeStyleProject firstProject = jenkins.createFreeStyleProject("firstProject");
FreeStyleProject secondProject = jenkins.createFreeStyleProject("secondProject");
firstProject.getPublishersList().add(new BuildTrigger("secondProject", false));
firstProject.getBuildWrappersList().add(new PipelineVersionContributor(true, "1.0.0.${BUILD_NUMBER}"));
firstProject.getBuildersList().add(new AssertPipelineVersion("1.0.0.1"));
secondProject.getBuildersList().add(new AssertPipelineVersion("1.0.0.1"));
jenkins.setQuietPeriod(0);
jenkins.getInstance().rebuildDependencyGraph();
jenkins.buildAndAssertSuccess(firstProject);
jenkins.waitUntilNoActivity();
assertNotNull(firstProject.getLastBuild());
assertNotNull(secondProject.getLastBuild());
assertEquals("1.0.0.1", firstProject.getLastBuild().getDisplayName());
}
示例7: testWithBuildNameSetterPluginAndAdditionalParameters
import hudson.tasks.BuildTrigger; //导入依赖的package包/类
@Test
@Issue("JENKINS-28848")
public void testWithBuildNameSetterPluginAndAdditionalParameters() throws Exception {
FreeStyleProject a = jenkins.createFreeStyleProject("a");
FreeStyleProject b = jenkins.createFreeStyleProject("b");
a.addProperty(new ParametersDefinitionProperty(new StringParameterDefinition("BUILD_VERSION", "DEFAULT_VALUE")));
a.getPublishersList().add(new BuildTrigger("b", false));
a.getBuildWrappersList().add(new PipelineVersionContributor(true, "1.0.0.$BUILD_NUMBER"));
b.getBuildWrappersList().add(new BuildNameSetter("$PIPELINE_VERSION"));
jenkins.getInstance().rebuildDependencyGraph();
jenkins.setQuietPeriod(0);
jenkins.buildAndAssertSuccess(a);
jenkins.waitUntilNoActivity();
assertEquals("1.0.0.1", a.getLastBuild().getDisplayName());
assertEquals("1.0.0.1", b.getLastBuild().getDisplayName());
assertEquals("1.0.0.1", a.getLastBuild().getBuildVariableResolver().resolve(PIPELINE_VERSION));
assertEquals("1.0.0.1", b.getLastBuild().getBuildVariableResolver().resolve(PIPELINE_VERSION));
}
示例8: testGetItemsAndContains
import hudson.tasks.BuildTrigger; //导入依赖的package包/类
@Test
public void testGetItemsAndContains() throws Exception {
final FreeStyleProject build = jenkins.createFreeStyleProject("build");
final FreeStyleProject sonar = jenkins.createFreeStyleProject("sonar");
final FreeStyleProject packaging = jenkins.createFreeStyleProject("packaging");
build.getPublishersList().add(new BuildTrigger("sonar", false));
build.getPublishersList().add(new BuildTrigger("packaging", false));
jenkins.getInstance().rebuildDependencyGraph();
List<DeliveryPipelineView.ComponentSpec> specs = new ArrayList<>();
specs.add(new DeliveryPipelineView.ComponentSpec("Comp", "build", NONE, DO_NOT_SHOW_UPSTREAM));
DeliveryPipelineView view = new DeliveryPipelineView("name");
view.setComponentSpecs(specs);
jenkins.getInstance().addView(view);
assertTrue(view.contains(build));
assertTrue(view.contains(sonar));
assertTrue(view.contains(packaging));
Collection<TopLevelItem> items = view.getItems();
assertEquals(3, items.size());
}
示例9: testGetItemsAndContainsWithFolders
import hudson.tasks.BuildTrigger; //导入依赖的package包/类
@Test
public void testGetItemsAndContainsWithFolders() throws Exception {
MockFolder folder = jenkins.createFolder("folder");
final FreeStyleProject build = folder.createProject(FreeStyleProject.class, "build");
final FreeStyleProject sonar = folder.createProject(FreeStyleProject.class, "sonar");
final FreeStyleProject packaging = folder.createProject(FreeStyleProject.class, "packaging");
build.getPublishersList().add(new BuildTrigger("sonar", false));
build.getPublishersList().add(new BuildTrigger("packaging", false));
jenkins.getInstance().rebuildDependencyGraph();
List<DeliveryPipelineView.ComponentSpec> specs = new ArrayList<>();
specs.add(new DeliveryPipelineView.ComponentSpec("Comp", "build", NONE, DO_NOT_SHOW_UPSTREAM));
DeliveryPipelineView view = new DeliveryPipelineView("name");
view.setComponentSpecs(specs);
folder.addView(view);
assertTrue(view.contains(build));
assertTrue(view.contains(sonar));
assertTrue(view.contains(packaging));
Collection<TopLevelItem> items = view.getItems();
assertEquals(3, items.size());
}
示例10: testGetPipelineViewWithLastJobProvided
import hudson.tasks.BuildTrigger; //导入依赖的package包/类
@Test
public void testGetPipelineViewWithLastJobProvided() throws Exception {
FreeStyleProject build = jenkins.createFreeStyleProject("build");
FreeStyleProject test = jenkins.createFreeStyleProject("test");
FreeStyleProject deploy = jenkins.createFreeStyleProject("deploy");
build.getPublishersList().add(new BuildTrigger(test.getName(), false));
test.getPublishersList().add(new BuildTrigger(deploy.getName(), false));
jenkins.getInstance().rebuildDependencyGraph();
jenkins.buildAndAssertSuccess(build);
jenkins.waitUntilNoActivity();
List<DeliveryPipelineView.ComponentSpec> specs = new ArrayList<>();
specs.add(new DeliveryPipelineView.ComponentSpec("Comp", "build", "test", DO_NOT_SHOW_UPSTREAM));
DeliveryPipelineView view = new DeliveryPipelineView("Pipeline");
view.setComponentSpecs(specs);
view.setSorting(NameComparator.class.getName());
jenkins.getInstance().addView(view);
view.getPipelines();
assertNull(view.getError());
}
示例11: testGetItems
import hudson.tasks.BuildTrigger; //导入依赖的package包/类
@Test
public void testGetItems() throws IOException {
final FreeStyleProject firstJob = jenkins.createFreeStyleProject("Project1");
final FreeStyleProject secondJob = jenkins.createFreeStyleProject("Project2");
final FreeStyleProject thirdJob = jenkins.createFreeStyleProject("Project3");
firstJob.getPublishersList().add((new BuildTrigger(secondJob.getName(), true)));
jenkins.getInstance().rebuildDependencyGraph();
DeliveryPipelineView pipeline = new DeliveryPipelineView("Pipeline");
List<DeliveryPipelineView.ComponentSpec> componentSpecs = new ArrayList<>();
componentSpecs.add(new DeliveryPipelineView.ComponentSpec("Spec", firstJob.getName(), NONE, DO_NOT_SHOW_UPSTREAM));
pipeline.setComponentSpecs(componentSpecs);
jenkins.getInstance().addView(pipeline);
Collection<TopLevelItem> jobs = pipeline.getItems();
assertTrue(jobs.contains(firstJob));
assertTrue(jobs.contains(secondJob));
assertFalse(jobs.contains(thirdJob));
}
示例12: testResolveWithSimpleTrigger
import hudson.tasks.BuildTrigger; //导入依赖的package包/类
@Test
public void testResolveWithSimpleTrigger() throws Exception {
FreeStyleProject a = jenkins.createFreeStyleProject("a");
jenkins.createFreeStyleProject("b");
jenkins.createFreeStyleProject("c");
a.getPublishersList().add(new BuildTrigger("b", false));
JobPropertyImpl property = new JobPropertyImpl(a);
PromotionProcess process = property.addProcess("process");
process.conditions.add(new DownstreamPassCondition("b", false));
process.getBuildSteps().add(new BuildTrigger("c", false));
process.save();
a.addProperty(property);
jenkins.getInstance().rebuildDependencyGraph();
PromotedBuildRelationshipResolver resolver = new PromotedBuildRelationshipResolver();
List<AbstractProject> projects = resolver.getDownstreamProjects(a);
assertEquals(1, projects.size());
}
示例13: testResolveWithParamTrigger
import hudson.tasks.BuildTrigger; //导入依赖的package包/类
@Test
public void testResolveWithParamTrigger() throws Exception {
FreeStyleProject a = jenkins.createFreeStyleProject("a");
jenkins.createFreeStyleProject("b");
jenkins.createFreeStyleProject("c");
a.getPublishersList().add(new BuildTrigger("b", false));
JobPropertyImpl property = new JobPropertyImpl(a);
PromotionProcess process = property.addProcess("process");
process.conditions.add(new DownstreamPassCondition("b", false));
process.getBuildSteps().add(new hudson.plugins.parameterizedtrigger.BuildTrigger(new BuildTriggerConfig("c", ResultCondition.ALWAYS)));
process.save();
a.addProperty(property);
jenkins.getInstance().rebuildDependencyGraph();
PromotedBuildRelationshipResolver resolver = new PromotedBuildRelationshipResolver();
List<AbstractProject> projects = resolver.getDownstreamProjects(a);
assertEquals(1, projects.size());
}
示例14: testResolveWithBuildTrigger
import hudson.tasks.BuildTrigger; //导入依赖的package包/类
@Test
@Issue("JENKINS-28347")
public void testResolveWithBuildTrigger() throws Exception {
FreeStyleProject a = jenkins.createFreeStyleProject("a");
jenkins.createFreeStyleProject("b");
jenkins.createFreeStyleProject("c");
a.getPublishersList().add(new BuildTrigger("b", false));
JobPropertyImpl property = new JobPropertyImpl(a);
PromotionProcess process = property.addProcess("process");
process.conditions.add(new DownstreamPassCondition("b", false));
process.getBuildSteps().add(new hudson.plugins.parameterizedtrigger.TriggerBuilder(new BlockableBuildTriggerConfig("b", new BlockingBehaviour(Result.FAILURE, Result.UNSTABLE, Result.FAILURE), null)));
process.save();
a.addProperty(property);
jenkins.getInstance().rebuildDependencyGraph();
PromotedBuildRelationshipResolver resolver = new PromotedBuildRelationshipResolver();
List<AbstractProject> projects = resolver.getDownstreamProjects(a);
assertEquals(1, projects.size());
}
示例15: testFirstLastProjects
import hudson.tasks.BuildTrigger; //导入依赖的package包/类
@SuppressWarnings("deprecation")
@Test
public void testFirstLastProjects() throws Exception {
FreeStyleProject projectA = jenkins.createFreeStyleProject("projectA");
FreeStyleProject projectB = jenkins.createFreeStyleProject("projectB");
FreeStyleProject projectC = jenkins.createFreeStyleProject("projectC");
FreeStyleProject projectD = jenkins.createFreeStyleProject("projectD");
projectA.getPublishersList().add(new BuildTrigger(projectB.getName(), true));
projectB.getPublishersList().add(new BuildTrigger(projectC.getName(), true));
projectC.getPublishersList().add(new BuildTrigger(projectD.getName(), true));
jenkins.getInstance().rebuildDependencyGraph();
jenkins.getInstance().getExtensionList(RelationshipResolver.class).add(new ProjectRelationshipResolver());
Map<String, AbstractProject<?, ?>> projects = ProjectUtil.getAllDownstreamProjects(projectB, projectC);
assertEquals(2, projects.size());
assertTrue(!projects.containsKey("projectA"));
assertTrue(projects.containsKey("projectB"));
assertTrue(projects.containsKey("projectC"));
assertTrue(!projects.containsKey("projectD"));
}