use of org.jvnet.hudson.test.SingleFileSCM in project workflow-cps-plugin by jenkinsci.
the class CpsScmFlowDefinitionTest method basics.
@Test
public void basics() throws Exception {
WorkflowJob p = r.jenkins.createProject(WorkflowJob.class, "p");
CpsScmFlowDefinition def = new CpsScmFlowDefinition(new SingleFileSCM("flow.groovy", "echo 'hello from SCM'"), "flow.groovy");
// currently the default, but just to be clear that we do rely on that in this test
def.setLightweight(false);
p.setDefinition(def);
WorkflowRun b = r.assertBuildStatusSuccess(p.scheduleBuild2(0));
// TODO currently the log text is in Run.log, but not on FlowStartNode/LogAction, so not visible from Workflow Steps etc.
r.assertLogContains("hello from SCM", b);
r.assertLogContains("Staging flow.groovy", b);
r.assertLogNotContains("Retrying after 10 seconds", b);
FlowGraphWalker w = new FlowGraphWalker(b.getExecution());
int workspaces = 0;
for (FlowNode n : w) {
if (n.getAction(WorkspaceAction.class) != null) {
workspaces++;
}
}
assertEquals(1, workspaces);
}
use of org.jvnet.hudson.test.SingleFileSCM in project sonar-scanner-jenkins by SonarSource.
the class SonarTestCase method setupSonarMavenProject.
protected MavenModuleSet setupSonarMavenProject(String pomName) throws Exception {
final MavenModuleSet project = j.jenkins.createProject(MavenModuleSet.class, "MavenProject");
// Setup SCM
project.setScm(new SingleFileSCM(pomName, getClass().getResource("/hudson/plugins/sonar/SonarTestCase/pom.xml")));
// Setup Maven
project.setRootPOM(pomName);
project.setGoals("clean install");
project.setIsArchivingDisabled(true);
// Setup Sonar
project.getPublishersList().add(newSonarPublisherForMavenProject());
return project;
}
Aggregations