本文整理汇总了Java中hudson.matrix.AxisList类的典型用法代码示例。如果您正苦于以下问题:Java AxisList类的具体用法?Java AxisList怎么用?Java AxisList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AxisList类属于hudson.matrix包,在下文中一共展示了AxisList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testMatrixToMatrix
import hudson.matrix.AxisList; //导入依赖的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.AxisList; //导入依赖的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: matrixProjectTest
import hudson.matrix.AxisList; //导入依赖的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);
}
}
示例4: testStageNameForMultiConfiguration
import hudson.matrix.AxisList; //导入依赖的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());
}
}
示例5: createMatrixArtifactProject
import hudson.matrix.AxisList; //导入依赖的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;
}
示例6: testChildStatuses
import hudson.matrix.AxisList; //导入依赖的package包/类
@Test
public void testChildStatuses() throws Exception {
final MatrixProject matrixProject = jRule.jenkins.createProject(MatrixProject.class, "matrix-project");
matrixProject.addProperty(getPreconfiguredProperty(ghRule.getGhRepo()));
matrixProject.addTrigger(getPreconfiguredPRTrigger());
matrixProject.getBuildersList().add(new GitHubPRStatusBuilder());
matrixProject.getBuildersList().add(new Shell("sleep 10"));
matrixProject.getPublishersList().add(new GitHubPRBuildStatusPublisher());
matrixProject.getPublishersList().add(new GitHubPRCommentPublisher(new GitHubPRMessage("Comment"), null, null));
matrixProject.setAxes(
new AxisList(
new TextAxis("first_axis", "first_value1", "first_value2"),
new TextAxis("second_axis", "sec_value1", "sec_value2")
)
);
matrixProject.save();
super.basicTest(matrixProject);
for (MatrixBuild build : matrixProject.getBuilds()) {
for (MatrixRun matrixRun : build.getRuns()) {
jRule.assertLogNotContains("\tat", matrixRun);
}
}
}
示例7: decode
import hudson.matrix.AxisList; //导入依赖的package包/类
@Override
public Object decode(Class targetClass, Object fromDBObject, MappedField optionalExtraInfo) {
if (fromDBObject == null) return null;
BasicDBList rawList = (BasicDBList) fromDBObject;
AxisList axisList = new AxisList();
for (Object obj : rawList) {
DBObject dbObj = (DBObject) obj;
axisList.add((Axis) getMapper().fromDBObject(optionalExtraInfo.getSubClass(), dbObj, getMapper().createEntityCache()));
}
return axisList;
}
示例8: encode
import hudson.matrix.AxisList; //导入依赖的package包/类
@Override
public Object encode(Object value, MappedField optionalExtraInfo) {
if (value == null) return null;
AxisList axisList = (AxisList) value;
BasicDBList convertedList = new BasicDBList();
for (Axis axis : axisList) {
convertedList.add(getMapper().toDBObject(axis));
}
return convertedList;
}
示例9: setAxisList
import hudson.matrix.AxisList; //导入依赖的package包/类
public void setAxisList(final AxisList axisList) {
this.axisList = axisList;
try {
save();
} catch (final IOException e) {
throw new RuntimeException(e);
}
}
示例10: testTaskNameForMultiConfiguration
import hudson.matrix.AxisList; //导入依赖的package包/类
@Test
@Issue("JENKINS-22654")
public void testTaskNameForMultiConfiguration() 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) {
Task task = Task.getPrototypeTask(configuration, true);
assertEquals("task " + configuration.getName(), task.getName());
}
}
示例11: testProjectPreferenceForMatrix
import hudson.matrix.AxisList; //导入依赖的package包/类
@Test
public void testProjectPreferenceForMatrix() throws Exception
{
setScoringRule(new NodePreferenceScoringRule(4, 2));
DumbSlave node1 = j.createOnlineSlave(LabelExpression.parseExpression("nodelabel"));
DumbSlave node2 = j.createOnlineSlave(LabelExpression.parseExpression("nodelabel"));
MatrixProject p = j.createMatrixProject();
p.setAxes(new AxisList(
new TextAxis("axis1", "value1")
));
p.addProperty(new BuildPreferenceJobProperty(Arrays.asList(
new BuildPreference("master", 1),
new BuildPreference("nodelabel", 2),
new BuildPreference(String.format("%s && nodelabel", node1.getNodeName()), 4)
)));
p.save();
p.scheduleBuild2(0).get(BUILD_TIMEOUT, TimeUnit.SECONDS);
assertEquals(1, testScoringRule.calledWorkChunkList.size());
assertEquals(
p.getItem(new Combination(new AxisList(new TextAxis("axis1", "")), "value1")),
testScoringRule.calledWorkChunkList.get(0).get(0)
);
assertEquals(1, testScoringRule.nodesScoreList.size());
assertEquals(2, testScoringRule.nodesScoreList.get(0).getScore(j.jenkins));
assertEquals(12, testScoringRule.nodesScoreList.get(0).getScore(node1));
assertEquals(4, testScoringRule.nodesScoreList.get(0).getScore(node2));
}
示例12: fixAxisList
import hudson.matrix.AxisList; //导入依赖的package包/类
/**
* Inlined from {@link MatrixProject#setAxes(hudson.matrix.AxisList)} except it doesn't call save.
*
* @param matrixProject The project to set the Axis on.
* @param axisList The Axis list to set.
*/
private static void fixAxisList(MatrixProject matrixProject, AxisList axisList) {
if (axisList == null) {
return; //The "axes" field can never be null. So just to be extra careful.
}
ReflectionUtils.setFieldValue(MatrixProject.class, matrixProject, "axes", axisList);
//noinspection unchecked
ReflectionUtils.invokeMethod(MatrixProject.class, matrixProject, "rebuildConfigurations", ReflectionUtils.MethodParameter.get(MatrixBuild.MatrixBuildExecution.class, null));
}
示例13: testAbortRunningMatrixProject
import hudson.matrix.AxisList; //导入依赖的package包/类
@Test
@RandomlyFails(value = "No idea why matrix doesn't work normally")
public void testAbortRunningMatrixProject() throws Exception {
MockFolder folder = j.createFolder("Matrix_folder");
MatrixProject job1 = folder.createProject(MatrixProject.class, "project1");
job1.setDisplayName("project1 display name");
job1.setConcurrentBuild(true);
job1.getBuildersList().add(new SleepBuilder());
job1.setAxes(
new AxisList(
new TextAxis("first_axis", "first_value1"),
new TextAxis("second_axis", "sec_value1")
)
);
configRoundTripUnsecure(job1);
job1.save();
MatrixProject job2 = folder.createProject(MatrixProject.class, "project2");
job2.setDisplayName("project1 display name");
job2.setConcurrentBuild(true);
job2.getBuildersList().add(new SleepBuilder());
job2.setAxes(
new AxisList(
new TextAxis("first_axis", "first_value1"),
new TextAxis("second_axis", "sec_value1")
)
);
configRoundTripUnsecure(job2);
job2.save();
MatrixProject job3 = folder.createProject(MatrixProject.class, "project3");
job3.setDisplayName("project1 display name");
job3.setConcurrentBuild(true);
job3.getBuildersList().add(new SleepBuilder());
job3.setAxes(
new AxisList(
new TextAxis("first_axis", "first_value1"),
new TextAxis("second_axis", "sec_value1")
)
);
configRoundTripUnsecure(job3);
job3.save();
testAbortRunning(job1, job2, job3);
assertThat(job1.getBuilds(), hasSize(3));
for (MatrixBuild matrixBuild : job1.getBuilds()) {
assertThat(matrixBuild.getResult(), is(Result.ABORTED));
assertThat(matrixBuild.getRuns(), not(empty()));
for (MatrixRun matrixRun : matrixBuild.getRuns()) {
assertThat(matrixRun.getResult(), is(Result.ABORTED));
}
}
}
示例14: AxisListConverter
import hudson.matrix.AxisList; //导入依赖的package包/类
public AxisListConverter() {
super(AxisList.class);
}
示例15: getAxisList
import hudson.matrix.AxisList; //导入依赖的package包/类
public AxisList getAxisList() {
return this.runSection.getAxisList();
}