use of hudson.model.StringParameterDefinition in project jms-messaging-plugin by jenkinsci.
the class SharedMessagingPluginIntegrationTest method _testSimpleCIEventTriggerWithChoiceParam.
public void _testSimpleCIEventTriggerWithChoiceParam(String properties, String body, String matchString) throws Exception {
WorkflowJob jobA = j.jenkins.createProject(WorkflowJob.class, "foo");
jobA.setDefinition(new CpsFlowDefinition("node('master') {\n echo \"mychoice is $mychoice\"\n}", true));
jobA.addProperty(new ParametersDefinitionProperty(new StringParameterDefinition("CI_MESSAGE", "", ""), new StringParameterDefinition("mychoice", "scott\ntom", "")));
attachTrigger(new CIBuildTrigger(false, Collections.singletonList(getSubscriberProviderData(null, null, null))), jobA);
FreeStyleProject jobB = j.createFreeStyleProject();
jobB.getPublishersList().add(new CIMessageNotifier(getPublisherProviderData(null, null, properties, body)));
j.buildAndAssertSuccess(jobB);
waitUntilScheduledBuildCompletes();
j.assertBuildStatusSuccess(jobA.getLastBuild());
j.assertLogContains(matchString, jobA.getLastBuild());
}
use of hudson.model.StringParameterDefinition in project jms-messaging-plugin by jenkinsci.
the class SharedMessagingPluginIntegrationTest method _testSimpleCIEventTriggerWithTextArea.
public void _testSimpleCIEventTriggerWithTextArea(String body, String matchString) throws Exception {
FreeStyleProject jobA = j.createFreeStyleProject();
jobA.getBuildersList().add(new Shell("echo CI_MESSAGE = \"$CI_MESSAGE\""));
jobA.addProperty(new ParametersDefinitionProperty(new StringParameterDefinition("CI_MESSAGE", "", "")));
attachTrigger(new CIBuildTrigger(false, Collections.singletonList(getSubscriberProviderData(null, null, null))), jobA);
FreeStyleProject jobB = j.createFreeStyleProject();
jobB.getPublishersList().add(new CIMessageNotifier(getPublisherProviderData(null, null, null, body)));
j.buildAndAssertSuccess(jobB);
waitUntilScheduledBuildCompletes();
j.assertBuildStatusSuccess(jobA.getLastBuild());
j.assertLogContains(matchString, jobA.getLastBuild());
}
use of hudson.model.StringParameterDefinition in project jms-messaging-plugin by jenkinsci.
the class SharedMessagingPluginIntegrationTest method _testSimpleCIEventSubscribeWithCheckWithTopicOverrideAndVariableTopic.
public void _testSimpleCIEventSubscribeWithCheckWithTopicOverrideAndVariableTopic() throws Exception {
FreeStyleProject jobA = j.createFreeStyleProject();
jobA.addProperty(new ParametersDefinitionProperty(new StringParameterDefinition("MY_TOPIC", "my-topic", "")));
jobA.getBuildersList().add(new CIMessageSubscriberBuilder(getSubscriberProviderData("$MY_TOPIC", "HELLO", null, new MsgCheck(MESSAGE_CHECK_FIELD, MESSAGE_CHECK_VALUE))));
jobA.getBuildersList().add(new Shell("echo $HELLO"));
scheduleAwaitStep(jobA);
FreeStyleProject jobB = j.createFreeStyleProject();
jobB.getPublishersList().add(new CIMessageNotifier(getPublisherProviderData("my-topic", null, null, MESSAGE_CHECK_CONTENT)));
j.buildAndAssertSuccess(jobB);
waitUntilScheduledBuildCompletes();
j.assertBuildStatusSuccess(jobA.getLastBuild());
j.assertLogContains("catch me", jobA.getLastBuild());
}
use of hudson.model.StringParameterDefinition in project jms-messaging-plugin by jenkinsci.
the class SharedMessagingPluginIntegrationTest method _testSimpleCIEventTriggerWithBoolParam.
public void _testSimpleCIEventTriggerWithBoolParam(String properties, String body, String matchString) throws Exception {
WorkflowJob jobA = j.jenkins.createProject(WorkflowJob.class, "foo");
jobA.setDefinition(new CpsFlowDefinition("node('master') {\n echo \"dryrun is $dryrun, scott is $scott\"\n}", true));
jobA.addProperty(new ParametersDefinitionProperty(new StringParameterDefinition("CI_MESSAGE", "", ""), new BooleanParameterDefinition("dryrun", false, ""), new StringParameterDefinition("scott", "", "")));
attachTrigger(new CIBuildTrigger(false, Collections.singletonList(getSubscriberProviderData(null, null, null))), jobA);
FreeStyleProject jobB = j.createFreeStyleProject();
jobB.getPublishersList().add(new CIMessageNotifier(getPublisherProviderData(null, null, properties, body)));
j.buildAndAssertSuccess(jobB);
waitUntilScheduledBuildCompletes();
j.assertBuildStatusSuccess(jobA.getLastBuild());
j.assertLogContains(matchString, jobA.getLastBuild());
}
use of hudson.model.StringParameterDefinition in project wavefront-plugin-for-jenkins by vmware.
the class WavefrontBuildListenerTest method testSendingAllJobParametersToWavefront.
@Test
public void testSendingAllJobParametersToWavefront() 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);
WavefrontJobProperty wavefrontJobProperty = mock(WavefrontJobProperty.class);
when(wavefrontJobProperty.isEnableSendingJobParameters()).thenReturn(true);
job.addProperty(wavefrontJobProperty);
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);
}
}
}
Aggregations