Navigation Menu

Skip to content
This repository has been archived by the owner on Apr 6, 2022. It is now read-only.

Commit

Permalink
[FIXED JENKINS-35262] Update of testcase setup.
Browse files Browse the repository at this point in the history
  • Loading branch information
uhafner committed Jun 13, 2016
1 parent 79fccda commit 145b978
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions src/test/java/hudson/plugins/warnings/GroovyParserTest.java
@@ -1,6 +1,8 @@
package hudson.plugins.warnings;

import java.io.IOException;
import java.io.StringReader;
import java.util.Collection;

import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;
Expand All @@ -9,7 +11,9 @@

import static org.junit.Assert.*;

import hudson.plugins.analysis.util.model.FileAnnotation;
import hudson.plugins.warnings.GroovyParser.DescriptorImpl;
import hudson.plugins.warnings.parser.AbstractWarningsParser;
import hudson.util.FormValidation;
import hudson.util.FormValidation.Kind;

Expand Down Expand Up @@ -58,36 +62,36 @@ public class GroovyParserTest {
*/
@Test @Issue("35262")
public void issue35262() throws IOException {
String multiLineRegexp = "(## start(?:(?!start)[\\s\\S])*?## end step: headerruler.*\\n)\n";
String textToMatch = "start step: at 06/01/2016-12:05:42\n" +
"end step: jsruler at 06/01/2016-12:05:42\n" +
"start step: at 06/01/2016-12:05:42\n" +
"some details here\n" +
"on several lines\n" +
"end step: runtimedata at 06/01/2016-12:05:42\n" +
"start step: at 06/01/2016-12:05:42\n" +
"end step: dummynls at 06/01/2016-12:05:42";
String multiLineRegexp = "(make(?:(?!make)[\\s\\S])*?make-error:.*\\n)";
String textToMatch = "start build\n" +
"make: thisFile.js\n" +
"everything okay\n" +
"make: thisOtherFile.js\n" +
"error detail1: wrong character\n" +
"error detail2: ecnoding issue\n" +
"make-error: thisOtherFile.js: wrong encoding detected\n" +
"make: anotherFile.js\n" +
"make: yetAnotherFile.js\n" +
"end build";
String script = "import hudson.plugins.warnings.parser.Warning\n" +
"import hudson.plugins.analysis.util.model.Priority\n" +
"String fileName = \"\"\n" +
"String type = \"TEST\"\n" +
"String category = \"runtimedata\"\n" +
"String category = \"make-error\"\n" +
"String errors = matcher.group(1)\n" +
"return new Warning(\"\", 0, type, category, errors, Priority.HIGH);";
"return new Warning(fileName, 0, type, category, errors, Priority.HIGH);\n";

GroovyParser parser = new GroovyParser("name", multiLineRegexp, script);

assertTrue("Wrong multi line support guess", parser.hasMultiLineSupport());

// FIXME: setup in JENKINS-35262 correct?
/*
DescriptorImpl descriptor = createDescriptor();
assertOk(descriptor.doCheckExample(textToMatch, multiLineRegexp, script));

AbstractWarningsParser instance = parser.getParser();
Collection<FileAnnotation> warnings = instance.parse(new StringReader(textToMatch));

assertEquals("No warning found.", 1, warnings.size());
*/
}

/**
Expand Down

0 comments on commit 145b978

Please sign in to comment.