use of hudson.model.StringParameterDefinition in project jms-messaging-plugin by jenkinsci.
the class SharedMessagingPluginIntegrationTest method _testSimpleCIEventTriggerWithParamOverride.
public void _testSimpleCIEventTriggerWithParamOverride() throws Exception {
FreeStyleProject jobA = j.createFreeStyleProject();
attachTrigger(new CIBuildTrigger(false, Collections.singletonList(getSubscriberProviderData(null, null, "CI_TYPE = 'code-quality-checks-done'"))), jobA);
jobA.addProperty(new ParametersDefinitionProperty(new StringParameterDefinition("PARAMETER", "bad parameter value", ""), new StringParameterDefinition("status", "unknown status", "")));
jobA.getBuildersList().add(new Shell("echo $PARAMETER"));
jobA.getBuildersList().add(new Shell("echo $CI_MESSAGE"));
jobA.getBuildersList().add(new Shell("echo status::$status"));
FreeStyleProject jobB = j.createFreeStyleProject();
jobB.getPublishersList().add(new CIMessageNotifier(getPublisherProviderData(null, MessageUtils.MESSAGE_TYPE.CodeQualityChecksDone, "PARAMETER = my parameter\nstatus=${BUILD_STATUS}\nCOMPOUND = Z${PARAMETER}Z", "This is my content with ${COMPOUND} ${BUILD_STATUS}")));
j.buildAndAssertSuccess(jobB);
waitUntilScheduledBuildCompletes();
FreeStyleBuild lastBuild = jobA.getLastBuild();
j.assertBuildStatusSuccess(lastBuild);
j.assertLogContains("status::SUCCESS", lastBuild);
j.assertLogContains("my parameter", lastBuild);
j.assertLogContains("This is my content with Zmy parameterZ SUCCESS", lastBuild);
}
use of hudson.model.StringParameterDefinition in project maven-plugin by jenkinsci.
the class MavenBuildTest method testMavenWithDependencyVersionInEnvVar.
@Email("https://groups.google.com/d/msg/hudson-users/Xhw00UopVN0/FA9YqDAIsSYJ")
@Test
public void testMavenWithDependencyVersionInEnvVar() throws Exception {
MavenModuleSet m = j.jenkins.createProject(MavenModuleSet.class, "p");
MavenInstallation mavenInstallation = Maven36xBuildTest.configureMaven36();
ParametersDefinitionProperty parametersDefinitionProperty = new ParametersDefinitionProperty(new StringParameterDefinition("JUNITVERSION", "3.8.2"));
m.addProperty(parametersDefinitionProperty);
m.setMaven(mavenInstallation.getName());
m.getReporters().add(new TestReporter());
m.setScm(new ExtractResourceSCM(getClass().getResource("envars-maven-project.zip")));
m.setGoals("clean test-compile -Dmaven.compiler.target=1.8 -Dmaven.compiler.source=1.8");
MavenModuleSetBuild mmsb = j.buildAndAssertSuccess(m);
assertFalse(mmsb.getProject().getModules().isEmpty());
}
use of hudson.model.StringParameterDefinition in project wavefront-plugin-for-jenkins by vmware.
the class WavefrontBuildListenerTest method testWhenWavefrontJobPropertyIsNull.
@Test
public void testWhenWavefrontJobPropertyIsNull() throws Exception {
List<String> expected = new ArrayList<>(Arrays.asList("p_branch=master", "p_isDevMode=true", "p_dummyParam=dummyValue"));
WorkflowJob job = jenkinsRule.createProject(WorkflowJob.class, "Test Job");
ParameterDefinition paramDef0 = new StringParameterDefinition("dummyParam", "dummyValue", "");
ParameterDefinition paramDef1 = new StringParameterDefinition("branch", "master", "");
ParameterDefinition paramDef2 = new BooleanParameterDefinition("isDevMode", true, "");
ParametersDefinitionProperty prop = new ParametersDefinitionProperty(paramDef0, paramDef1, paramDef2);
job.addProperty(prop);
job.setDefinition(new CpsFlowDefinition("node {\n" + "}", true));
jenkinsRule.buildAndAssertSuccess(job);
List<String> messages = proxy.terminate();
String actual = messages.get(0).replaceAll("[\"]", "");
String message = "The expected point tags are not present";
for (String e : expected) {
if (actual.contains(e)) {
Assert.fail(message);
}
}
}
use of hudson.model.StringParameterDefinition in project wavefront-plugin-for-jenkins by vmware.
the class WavefrontBuildListenerTest method getJobParameters.
private List<ParameterDefinition> getJobParameters(int number) {
List<ParameterDefinition> params = new ArrayList<>();
int count = 0;
while (count <= number) {
StringParameterDefinition p = new StringParameterDefinition(String.valueOf(count + 1), "value_" + String.valueOf(count + 1), "");
params.add(p);
count++;
}
return params;
}
use of hudson.model.StringParameterDefinition in project parallel-test-executor-plugin by jenkinsci.
the class ParallelTestExecutorTest method workflowDoesNotGenerateInclusionsFromRunningBuild.
@Test
@Issue("JENKINS-53172")
public void workflowDoesNotGenerateInclusionsFromRunningBuild() throws Exception {
WorkflowJob p = jenkinsRule.jenkins.createProject(WorkflowJob.class, "p");
ParameterDefinition sleepDef = new StringParameterDefinition("SLEEP", "100", "");
ParametersDefinitionProperty sleepParamsDef = new ParametersDefinitionProperty(sleepDef);
p.addProperty(sleepParamsDef);
/* We need to wait for first build to generate test result before calling splitTests in the second build, So
* instead of trying to use a quiet period, which is not deterministic and will introduce potential flakiness,
* we use the existing locking and milestone facilities in pipeline to make sure that
* a) The second run waits until the first one has generated tests results by using a lock
* b) Once the second build finish the previous one is killed by using milestones
*/
p.setDefinition(new CpsFlowDefinition("lock('test-results') {\n" + " def splits = splitTests parallelism: count(2), generateInclusions: true\n" + " echo \"splits.size=${splits.size()}\"; for (int i = 0; i < splits.size(); i++) {\n" + " def split = splits[i]; echo \"splits[${i}]: includes=${split.includes} list=${split.list}\"\n" + " }\n" + " node {\n" + " writeFile file: 'TEST-1.xml', text: '<testsuite name=\"one\"><testcase name=\"x\" failures=\"1\"/></testsuite>'\n" + " writeFile file: 'TEST-2.xml', text: '<testsuite name=\"two\"><testcase name=\"y\"/></testsuite>'\n" + " junit 'TEST-*.xml'\n" + // Needed due to https://issues.jenkins-ci.org/browse/JENKINS-48178
" currentBuild.result = 'UNSTABLE'\n" + " }\n" + "}\n" + "milestone 1\n" + "sleep time: Integer.valueOf(params.SLEEP), unit: 'SECONDS'\n" + "milestone 2", true));
WorkflowRun b1 = p.scheduleBuild2(0, new ParametersAction(new StringParameterValue("SLEEP", "100"))).waitForStart();
jenkinsRule.waitForMessage("Lock acquired on", b1);
WorkflowRun b2 = p.scheduleBuild2(0, new ParametersAction(new StringParameterValue("SLEEP", "0"))).get();
jenkinsRule.assertLogContains("splits.size=1", b2);
}
Aggregations