Package nz.co.invensysenergy.proj.schemaUnitTest.utils

Examples of nz.co.invensysenergy.proj.schemaUnitTest.utils.TransformerFacade


   * element. However, I have failed to implement this so the test tends to
   * be more of a framework so I can reinstate this in the future.
   */
  public void testThrownException() throws Exception {
    SchemaUnitTest.setSchemaFile("examples/preValidationTransformation/schema.xsd");
    TransformerFacade uut = new TransformerFacade(new StreamSource(this.getClass().getResourceAsStream("testStylesheet.xsl"), "testStylesheet.xsl"));
    try {
      uut.transform(new StreamSource("examples/preValidationTransformation/testSuite.xml"), new DOMResult());
      fail("Expected an exception to be thrown");
    } catch (TransformerException e) {
      // TODO This test fails and I can't figure out what is going on
//      assertEquals("This Transformation Always Terminates", e.getMessage());
    }
View Full Code Here


   */
  public static File transform(Source source) throws TransformerException, IOException {
    File xmlFile = null;
    PrintStream oldErr = TransformerFacade.redirectTransformationMessages();
    try {
      TransformerFacade preTransformer = getTransformation();
      if (preTransformer != null) {
        final String xmlOutputFile = System.getProperty(XML_OUTPUT_FILE);
        if (xmlOutputFile == null) {
          xmlFile = File.createTempFile("preValid", ".sut");
          xmlFile.deleteOnExit();
        } else {
          xmlFile = new File(xmlOutputFile);
        }
        Result fileResult = new StreamResult(xmlFile);
        log.finer("Performing pre-validation transformation to file " + xmlFile.getAbsolutePath());
        try {
          preTransformer.transform(source, fileResult);
        } catch (TransformerException e) {
          String message = TransformerFacade.determineErrorMessage(e);
          throw new TransformerException(message, e);
        }
      }
View Full Code Here

    if (log.isLoggable(Level.FINER)) {
      log.info("Dumping extacted pre-validation transformation to extractedPre.xsl");
      ErrorDetector.dumpDomTree(resultNode, EXTRACTED_STYLESHEET);
    }
    source = new DOMSource(resultNode, EXTRACTED_STYLESHEET_URI);
    TransformerFacade returnValue = new TransformerFacade(source);
    returnValue.getUriResolver().addDocument(EXTRACTED_STYLESHEET, resultNode);
    return returnValue;
  }
View Full Code Here

      DOMResult schematronStylesheet = TransformerFacade.transform(new DOMSource(extractedSchematron.getNode()), SchemaTestCase.getSupportFile(PROCESS_SCHEMATRON_FILE));
      if (log.isLoggable(Level.FINER)) {
        ErrorDetector.dumpDomTree(schematronStylesheet.getNode(), SCHEMATRON_STYLESHEET);
      }

      instance = new TransformerFacade(new DOMSource(schematronStylesheet.getNode(), SCHEMATRON_STYLESHEET_URI));
      instance.getUriResolver().addDocument(EXTRACTED_SCHEMATRON, extractedSchematron.getNode());
      instance.getUriResolver().addDocument(SCHEMATRON_STYLESHEET, schematronStylesheet.getNode());
      log.finest("Schematron Instance Created");
    }
    return instance;
View Full Code Here

TOP

Related Classes of nz.co.invensysenergy.proj.schemaUnitTest.utils.TransformerFacade

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.