Package org.pentaho.reporting.engine.classic.demo.util

Examples of org.pentaho.reporting.engine.classic.demo.util.InternalDemoHandler


  public void testConvertReport() throws Exception
  {
    final InternalDemoHandler[] handlers = FunctionalityTestLib.getAllDemoHandlers();
    for (int i = 0; i < handlers.length; i++)
    {
      final InternalDemoHandler handler = handlers[i];

//      if (handler instanceof StackedLayoutXMLDemoHandler == false &&
//          handler instanceof StackedLayoutAPIDemoHandler == false)
//      {
//        continue;
//      }
      final MasterReport report = handler.createReport();
      logger.debug ("Processing " + handler.getDemoName());
      assertNotNull(report);

      logger.debug("   GRAPHICS2D ..");
      assertTrue(FunctionalityTestLib.execGraphics2D(report));
      logger.debug("   PDF ..");
View Full Code Here


  public void testSerializeReport()
  {
    InternalDemoHandler[] handlers = FunctionalityTestLib.getAllDemoHandlers();
    for (int i = 0; i < handlers.length; i++)
    {
      final InternalDemoHandler handler = handlers[i];
      try
      {
        if (handler instanceof OpenSourceXMLDemoHandler)
        {
          // contains a non-serializable image
          continue;
        }
        logger.debug("Starting to read " + handler.getDemoName());

        final MasterReport report = handler.createReport();
        final DataFactory model = report.getDataFactory();

        // we don't test whether our demo models are serializable :)
        report.setDataFactory(new TableDataFactory
            ("default", new DefaultTableModel()));
        // clear all report properties, which may cause trouble ...
        final ReportProperties p = report.getProperties();
        final Iterator keys = p.keys();
        while (keys.hasNext())
        {
          String key = (String) keys.next();
          if (p.get(key) instanceof Serializable == false)
          {
            p.put(key, null);
          }
        }

        final ByteArrayOutputStream bo = new ByteArrayOutputStream();
        try
        {
          final ObjectOutputStream oout = new ObjectOutputStream(bo);
          oout.writeObject(report);
          oout.close();
        }
        catch (Exception e)
        {
          logger.debug("Failed to write " + handler.getDemoName(), e);
          fail();
        }

        try
        {
          final ByteArrayInputStream bin = new ByteArrayInputStream(bo.toByteArray());
          final ObjectInputStream oin = new ObjectInputStream(bin);
          final MasterReport report2 = (MasterReport) oin.readObject();
          report2.setDataFactory(model);

          assertTrue(FunctionalityTestLib.execGraphics2D(report2));
        }
        catch (Exception e)
        {
          logger.debug("Failed to read " + handler.getDemoName(), e);
          fail();
        }
      }
      catch (Exception e)
      {
        logger.debug("Failed to execute " + handler.getDemoName(), e);
        fail();
      }
    }
  }
View Full Code Here

TOP

Related Classes of org.pentaho.reporting.engine.classic.demo.util.InternalDemoHandler

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.