use of com.redhat.jenkins.plugins.ci.messaging.MessagingProviderOverrides in project jms-messaging-plugin by jenkinsci.
the class FedMsgMessagingPluginIntegrationTest method testTriggeringUsingFedMsgLogger.
@Test
public void testTriggeringUsingFedMsgLogger() throws Exception {
FreeStyleProject jobA = j.createFreeStyleProject();
jobA.getBuildersList().add(new Shell("echo CI_MESSAGE = $CI_MESSAGE"));
attachTrigger(new CIBuildTrigger(true, Collections.singletonList(new FedMsgSubscriberProviderData("test", new MessagingProviderOverrides("org.fedoraproject.dev.logger.log"), Collections.singletonList(new MsgCheck("compose", ".+compose_id.+message.+")), "CI_MESSAGE", 60))), jobA);
// Allow for connection
Thread.sleep(5000);
File privateKey = File.createTempFile("ssh", "key");
FileUtils.copyURLToFile(FedmsgRelayContainer.class.getResource("FedmsgRelayContainer/unsafe"), privateKey);
Files.setPosixFilePermissions(privateKey.toPath(), singleton(OWNER_READ));
File ssh = File.createTempFile("jenkins", "ssh");
FileUtils.writeStringToFile(ssh, "#!/bin/sh\n" + "exec ssh -o StrictHostKeyChecking=no -i " + privateKey.getAbsolutePath() + " fedmsg2@" + fedmsgRelay.getSshIPAndPort() + " fedmsg-logger " + " \"$@\"");
Files.setPosixFilePermissions(ssh.toPath(), new HashSet<>(Arrays.asList(OWNER_READ, OWNER_EXECUTE)));
System.out.println(FileUtils.readFileToString(ssh));
ProcessBuilder gitLog1Pb = new ProcessBuilder(ssh.getAbsolutePath(), "--message='{\"compose\": " + "{\"compose_id\": \"This is a message.\"}}'", "--json-input");
String output = stringFrom(logProcessBuilderIssues(gitLog1Pb, "ssh"));
System.out.println(output);
Thread.sleep(2000);
waitUntilScheduledBuildCompletes();
j.assertBuildStatusSuccess(jobA.getLastBuild());
j.assertLogContains("This is a message", jobA.getLastBuild());
}
Aggregations