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