本文整理汇总了Java中hudson.matrix.MatrixProject类的典型用法代码示例。如果您正苦于以下问题:Java MatrixProject类的具体用法?Java MatrixProject怎么用?Java MatrixProject使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MatrixProject类属于hudson.matrix包,在下文中一共展示了MatrixProject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testMatrixToMatrix
import hudson.matrix.MatrixProject; //导入依赖的package包/类
/** Test artifact copy between matrix jobs, for artifact from matching axis */
@Test
public void testMatrixToMatrix() throws Exception {
MatrixProject other = createMatrixArtifactProject(),
p = createMatrixProject();
p.setAxes(new AxisList(new Axis("FOO", "one", "two"))); // should match other job
p.getBuildersList().add(CopyArtifactUtil.createRunSelector(other.getName() + "/FOO=$FOO", null,
new StatusRunSelector(StatusRunSelector.BuildStatus.STABLE), "", "", false, false, true));
rule.assertBuildStatusSuccess(other.scheduleBuild2(0, new UserCause()).get());
MatrixBuild b = p.scheduleBuild2(0, new UserCause()).get();
rule.assertBuildStatusSuccess(b);
MatrixRun r = b.getRun(new Combination(Collections.singletonMap("FOO", "one")));
assertFile(true, "one.txt", r);
assertFile(false, "two.txt", r);
r = b.getRun(new Combination(Collections.singletonMap("FOO", "two")));
assertFile(false, "one.txt", r);
assertFile(true, "two.txt", r);
}
示例2: testMatrixAll
import hudson.matrix.MatrixProject; //导入依赖的package包/类
/** Test copying artifacts from all configurations of a matrix job */
@Test
public void testMatrixAll() throws Exception {
MatrixProject mp = createMatrixProject();
mp.setAxes(new AxisList(new Axis("ARCH", "sparc", "x86")));
mp.getBuildersList().add(new ArchMatrixBuilder());
mp.getPublishersList().add(new ArtifactArchiver("target/*", "", false, false));
rule.assertBuildStatusSuccess(mp.scheduleBuild2(0, new UserCause()).get());
FreeStyleProject p = createProject(mp.getName(), null, "", "", true, false, false, true);
FreeStyleBuild b = p.scheduleBuild2(0, new UserCause()).get();
rule.assertBuildStatusSuccess(b);
assertFile(true, "ARCH=sparc/target/readme.txt", b);
assertFile(true, "ARCH=sparc/target/sparc.out", b);
assertFile(true, "ARCH=x86/target/readme.txt", b);
assertFile(true, "ARCH=x86/target/x86.out", b);
}
示例3: testProjectNameSplit
import hudson.matrix.MatrixProject; //导入依赖的package包/类
@LocalData
@Test
public void testProjectNameSplit() throws Exception {
FreeStyleProject copier = Jenkins.getInstance().getItemByFullName("copier", FreeStyleProject.class);
assertNotNull(copier);
String configXml = copier.getConfigFile().asString();
assertFalse(configXml, configXml.contains("<projectName>"));
assertTrue(configXml, configXml.contains("<project>plain</project>"));
assertTrue(configXml, configXml.contains("<project>parameterized</project>"));
assertTrue(configXml, configXml.contains("<paramsToMatch>good=true</paramsToMatch>"));
assertTrue(configXml, configXml.contains("<project>matrix/which=two</project>"));
MatrixProject matrixCopier = Jenkins.getInstance().getItemByFullName("matrix-copier", MatrixProject.class);
assertNotNull(matrixCopier);
configXml = matrixCopier.getConfigFile().asString();
assertFalse(configXml, configXml.contains("<projectName>"));
// When a project is specified with a variable, it is split improperly.
assertTrue(configXml, configXml.contains("<project>matrix</project>"));
assertTrue(configXml, configXml.contains("<paramsToMatch>which=${which}</paramsToMatch>"));
}
示例4: executeCheck
import hudson.matrix.MatrixProject; //导入依赖的package包/类
public boolean executeCheck(Item item) {
boolean notfound = true;
if (Jenkins.getInstance().pluginManager.getPlugin("build-timeout") != null) {
if (item.getClass().getName().endsWith("hudson.maven.MavenModuleSet")) {
try {
Method method = item.getClass().getMethod("getBuildWrappersList");
DescribableList<BuildWrapper,Descriptor<BuildWrapper>> buildWrapperList = ((DescribableList<BuildWrapper,Descriptor<BuildWrapper>>) method.invoke(item));
notfound = !isTimeout(buildWrapperList);
} catch (Exception e) {
LOG.log(Level.WARNING, "Exception " + e.getMessage(), e.getCause());
notfound = false;
}
}
if (item instanceof Project) {
notfound = !isTimeout(((Project) item).getBuildWrappersList());
}
if (item instanceof MatrixProject) {
notfound = !isTimeout(((MatrixProject) item).getBuildWrappersList());
}
}
return notfound;
}
示例5: executeCheck
import hudson.matrix.MatrixProject; //导入依赖的package包/类
public boolean executeCheck(Item item) {
boolean found = false;
if (Jenkins.getInstance().pluginManager.getPlugin("gradle") != null) {
if (Jenkins.getInstance().pluginManager.getPlugin("maven-plugin")!=null) {
if (item instanceof MavenModuleSet) {
found = isGradlew(((MavenModuleSet) item).getPrebuilders());
}
}
if (item instanceof Project) {
found = isGradlew(((Project) item).getBuilders());
}
if (item instanceof MatrixProject) {
found = isGradlew(((MatrixProject) item).getBuilders());
}
}
return found;
}
示例6: executeCheck
import hudson.matrix.MatrixProject; //导入依赖的package包/类
public boolean executeCheck(Item item) {
LOG.log(Level.FINE, "executeCheck " + item);
boolean found = false;
if (Jenkins.getInstance().pluginManager.getPlugin("maven-plugin")!=null) {
if (item instanceof MavenModuleSet) {
found = isBuilderHarcoded(((MavenModuleSet) item).getPrebuilders());
}
}
if (item instanceof Project) {
found = isBuilderHarcoded (((Project)item).getBuilders());
}
if (item instanceof MatrixProject) {
found = isBuilderHarcoded (((MatrixProject)item).getBuilders());
}
return found;
}
示例7: testMatrixProjectWithTimeout
import hudson.matrix.MatrixProject; //导入依赖的package包/类
@Test public void testMatrixProjectWithTimeout() throws Exception {
MatrixProject project = j.createMatrixProject("NoActivityTimeOut");
project.getBuildWrappersList().add(createNoActivityTimeOut());
assertFalse(checker.executeCheck(project));
project.delete();
project = j.createMatrixProject("AbsoluteTimeOutStrategy");
project.getBuildWrappersList().add(createAbsoluteTimeOutStrategy());
assertFalse(checker.executeCheck(project));
project.delete();
project = j.createMatrixProject("DeadlineTimeOutStrategy");
project.getBuildWrappersList().add(createDeadlineTimeOutStrategy());
assertFalse(checker.executeCheck(project));
project.delete();
project = j.createMatrixProject("ElasticTimeOutStrategy");
project.getBuildWrappersList().add(createElasticTimeOutStrategy());
assertFalse(checker.executeCheck(project));
project.delete();
project = j.createMatrixProject("LikelyStuckTimeOutStrategy");
project.getBuildWrappersList().add(createLikelyStuckTimeOutStrategy());
assertFalse(checker.executeCheck(project));
}
示例8: testMatrixProjectWithHardcodedScript
import hudson.matrix.MatrixProject; //导入依赖的package包/类
@Test public void testMatrixProjectWithHardcodedScript() throws Exception {
MatrixProject project = j.createMatrixProject("Bash_Single_Line");
project.getBuildersList().add(new hudson.tasks.Shell("#!/bin/bash #single line"));
assertFalse(checker.executeCheck(project));
project.delete();
project = j.createMatrixProject("Bash_Multiple_Line");
project.getBuildersList().add(new hudson.tasks.Shell("#!/bin/bash\nline1\nline2\nline3\nline4\nline5\nline6"));
assertTrue(checker.executeCheck(project));
project.delete();
project = j.createMatrixProject("Batch_Single_Line");
project.getBuildersList().add(new hudson.tasks.BatchFile("echo first"));
assertFalse(checker.executeCheck(project));
project.delete();
project = j.createMatrixProject("Batch_Multiple_Line");
project.getBuildersList().add(new hudson.tasks.BatchFile("echo first\nline1\nline2\nline3\nline4\nline5\nline6"));
assertTrue(checker.executeCheck(project));
}
示例9: testMatrixNesting
import hudson.matrix.MatrixProject; //导入依赖的package包/类
@Test
public void testMatrixNesting() throws Exception {
TestBranchAwareProject topLevelProject =
Jenkins.getInstance().createProject(
TestBranchAwareProject.class, "topLevelProject");
MatrixProject leafProject = MatrixProject.DESCRIPTOR.newInstance(
topLevelProject, "foo");
leafProject.setScm(new DelegateSCM(TestBranchAwareProject.class));
topLevelProject.setItem(leafProject);
leafProject.onCreatedFromScratch();
// Run the outer job, which should delegate to our inner project
TestBuild outerBuild = topLevelProject.scheduleBuild2(0).get();
// Test that our outer job was a success
dumpLog(outerBuild);
assertEquals(Result.SUCCESS, outerBuild.getResult());
// Test that our inner job was a success
AbstractBuild innerBuild = leafProject.getBuildByNumber(1);
dumpLog(innerBuild);
assertEquals(Result.SUCCESS, innerBuild.getResult());
}
示例10: matrixProjectTest
import hudson.matrix.MatrixProject; //导入依赖的package包/类
@Test
public void matrixProjectTest() throws IOException, InterruptedException, ExecutionException {
EnvVars env;
MatrixProject p = jenkins.jenkins.createProject(MatrixProject.class, "matrixbuild");
GitLabWebHookCause cause = new GitLabWebHookCause(generateCauseData());
// set up 2x2 matrix
AxisList axes = new AxisList();
axes.add(new TextAxis("db","mysql","oracle"));
axes.add(new TextAxis("direction","north","south"));
p.setAxes(axes);
MatrixBuild build = p.scheduleBuild2(0, cause).get();
List<MatrixRun> runs = build.getRuns();
assertEquals(4,runs.size());
for (MatrixRun run : runs) {
env = run.getEnvironment(listener);
assertNotNull(env.get("db"));
assertEnv(env);
}
}
示例11: oneBuildBasicMergeFailure
import hudson.matrix.MatrixProject; //导入依赖的package包/类
@Test
public void oneBuildBasicMergeFailure() throws Exception {
repository = TestUtilsFactory.createRepositoryWithMergeConflict("test-repo");
File workDir = new File(TestUtilsFactory.WORKDIR,"test-repo");
Git.cloneRepository().setURI("file:///" + repository.getDirectory().getAbsolutePath()).setDirectory(workDir)
.setBare(false)
.setCloneAllBranches(true)
.setNoCheckout(false)
.call().close();
MatrixProjectBuilder builder = new MatrixProjectBuilder()
.setGitRepos(Collections.singletonList(new UserRemoteConfig("file://" + repository.getDirectory().getAbsolutePath(), null, null, null)))
.setUseSlaves(true).setRule(jenkinsRule)
.setStrategy(TestUtilsFactory.STRATEGY_TYPE.ACCUMULATED);
builder.setJobType(MatrixProject.class);
MatrixProject project = (MatrixProject)builder.generateJenkinsJob();
TestUtilsFactory.triggerProject(project);
jenkinsRule.waitUntilNoActivityUpTo(60000);
jenkinsRule.assertBuildStatus(Result.FAILURE, project.getLastBuild());
assertEquals("3 runs for this particular matrix build", 3, project.getLastBuild().getRuns().size());
}
示例12: testIsBuildParent
import hudson.matrix.MatrixProject; //导入依赖的package包/类
@Test
public void testIsBuildParent() throws IOException {
MatrixProject project = new MatrixProject("MatrixTest");
String credential = "123";
Workspace workspace = new StaticWorkspaceImpl("none", false, defaultClient());
Populate populate = new AutoCleanImpl();
PerforceScm scm = new PerforceScm(credential, workspace, populate);
project.setScm(scm);
project.setExecutionStrategy(new DefaultMatrixExecutionStrategyImpl());
assertFalse("isBuildParent should be false for default execution strategy",
scm.isBuildParent(project));
project.setExecutionStrategy(new MatrixOptions(true, false, false));
assertTrue("isBuildParent should be true when MatrixOptions#buildParent is true",
scm.isBuildParent(project));
project.setExecutionStrategy(new MatrixOptions(false, true, true));
assertFalse("isBuildParent should be false when MatrixOptions#buildParent is false",
scm.isBuildParent(project));
}
示例13: testStageNameForMultiConfiguration
import hudson.matrix.MatrixProject; //导入依赖的package包/类
@Test
@Issue("JENKINS-22654")
public void testStageNameForMultiConfiguration() throws Exception {
MatrixProject project = jenkins.createMatrixProject("Multi");
project.setAxes(new AxisList(new Axis("axis", "foo", "bar")));
project.addProperty(new PipelineProperty("task", "stage", ""));
Collection<MatrixConfiguration> configurations = project.getActiveConfigurations();
for (MatrixConfiguration configuration : configurations) {
List<Stage> stages = Stage.extractStages(configuration, null);
assertEquals(1, stages.size());
Stage stage = stages.get(0);
assertEquals("stage", stage.getName());
}
}
示例14: createMatrixArtifactProject
import hudson.matrix.MatrixProject; //导入依赖的package包/类
private MatrixProject createMatrixArtifactProject() throws IOException {
MatrixProject p = createMatrixProject();
p.setAxes(new AxisList(new Axis("FOO", "one", "two")));
p.getBuildersList().add(new ArtifactBuilder());
p.getPublishersList().add(new ArtifactArchiver("**", "", false, false));
return p;
}
示例15: testMatrixJob
import hudson.matrix.MatrixProject; //导入依赖的package包/类
/** Test copying artifacts from a particular configuration of a matrix job */
@Test
public void testMatrixJob() throws Exception {
MatrixProject other = createMatrixArtifactProject();
FreeStyleProject p = createProject(other.getName() + "/FOO=two", null, "", "",
true, false, false, true);
rule.assertBuildStatusSuccess(other.scheduleBuild2(0, new UserCause()).get());
FreeStyleBuild b = p.scheduleBuild2(0, new UserCause()).get();
rule.assertBuildStatusSuccess(b);
assertFile(true, "foo.txt", b);
assertFile(true, "two.txt", b);
assertFile(true, "subdir/subfoo.txt", b);
assertFile(true, "deepfoo/a/b/c.log", b);
}