use of org.w3c.domts.DOMTestSuite in project robovm by robovm.
the class AllTests_Level2 method suite.
/*public static void run() {
TestRunner.main(new String[] {Main_AllTests.class.getName()});
}*/
public static final Test suite() {
// from http://www.w3.org/DOM/Test/
// Level 2 Core tests
DOMTestSuite domSuite;
try {
DOMTestDocumentBuilderFactory factory1 = new JAXPDOMTestDocumentBuilderFactory(null, JAXPDOMTestDocumentBuilderFactory.getConfiguration1());
// android: coalescing, epand, ignorewhitespace, namespace, NOT validation
domSuite = new org.w3c.domts.level2.core.alltests(factory1);
} catch (Exception e) {
throw new RuntimeException("problem creating dom test suite", e);
}
TestSuite suite = new JUnitTestSuiteAdapter(domSuite);
return suite;
}
use of org.w3c.domts.DOMTestSuite in project webservices-axiom by apache.
the class W3CDOMTestSuiteBuilder method addTests.
protected final void addTests() {
final DOMTestDocumentBuilderFactory factory;
try {
factory = new DOMTestDocumentBuilderFactoryImpl(dbff, new DocumentBuilderSetting[] { DocumentBuilderSetting.notCoalescing, DocumentBuilderSetting.notExpandEntityReferences, DocumentBuilderSetting.notIgnoringElementContentWhitespace, DocumentBuilderSetting.namespaceAware, DocumentBuilderSetting.notValidating });
} catch (DOMTestIncompatibleException ex) {
// TODO
throw new Error(ex);
}
DOMTestSuite suite;
try {
suite = createDOMTestSuite(factory);
} catch (Exception ex) {
// TODO
throw new Error(ex);
}
suite.build(new DOMTestSink() {
public void addTest(Class testClass) {
try {
if (!unsupportedFeatures.isEmpty()) {
Set<DOMFeature> usedFeatures = new HashSet<DOMFeature>();
DOMFeature.matchFeatures(testClass, usedFeatures);
ClassReader classReader = new ClassReader(testClass.getResourceAsStream(testClass.getSimpleName() + ".class"));
DOMTSClassVisitor cv = new DOMTSClassVisitor(usedFeatures);
classReader.accept(cv, ClassReader.SKIP_DEBUG | ClassReader.SKIP_FRAMES);
usedFeatures.retainAll(unsupportedFeatures);
if (!usedFeatures.isEmpty()) {
return;
}
}
Constructor<? extends DOMTestCase> testConstructor = ((Class<?>) testClass).asSubclass(DOMTestCase.class).getConstructor(DOMTestDocumentBuilderFactory.class);
DOMTestCase test;
try {
test = testConstructor.newInstance(new Object[] { factory });
} catch (InvocationTargetException ex) {
throw ex.getTargetException();
}
test.setFramework(JUnitTestFramework.INSTANCE);
W3CDOMTestSuiteBuilder.this.addTest(new W3CTestCase(test));
} catch (Throwable ex) {
// TODO
throw new Error(ex);
}
}
});
}
use of org.w3c.domts.DOMTestSuite in project robovm by robovm.
the class AllTests_Level1 method suite.
/*public static void run() {
TestRunner.main(new String[] {Main_AllTests.class.getName()});
}*/
public static final Test suite() {
// from http://www.w3.org/DOM/Test/
// Level 1 Core tests
DOMTestSuite domSuite;
try {
DOMTestDocumentBuilderFactory factory1 = new JAXPDOMTestDocumentBuilderFactory(null, JAXPDOMTestDocumentBuilderFactory.getConfiguration1());
// android: coalescing, epand, ignorewhitespace, namespace, NOT validation
domSuite = new org.w3c.domts.level1.core.alltests(factory1);
} catch (Exception e) {
throw new RuntimeException("problem creating dom test suite, " + e.getClass().getName() + ", " + e.getMessage(), e);
}
TestSuite suite = new JUnitTestSuiteAdapter(domSuite);
return suite;
}
Aggregations