XmlFormatTrailValidator { public boolean run() throws IOException { boolean success = false; LOG.info("starting validation ..."); if (_continuous) { Thread runThread = new Thread(_parser, "XmlFormatTrailParser"); runThread.start(); success = true; } else { _parser.run(); Throwable error = _parser.getLastError(); LOG.info("validation complete: " + (null == error ? "SUCCESS" : error.toString()) ); if (null != error) { _parser.printErrorContext(System.err); } else { success = true; } LOG.info("PARSE ERRORS: " + _parser.getErrorCount()); } return success; } XmlFormatTrailValidator(Cli cli);  XmlFormatTrailValidator(String xmlDir, String xmlPrefix, boolean continuous,
                                 boolean dtdValidationEnabled, String errorLogFName,
                                 boolean enableRegex);  XmlFormatTrailValidator(String xmlDir, String xmlPrefix, boolean continuous,
      boolean dtdValidationEnabled, String errorLogFName); boolean run(); static void main(String[] args); static final Logger LOG; static final String NAME; }
@Test public void testInvalidXmlTag() throws Exception { File tmpDir = createTestDir(INVALID_XML_TAG); XmlFormatTrailValidator validator = createValidator(tmpDir, false); Assert.assertFalse(validator.run()); }
@Test public void testInvalidXml() throws Exception { File tmpDir = createTestDir(INVALID_XML_FRAGMENT1); XmlFormatTrailValidator validator = createValidator(tmpDir, false); Assert.assertFalse(validator.run()); }
@Test public void testValidXml() throws Exception { File tmpDir = createTestDir(VALID_XML_FRAGMENT1); XmlFormatTrailValidator validator = createValidator(tmpDir, true); Assert.assertTrue(validator.run()); }
@Test public void testInvalidDtd1ValidationOff() throws Exception { File tmpDir = createTestDir(INVALID_DTD_FRAGMENT1); XmlFormatTrailValidator validator = createValidator(tmpDir, true); Assert.assertTrue(validator.run()); }
@Test public void testInvalidDtd2ValidationOff() throws Exception { File tmpDir = createTestDir(VALID_XML_FRAGMENT1, INVALID_DTD_FRAGMENT2); XmlFormatTrailValidator validator = createValidator(tmpDir, true); Assert.assertTrue(validator.run()); }
@Test public void testInvalidCharacters() throws Exception { byte[] file1 = VALID_XML_FRAGMENT1.getBytes(XML_ENCODING); byte[] file2 = VALID_XML_FRAGMENT1.getBytes(XML_ENCODING); file2[30] = (byte)1; File tmpDir = createTestDir(file1, file2); XmlFormatTrailValidator validator = createValidator(tmpDir, true); Assert.assertFalse(validator.run()); }
@Test public void testMissingGGStatus() throws Exception { File tmpDir = createTestDir(MISSING_GG_STATUS_FRAGMENT); XmlFormatTrailValidator validator = createValidator(tmpDir, false); Assert.assertFalse(validator.run()); }
@Test public void testMissingGGStatusInDelete() throws Exception { File tmpDir = createTestDir(MISSING_DELETE_GG_STATUS_FRAGMENT); XmlFormatTrailValidator validator = createValidator(tmpDir, false); Assert.assertTrue(validator.run()); }
@Test public void testMissingXid() throws Exception { File tmpDir = createTestDir(MISSING_XID_FRAGMENT); XmlFormatTrailValidator validator = createValidator(tmpDir, false); Assert.assertFalse(validator.run()); }
@Test public void testMissingScn() throws Exception { File tmpDir = createTestDir(MISSING_SCN_FRAGMENT); XmlFormatTrailValidator validator = createValidator(tmpDir, false); Assert.assertFalse(validator.run()); }