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

Ondřej Žižka ozizka at redhat.com
Mon Nov 7 03:24:49 EST 2011


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.

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);
                }
            }
        }
    }

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-as7-dev/attachments/20111107/8661cce1/attachment.html 


More information about the jboss-as7-dev mailing list