JiraSCMListener extends SCMListener { static String constructJQLQuery( Collection<String> issueKeys) { StringBuilder jql = new StringBuilder(); jql.append("key in ("); Iterator<String> iterator = issueKeys.iterator(); while ( iterator.hasNext() ) { String key = iterator.next(); jql.append("'"); jql.append(key); jql.append("'"); if (iterator.hasNext()) { jql.append(","); } } jql.append(")"); return jql.toString(); }  @Override void onChangeLogParsed(Run<?, ?> run, SCM scm, TaskListener listener, ChangeLogSet<?> changelog);  }
@Test public void constructJQLQuery() throws Exception { Assert.assertEquals("key in ('JENKINS-123')", JiraSCMListener.constructJQLQuery(Collections.singletonList("JENKINS-123"))); Assert.assertEquals("key in ('JENKINS-123','FOO-123','VIVEK-123')", JiraSCMListener.constructJQLQuery( Arrays.asList("JENKINS-123", "FOO-123", "VIVEK-123"))); }