Inappropriate compile-time dependency on TestNG


#1

Hi Folks

I could not log into Jira so I’m noting this in Forums instead.

Class com.opengamma.component.factory.engine.FunctionBlacklistComponentFactory (OG-Component) has a compile-time dependency on package org.testng.internal. This is probably inappropriate. Either way it breaks the Maven build.

The OG-Parent POM declares TestNG as an optional dependency, requiring sub-projects to specifically declare the dependency themselves which the POM for OG-Component fails to do.

Adding the dependency in OG-Component was straight-forward enough, but that in turn broke a “banned dependency” rule for Junit since it was being imported with compile-time scope instead of the allowed test scope.

Having relaxed the compile-time scope restriction on Junit the Maven project built fine. But the better solution is to remove the original compile-time dependency on TestNG.

Cheers, Robin.


#2

Hi Robin

You’re right that we shouldn’t be depending on the TestNG utility. I think this was accidental as similar functionality exists in Apache Commons. This has already been fixed in our development branch (the future v1.2) but I’ve just merged the fix over to master and dev/v1.1.x so you should see this now.

Your JIRA account will be the same as your developers.opengamma.com account if you have one. If not, feel free to create one at http://developers.opengamma.com/register

Cheers
Jon


#3

I’ve added a checkstyle rule to prevent a recurrence