use of com.redhat.jenkins.plugins.ci.CIBuildTrigger in project jms-messaging-plugin by jenkinsci.
the class SharedMessagingPluginIntegrationTest method _testSimpleCIEventTriggerWithWildcardInSelector.
public void _testSimpleCIEventTriggerWithWildcardInSelector() throws Exception {
FreeStyleProject jobA = j.createFreeStyleProject();
attachTrigger(new CIBuildTrigger(false, Collections.singletonList(getSubscriberProviderData(null, null, "compose LIKE '%compose_id\": \"Fedora-Atomic%'"))), jobA);
jobA.getBuildersList().add(new Shell("echo CI_TYPE = $CI_TYPE"));
FreeStyleProject jobB = j.createFreeStyleProject();
jobB.getPublishersList().add(new CIMessageNotifier(getPublisherProviderData(null, MessageUtils.MESSAGE_TYPE.CodeQualityChecksDone, "CI_STATUS = failed\n compose = \"compose_id\": \"Fedora-Atomic-25-20170105.0\"", "")));
j.buildAndAssertSuccess(jobB);
waitUntilScheduledBuildCompletes();
j.assertBuildStatusSuccess(jobA.getLastBuild());
j.assertLogContains("echo CI_TYPE = code-quality-checks-done", jobA.getLastBuild());
}
use of com.redhat.jenkins.plugins.ci.CIBuildTrigger in project jms-messaging-plugin by jenkinsci.
the class SharedMessagingPluginIntegrationTest method _testJobRenameWithCheck.
public void _testJobRenameWithCheck() throws Exception {
FreeStyleProject jobA = j.createFreeStyleProject();
attachTrigger(new CIBuildTrigger(false, Collections.singletonList(getSubscriberProviderData(null, null, null, new MsgCheck(MESSAGE_CHECK_FIELD, MESSAGE_CHECK_VALUE)))), jobA);
jobA.getBuildersList().add(new Shell("echo CI_TYPE = $CI_TYPE"));
Thread.sleep(1000);
jobA.renameTo("ABC");
Thread.sleep(3000);
assertThat("Trigger not subscribed", isSubscribed("ABC"));
}
use of com.redhat.jenkins.plugins.ci.CIBuildTrigger 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 com.redhat.jenkins.plugins.ci.CIBuildTrigger in project jms-messaging-plugin by jenkinsci.
the class SharedMessagingPluginIntegrationTest method _testSimpleCIEventTriggerWithCheckWithPipelineSendMsg.
public void _testSimpleCIEventTriggerWithCheckWithPipelineSendMsg() throws Exception {
FreeStyleProject jobA = j.createFreeStyleProject();
attachTrigger(new CIBuildTrigger(false, Collections.singletonList(getSubscriberProviderData(null, null, null, new MsgCheck(MESSAGE_CHECK_FIELD, MESSAGE_CHECK_VALUE)))), jobA);
WorkflowJob job = j.jenkins.createProject(WorkflowJob.class, "job");
job.setDefinition(new CpsFlowDefinition("node('master') {\n def message = sendCIMessage " + " providerName: '" + DEFAULT_PROVIDER_NAME + "', " + " messageContent: '" + MESSAGE_CHECK_CONTENT + "'}\n", true));
j.buildAndAssertSuccess(job);
waitUntilScheduledBuildCompletes();
j.assertBuildStatusSuccess(jobA.getLastBuild());
}
use of com.redhat.jenkins.plugins.ci.CIBuildTrigger in project jms-messaging-plugin by jenkinsci.
the class SharedMessagingPluginIntegrationTest method _testSimpleCIEventTriggerWithCheckWithTopicOverrideAndVariableTopic.
public void _testSimpleCIEventTriggerWithCheckWithTopicOverrideAndVariableTopic() throws Exception {
FreeStyleProject jobA = j.createFreeStyleProject();
attachTrigger(new CIBuildTrigger(false, Collections.singletonList(getSubscriberProviderData("org.fedoraproject.my-topic", null, null, new MsgCheck(MESSAGE_CHECK_FIELD, MESSAGE_CHECK_VALUE)))), jobA);
jobA.getBuildersList().add(new Shell("echo job ran"));
FreeStyleProject jobB = j.createFreeStyleProject();
jobB.addProperty(new ParametersDefinitionProperty(new StringParameterDefinition("MY_TOPIC", "org.fedoraproject.my-topic", "")));
jobB.getPublishersList().add(new CIMessageNotifier(getPublisherProviderData("$MY_TOPIC", null, null, MESSAGE_CHECK_CONTENT)));
j.buildAndAssertSuccess(jobB);
waitUntilScheduledBuildCompletes();
j.assertBuildStatusSuccess(jobA.getLastBuild());
j.assertLogContains("echo job ran", jobA.getLastBuild());
}
Aggregations