@Test public void testEarlHtmlReport_Ctl_WithHierarchy_WithInheritedFailure() throws Exception { String outputDirectory = createTempDirectoryAndCopyResources( "earl-results_ctl_withHierarchy_WithInheritedFailure.rdf" ); EarlToHtmlTransformation earlToHtmlTransformation = new EarlToHtmlTransformation(); earlToHtmlTransformation.earlHtmlReport( outputDirectory ); File indexHtmlFile = new File( outputDirectory, "result/index.html" ); assertThat( indexHtmlFile.exists(), is( true ) ); Source indexHtml = the( indexHtmlFile ); assertThat( indexHtml, hasXPath( "count( assertThat( indexHtml, hasXPath( " assertThat( indexHtml, hasXPath( " assertThat( indexHtml, hasXPath( " assertThat( indexHtml, hasXPath( " assertThat( indexHtml, hasXPath( " }
public void earlHtmlReport( String outputDir ) { ClassLoader cl = Thread.currentThread().getContextClassLoader(); String resourceDir = cl.getResource( "com/occamlab/te/earl/lib" ).getPath(); String earlXsl = cl.getResource( "com/occamlab/te/earl_html_report.xsl" ).toString(); File htmlOutput = new File( outputDir, "result" ); htmlOutput.mkdir(); File earlResult = findEarlResultFile( outputDir ); LOGR.log( FINE, "Try to transform earl result file '" + earlResult + "' to directory " + htmlOutput ); try { if ( earlResult != null && earlResult.exists() ) { Transformer transformer = TransformerFactory.newInstance().newTransformer( new StreamSource( earlXsl ) ); transformer.setParameter( "outputDir", htmlOutput ); File indexHtml = new File( htmlOutput, "index.html" ); indexHtml.createNewFile(); FileOutputStream fo = new FileOutputStream( indexHtml ); transformer.transform( new StreamSource( earlResult ), new StreamResult( fo ) ); fo.close(); FileUtils.copyDirectory( new File( resourceDir ), htmlOutput ); } } catch ( Exception e ) { LOGR.log( SEVERE, "Transformation of EARL to HTML failed.", e ); } }
EarlToHtmlTransformation { public void earlHtmlReport( String outputDir ) { ClassLoader cl = Thread.currentThread().getContextClassLoader(); String resourceDir = cl.getResource( "com/occamlab/te/earl/lib" ).getPath(); String earlXsl = cl.getResource( "com/occamlab/te/earl_html_report.xsl" ).toString(); File htmlOutput = new File( outputDir, "result" ); htmlOutput.mkdir(); File earlResult = findEarlResultFile( outputDir ); LOGR.log( FINE, "Try to transform earl result file '" + earlResult + "' to directory " + htmlOutput ); try { if ( earlResult != null && earlResult.exists() ) { Transformer transformer = TransformerFactory.newInstance().newTransformer( new StreamSource( earlXsl ) ); transformer.setParameter( "outputDir", htmlOutput ); File indexHtml = new File( htmlOutput, "index.html" ); indexHtml.createNewFile(); FileOutputStream fo = new FileOutputStream( indexHtml ); transformer.transform( new StreamSource( earlResult ), new StreamResult( fo ) ); fo.close(); FileUtils.copyDirectory( new File( resourceDir ), htmlOutput ); } } catch ( Exception e ) { LOGR.log( SEVERE, "Transformation of EARL to HTML failed.", e ); } } }
EarlToHtmlTransformation { public void earlHtmlReport( String outputDir ) { ClassLoader cl = Thread.currentThread().getContextClassLoader(); String resourceDir = cl.getResource( "com/occamlab/te/earl/lib" ).getPath(); String earlXsl = cl.getResource( "com/occamlab/te/earl_html_report.xsl" ).toString(); File htmlOutput = new File( outputDir, "result" ); htmlOutput.mkdir(); File earlResult = findEarlResultFile( outputDir ); LOGR.log( FINE, "Try to transform earl result file '" + earlResult + "' to directory " + htmlOutput ); try { if ( earlResult != null && earlResult.exists() ) { Transformer transformer = TransformerFactory.newInstance().newTransformer( new StreamSource( earlXsl ) ); transformer.setParameter( "outputDir", htmlOutput ); File indexHtml = new File( htmlOutput, "index.html" ); indexHtml.createNewFile(); FileOutputStream fo = new FileOutputStream( indexHtml ); transformer.transform( new StreamSource( earlResult ), new StreamResult( fo ) ); fo.close(); FileUtils.copyDirectory( new File( resourceDir ), htmlOutput ); } } catch ( Exception e ) { LOGR.log( SEVERE, "Transformation of EARL to HTML failed.", e ); } }  }
EarlToHtmlTransformation { public void earlHtmlReport( String outputDir ) { ClassLoader cl = Thread.currentThread().getContextClassLoader(); String resourceDir = cl.getResource( "com/occamlab/te/earl/lib" ).getPath(); String earlXsl = cl.getResource( "com/occamlab/te/earl_html_report.xsl" ).toString(); File htmlOutput = new File( outputDir, "result" ); htmlOutput.mkdir(); File earlResult = findEarlResultFile( outputDir ); LOGR.log( FINE, "Try to transform earl result file '" + earlResult + "' to directory " + htmlOutput ); try { if ( earlResult != null && earlResult.exists() ) { Transformer transformer = TransformerFactory.newInstance().newTransformer( new StreamSource( earlXsl ) ); transformer.setParameter( "outputDir", htmlOutput ); File indexHtml = new File( htmlOutput, "index.html" ); indexHtml.createNewFile(); FileOutputStream fo = new FileOutputStream( indexHtml ); transformer.transform( new StreamSource( earlResult ), new StreamResult( fo ) ); fo.close(); FileUtils.copyDirectory( new File( resourceDir ), htmlOutput ); } } catch ( Exception e ) { LOGR.log( SEVERE, "Transformation of EARL to HTML failed.", e ); } }  void earlHtmlReport( String outputDir ); }
EarlToHtmlTransformation { public void earlHtmlReport( String outputDir ) { ClassLoader cl = Thread.currentThread().getContextClassLoader(); String resourceDir = cl.getResource( "com/occamlab/te/earl/lib" ).getPath(); String earlXsl = cl.getResource( "com/occamlab/te/earl_html_report.xsl" ).toString(); File htmlOutput = new File( outputDir, "result" ); htmlOutput.mkdir(); File earlResult = findEarlResultFile( outputDir ); LOGR.log( FINE, "Try to transform earl result file '" + earlResult + "' to directory " + htmlOutput ); try { if ( earlResult != null && earlResult.exists() ) { Transformer transformer = TransformerFactory.newInstance().newTransformer( new StreamSource( earlXsl ) ); transformer.setParameter( "outputDir", htmlOutput ); File indexHtml = new File( htmlOutput, "index.html" ); indexHtml.createNewFile(); FileOutputStream fo = new FileOutputStream( indexHtml ); transformer.transform( new StreamSource( earlResult ), new StreamResult( fo ) ); fo.close(); FileUtils.copyDirectory( new File( resourceDir ), htmlOutput ); } } catch ( Exception e ) { LOGR.log( SEVERE, "Transformation of EARL to HTML failed.", e ); } }  void earlHtmlReport( String outputDir );  }