Skip to content
Permalink
Browse files

JENKINS-31150 - supporting multiple coma separated scm tags, aded tests

  • Loading branch information
yurigo79 committed Oct 24, 2015
1 parent 3ddad7c commit b20a96e5046ed751af9c0fdd5ec7e71d66ef6e7d
@@ -635,9 +635,17 @@ public String getUrlName() {

if (tagsStr == null)
return new String[0];

List<String> list = new ArrayList<String>(Arrays.asList(tagsStr.split(delimiter)));
list.removeAll(Collections.singleton(""));

for (ListIterator<String> iterator = list.listIterator(); iterator.hasNext(); ) {
String tag = iterator.next();
tag=tag.replaceAll("\\s+","").trim();
iterator.remove();
if (!tag.equals(""))
iterator.add(tag);

}

return list.toArray(new String[list.size()]);
}

@@ -7,6 +7,8 @@
import java.io.File;
import java.io.IOException;
import java.io.StringWriter;
import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.Date;
import java.util.Properties;
import org.apache.commons.io.FileUtils;
@@ -284,6 +286,32 @@ public void testWaitForRundeckJob() throws Exception {
}


public void testGetTags(){

RundeckNotifier notifier;
String[] tags;

notifier = new RundeckNotifier("1", null, null, "#deploy", false, true);
tags= new String[] {"#deploy"};
assertTrue(Arrays.equals(tags, notifier.getTags()));

notifier = new RundeckNotifier("1", null, null, null, false, true);
tags= new String[0];
assertTrue(Arrays.equals(tags, notifier.getTags()));

notifier = new RundeckNotifier("1", null, null, "", false, true);
tags= new String[0];
assertTrue(Arrays.equals(tags, notifier.getTags()));

notifier = new RundeckNotifier("1", null, null, " ", false, true);
tags= new String[0];
assertTrue(Arrays.equals(tags, notifier.getTags()));

notifier = new RundeckNotifier("1", null, null, "#tag1, #tag2", false, true);
tags= new String[] {"#tag1", "#tag2"};
assertTrue(Arrays.equals(tags, notifier.getTags()));

}


private String createOptions() {

0 comments on commit b20a96e

Please sign in to comment.
You can’t perform that action at this time.