[jboss-as7-dev] XSDValidationUnitTestCase - pls don't hard-code paths, and keep QA processes in mind.

Jaikiran Pai jpai at redhat.com
Mon Nov 7 03:28:25 EST 2011


On Monday 07 November 2011 01:54 PM, Ondřej Žižka wrote:
> Please don't hardcode paths in tests.
> Remember that tests may be shuffled around.
> I'll introduce a new system properties, pointing to the testsuite dir, 
> evt. to project's root dir.
Just a FYI - Some of the developers use the IDE to run the tests (I 
don't). So if you introduce these system properties, this should not 
force the IDE users to have to set the system properties for these tests 
to be able to run them, IMO.

-Jaikiran
>
> Also please remember that the testsuite will run agains productized 
> build -
> perhaps the following tests could use XSD's from src/main/resources 
> instead?
> (QA will run against provided EAP, let's not force them to run whole 
> build.)
>
> Thanks,
> Ondra
>
>
>
> public class AbstractValidationUnitTest {
>     private static final Map<String, File> JBOSS_SCHEMAS = new 
> HashMap<String, File>();
>     private static Map<String, String> NAMESPACE_MAP = new 
> HashMap<String, String>();
>     static final File MOD_DIR = new File(System.getProperty("user.dir"));
>     static final File TARGET_DIR = new File(MOD_DIR, 
> "../../build/target/");
>     private static File BASE_DIR = null;
>
>     static {
>         
> NAMESPACE_MAP.put("http://java.sun.com/xml/ns/javaee/javaee_6.xsd", 
> "schema/javaee_6.xsd");
>         NAMESPACE_MAP.put("http://www.w3.org/2001/xml.xsd", 
> "schema/xml.xsd");
>         final File[] children = TARGET_DIR.listFiles();
>         if (children != null) {
>             for (File child : children) {
>                 if (child.getName().startsWith("jboss-")) {
>                     BASE_DIR = child;
>                     break;
>                 }
>             }
>             if (BASE_DIR != null) {
>                 final File schemaDir = new File(BASE_DIR, "docs/schema");
>                 final File[] xsds = 
> schemaDir.listFiles(SchemaFilter.FILTER);
>                 for (File xsd : xsds) {
>                     JBOSS_SCHEMAS.put(xsd.getName(), xsd);
>                 }
>             }
>         }
>     }
>
>
>
> _______________________________________________
> jboss-as7-dev mailing list
> jboss-as7-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/jboss-as7-dev



More information about the jboss-as7-dev mailing list