本文整理汇总了Java中hudson.matrix.Combination类的典型用法代码示例。如果您正苦于以下问题:Java Combination类的具体用法?Java Combination怎么用?Java Combination使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Combination类属于hudson.matrix包,在下文中一共展示了Combination类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testMatrixToMatrix
import hudson.matrix.Combination; //导入依赖的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: getCommands
import hudson.matrix.Combination; //导入依赖的package包/类
public List<ShellCommands> getCommands(final Combination combination, final Map<String, Object> dotCiEnvVars) {
final List<ShellCommands> allCommands = new ArrayList<>();
final String dockerComposeContainerName = combination.get("script");
final String projectName = (String) dotCiEnvVars.get("COMPOSE_PROJECT_NAME");
final String fileName = getDockerComposeFileName();
final ShellCommands shellCommands = new ShellCommands();
shellCommands.add(BuildConfiguration.getCheckoutCommands(dotCiEnvVars));
shellCommands.addAll(this.beforeEachSection.getCommands());
shellCommands.addAll(this.beforeSection.getCommands());//deprecated
shellCommands.add(String.format("docker-compose -f %s pull", fileName));
shellCommands.addAll(this.runSection.getCommands(dockerComposeContainerName, fileName));
shellCommands.addAll(this.afterEachSection.getCommands());
if (!isParallelized()) {
shellCommands.addAll(this.afterRunSection.getCommands());
}
allCommands.add(shellCommands);
allCommands.add(getCleanupCommands(dockerComposeContainerName, projectName));
return allCommands;
}
示例3: getDynamic
import hudson.matrix.Combination; //导入依赖的package包/类
@Override
public Object getDynamic(final String token, final StaplerRequest req, final StaplerResponse rsp) {
try {
final Build item = getRun(Combination.fromString(token));
if (item != null) {
if (item.getNumber() == this.getNumber()) {
return item;
} else {
// redirect the user to the correct URL
String url = Functions.joinPath(item.getUrl(), req.getRestOfPath());
final String qs = req.getQueryString();
if (qs != null) {
url += '?' + qs;
}
throw HttpResponses.redirectViaContextPath(url);
}
}
} catch (final IllegalArgumentException e) {
// failed to parse the token as Combination. Must be something else
}
return super.getDynamic(token, req, rsp);
}
示例4: getAxisList
import hudson.matrix.Combination; //导入依赖的package包/类
@Exported
public Iterable<Map> getAxisList() {
final Iterable<Combination> layoutList = this.build.getLayouter().list();
final Iterable<Map> subBuildInfo = Iterables.transform(layoutList, new Function<Combination, Map>() {
@Override
public Map apply(@Nullable final Combination combination) {
final HashMap subBuild = new HashMap();
subBuild.putAll(combination);
final hudson.model.Build run = ProcessedBuild.this.build.getRun(combination);
subBuild.putAll(getSubBuildInfo((DbBackedBuild) run));
return subBuild;
}
});
final ArrayList<Map> subBuilds = Iterables.size(layoutList) > 1 ? Lists.newArrayList(subBuildInfo) : new ArrayList<>();
subBuilds.add(getMainBuildInfo(this.build));
return subBuilds;
}
示例5: runParallelBuild
import hudson.matrix.Combination; //导入依赖的package包/类
private Result runParallelBuild(final DynamicBuild dynamicBuild, final BuildExecutionContext buildExecutionContext, final BuildConfiguration buildConfiguration, final BuildListener listener) throws IOException, InterruptedException {
final SubBuildScheduler subBuildScheduler = new SubBuildScheduler(dynamicBuild, this, new SubBuildScheduler.SubBuildFinishListener() {
@Override
public void runFinished(final DynamicSubBuild subBuild) throws IOException {
for (final DotCiPluginAdapter plugin : buildConfiguration.getPlugins()) {
plugin.runFinished(subBuild, dynamicBuild, listener);
}
}
});
try {
final Iterable<Combination> axisList = buildConfiguration.getAxisList().list();
Result runResult = subBuildScheduler.runSubBuilds(axisList, listener);
if (runResult.equals(Result.SUCCESS)) {
final Result afterRunResult = runAfterCommands(buildExecutionContext, listener);
runResult = runResult.combine(afterRunResult);
}
dynamicBuild.setResult(runResult);
return runResult;
} finally {
try {
subBuildScheduler.cancelSubBuilds(listener.getLogger());
} catch (final Exception e) {
// There is nothing much we can do at this point
}
}
}
示例6: getRun
import hudson.matrix.Combination; //导入依赖的package包/类
public Build getRun(final Combination combination) {
for (final DynamicSubProject subProject : getAllSubProjects()) {
if (subProject.getCombination().equals(combination)) {
return getRunForConfiguration(subProject);
}
}
return null;
}
示例7: runSubBuilds
import hudson.matrix.Combination; //导入依赖的package包/类
public Result runSubBuilds(final Iterable<Combination> subBuildCombinations, final BuildListener listener) throws InterruptedException, IOException {
final Iterable<DynamicSubProject> subProjects = getRunSubProjects(subBuildCombinations);
scheduleSubBuilds(subBuildCombinations, this.subBuildFinishListener, listener);
Result r = Result.SUCCESS;
for (final DynamicSubProject c : subProjects) {
final CurrentBuildState runState = waitForCompletion(c, listener);
final Result runResult = getResult(runState);
r = r.combine(runResult);
listener.getLogger().println("Run " + c.getName() + " finished with : " + runResult);
// subBuildFinishListener.runFinished(c.getBuildByNumber(dynamicBuild.getNumber()) );
}
return r;
}
示例8: scheduleSubBuilds
import hudson.matrix.Combination; //导入依赖的package包/类
protected void scheduleSubBuilds(final Iterable<Combination> subBuildCombinations, final SubBuildFinishListener subBuildFinishListener, final TaskListener listener) {
for (final Combination subBuildCombination : subBuildCombinations) {
final DynamicSubProject c = this.dynamicBuild.getSubProject(subBuildCombination);
listener.getLogger().println(Messages.MatrixBuild_Triggering(ModelHyperlinkNote.encodeTo(c)));
final List<Action> childActions = new ArrayList<>();
childActions.addAll(Util.filter(this.dynamicBuild.getActions(), ParametersAction.class));
childActions.add(new SubBuildExecutionAction(this.subBuildRunner, subBuildFinishListener));
childActions.add(new ParentBuildAction(this.dynamicBuild));
c.scheduleBuild(childActions, this.dynamicBuild.getCause());
}
}
示例9: createNewSubProject
import hudson.matrix.Combination; //导入依赖的package包/类
private DynamicSubProject createNewSubProject(final Combination requestedCombination) {
final DynamicSubProject project = new DynamicSubProject(this, requestedCombination);
try {
project.save();
} catch (final IOException e) {
throw new RuntimeException(e);
}
this.items.put(project.getName(), project);
return project;
}
示例10: should_parallelize_on_run
import hudson.matrix.Combination; //导入依赖的package包/类
@Test
public void should_parallelize_on_run() {
final BuildConfiguration buildConfiguration = new BuildConfiguration(ImmutableMap.of("run", of("unit", "command", "integration", "integration")));
final Iterable<Combination> axisList = buildConfiguration.getAxisList().list();
Assert.assertEquals(2, Iterables.size(axisList));
Assert.assertEquals("script=unit", Iterables.get(axisList, 0).toString());
Assert.assertEquals("script=integration", Iterables.get(axisList, 1).toString());
}
示例11: should_not_run_before_run_for_parallel_subbuild
import hudson.matrix.Combination; //导入依赖的package包/类
@Test
public void should_not_run_before_run_for_parallel_subbuild() {
final BuildConfiguration buildConfiguration = new BuildConfiguration(ImmutableMap.of("before_run", "before_run cmd", "run", of("unit", "command", "integration", "integration")));
final ShellCommands commands = buildConfiguration.getCommands(Combination.fromString("script=unit"), getEnvVars()).get(0);
for (final String command : commands.getCommands()) {
Assert.assertNotEquals("before_run cmd", command);
}
}
示例12: should_run_after_each_list
import hudson.matrix.Combination; //导入依赖的package包/类
@Test
public void should_run_after_each_list() {
final BuildConfiguration buildConfiguration = new BuildConfiguration(ImmutableMap.of("run", of("unit", "command", "integration", "integration"), "after_each", ImmutableList.of("cmd 1", "cmd 2")));
final ShellCommands commandList = buildConfiguration.getCommands(Combination.fromString("script=unit"), getEnvVars()).get(0);
Assert.assertEquals("cmd 1", commandList.get(commandList.size() - 2));
Assert.assertEquals("cmd 2", commandList.get(commandList.size() - 1));
}
示例13: testProjectPreferenceForMatrix
import hudson.matrix.Combination; //导入依赖的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));
}
示例14: CombinationConverter
import hudson.matrix.Combination; //导入依赖的package包/类
public CombinationConverter() {
super(Combination.class);
}
示例15: decode
import hudson.matrix.Combination; //导入依赖的package包/类
@Override
public Object decode(Class targetClass, Object fromDBObject, MappedField optionalExtraInfo) {
return new Combination((Map<String, String>) fromDBObject);
}