Skip to content

Commit

Permalink
Merge branch 'mbriskar-WINDUP-619'
Browse files Browse the repository at this point in the history
  • Loading branch information
jsight committed Jun 1, 2015
2 parents 1c23c66 + d088c2c commit fa2c9e9
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class Hint extends ParameterizedIterationOperation<FileLocationModel> imp
{
private static final Logger log = Logger.getLogger(Hint.class.getName());

public static final Severity DEFAULT_SEVERITY = Severity.WARNING;
public static final Severity DEFAULT_SEVERITY = Severity.OPTIONAL;

private RegexParameterizedPatternParser hintTitlePattern;
private RegexParameterizedPatternParser hintTextPattern;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
public class Classification extends ParameterizedIterationOperation<FileModel> implements ClassificationAs, ClassificationEffort,
ClassificationDescription, ClassificationLink, ClassificationSeverity
{
public static final Severity DEFAULT_SEVERITY = Severity.WARNING;
public static final Severity DEFAULT_SEVERITY = Severity.OPTIONAL;
private static final Logger log = Logger.getLogger(Classification.class.getName());

private List<Link> links = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,17 @@

/**
* Specifies the relative importance of a problem. This can be used to categorize notifications. For example, Eclipse may put warnings and severe
* issues in a different list than "INFO" level notices.
* issues in a different list than "OPTIONAL" level notices.
*/
public enum Severity
{
/**
* Informative to the user.
* It must be migrated
*/
INFO,
MANDATORY,
/**
* Indicates that action may be required depending upon the circumstances.
* It is a problem that does not need to be strictly migrated
*/
WARNING,
/**
* Indicates that there is a highly important issue that should be addressed with this file.
*/
SEVERE,
/**
* Indicates that this problem is critically important and must be fixed in order to effectively complete the migration.
*/
CRITICAL
OPTIONAL

}
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public Classification processElement(ParserContext handlerManager, Element eleme

if (StringUtils.isNotBlank(severityStr))
{
Severity severity = Severity.valueOf(severityStr);
Severity severity = Severity.valueOf(severityStr.toUpperCase());
classification.withSeverity(severity);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public Hint processElement(ParserContext handlerManager, Element element) throws

if (StringUtils.isNotBlank(severityStr))
{
Severity severity = Severity.valueOf(severityStr);
Severity severity = Severity.valueOf(severityStr.toUpperCase());
hint.withSeverity(severity);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public void testClassificationParsing() throws Exception
Element firstClassification = classificationList.get(0);
Classification classification = parser.<Classification> processElement(firstClassification);

Assert.assertEquals(Severity.WARNING, classification.getSeverity());
Assert.assertEquals(Severity.OPTIONAL, classification.getSeverity());
Assert.assertEquals("testVariable", classification.getVariableName());
Assert.assertEquals(5, classification.getEffort());
Assert.assertEquals("test message", classification.getClassificationPattern().toString());
Expand All @@ -85,7 +85,7 @@ public void testClassificationParsing() throws Exception
Element secondClassification = classificationList.get(1);
classification = parser.<Classification> processElement(secondClassification);
Assert.assertEquals(null, classification.getVariableName());
Assert.assertEquals(Severity.INFO, classification.getSeverity());
Assert.assertEquals(Severity.OPTIONAL, classification.getSeverity());
Assert.assertEquals(0, classification.getEffort());
Assert.assertEquals("test-message", classification.getClassificationPattern().toString());
Assert.assertEquals(null, classification.getDescriptionPattern());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import org.jboss.forge.arquillian.AddonDependency;
import org.jboss.forge.arquillian.archive.AddonArchive;
import org.jboss.forge.furnace.Furnace;
import org.jboss.forge.furnace.repositories.AddonDependencyEntry;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.windup.config.parser.ParserContext;
import org.jboss.windup.reporting.config.Hint;
Expand Down Expand Up @@ -43,18 +42,9 @@ public class HintHandlerTest
@AddonDependency(name = "org.jboss.forge.furnace.container:cdi") })
public static AddonArchive getDeployment()
{
final AddonArchive archive = ShrinkWrap
return ShrinkWrap
.create(AddonArchive.class)
.addBeansXML()
.addClass(HintHandlerTest.class)
.addAsAddonDependencies(
AddonDependencyEntry.create("org.jboss.windup.config:windup-config"),
AddonDependencyEntry.create("org.jboss.windup.rules.apps:windup-rules-java"),
AddonDependencyEntry.create("org.jboss.windup.config:windup-config-xml"),
AddonDependencyEntry.create("org.jboss.windup.reporting:windup-reporting"),
AddonDependencyEntry.create("org.jboss.forge.furnace.container:cdi"));

return archive;
.addBeansXML();
}

@Inject
Expand All @@ -71,22 +61,22 @@ public void testHintHandler() throws Exception
Document doc = dBuilder.parse(fXmlFile);
List<Element> hintList = $(doc).children("hint").get();
Element firstHint = hintList.get(0);
Hint hint = parser.<Hint> processElement(firstHint);
Hint hint = parser.processElement(firstHint);

Assert.assertEquals("testVariable", hint.getVariableName());
Assert.assertEquals(5, hint.getEffort());
Assert.assertEquals(Severity.WARNING, hint.getSeverity());
Assert.assertEquals(Severity.OPTIONAL, hint.getSeverity());
Assert.assertEquals("test message", hint.getHintText().toString());
Assert.assertEquals(1, hint.getLinks().size());
List<Link> links = hint.getLinks();
Assert.assertEquals("someUrl", links.get(0).getLink());
Assert.assertEquals("someDescription", links.get(0).getDescription());

Element secondHint = hintList.get(1);
hint = parser.<Hint> processElement(secondHint);
hint = parser.processElement(secondHint);
Assert.assertEquals(null, hint.getVariableName());
Assert.assertEquals(0, hint.getEffort());
Assert.assertEquals(Severity.INFO, hint.getSeverity());
Assert.assertEquals(Severity.MANDATORY, hint.getSeverity());
Assert.assertEquals("test-message", hint.getHintText().toString());
Assert.assertEquals(3, hint.getLinks().size());
links = hint.getLinks();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<link href="someUrl" description="someDescription" />
</classification>

<classification title="test-message" severity='INFO'>
<classification title="test-message" severity='optional'>
<link href="url1" description="description1" />
<link href="url2" description="description2" />
<link href="url3" description="description3" />
Expand Down
2 changes: 1 addition & 1 deletion reporting/tests/src/test/resources/handler/hint.windup.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<link href="someUrl" description="someDescription"/>
</hint>

<hint message="test-message" severity="INFO">
<hint message="test-message" severity="mandatory">
<link href="url1" description="description1"/>
<link href="url2" description="description2"/>
<link href="url3" description="description3"/>
Expand Down

0 comments on commit fa2c9e9

Please sign in to comment.