package org.pentaho.reporting.engine.classic.core.bugs;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.pentaho.reporting.engine.classic.core.ClassicEngineBoot;
import org.pentaho.reporting.engine.classic.core.MasterReport;
import org.pentaho.reporting.engine.classic.core.modules.output.fast.html.FastHtmlReportUtil;
import org.pentaho.reporting.engine.classic.core.modules.output.table.html.HtmlReportUtil;
import org.pentaho.reporting.libraries.resourceloader.ResourceManager;
import java.io.ByteArrayOutputStream;
import java.net.URL;
public class Prd5245IT {
@Before
public void setUp() {
ClassicEngineBoot.getInstance().start();
}
@Test
public void testFrom52() throws Exception {
URL url = getClass().getResource( "Prd-5245-from52.prpt" );
MasterReport report = (MasterReport) new ResourceManager().createDirectly( url, MasterReport.class ).getResource();
final ByteArrayOutputStream boutFast = new ByteArrayOutputStream();
final ByteArrayOutputStream boutSlow = new ByteArrayOutputStream();
FastHtmlReportUtil.processStreamHtml( report, boutFast );
HtmlReportUtil.createStreamHTML( report, boutSlow );
String htmlFast = boutFast.toString( "UTF-8" );
String htmlSlow = boutSlow.toString( "UTF-8" );
Assert.assertEquals( htmlSlow, htmlFast );
}
@Test
public void testFrom39() throws Exception {
URL url = getClass().getResource( "Prd-5245-from39.prpt" );
MasterReport report = (MasterReport) new ResourceManager().createDirectly( url, MasterReport.class ).getResource();
final ByteArrayOutputStream boutFast = new ByteArrayOutputStream();
final ByteArrayOutputStream boutSlow = new ByteArrayOutputStream();
FastHtmlReportUtil.processStreamHtml( report, boutFast );
HtmlReportUtil.createStreamHTML( report, boutSlow );
String htmlFast = boutFast.toString( "UTF-8" );
String htmlSlow = boutSlow.toString( "UTF-8" );
Assert.assertEquals( htmlSlow, htmlFast );
}
}