Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BIRT » IReportContext
IReportContext [message #721064] Wed, 31 August 2011 15:56 Go to next message
marc.marshall is currently offline marc.marshall
Messages: 30
Registered: June 2011
Member
Hi,

I am unit testing a Birt Report using JUnit. The method that I am testing requires a IReportContext object. Is there an easy way of creating this object? I know that I can't instantiate the object but is there any method of another object that allows me to create a IReportContext with an existing *.rptdesign? Thanks in advance for any help that you can offer.

Thanks,

Marc
Re: IReportContext [message #721164 is a reply to message #721064] Thu, 01 September 2011 00:38 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

Marc,

Are you using 3.7? If you are using the POJO runtime you can do
something like:

RunAndRenderTask task = (RunAndRenderTask)
engine.createRunAndRenderTask(design);
..
..
task.setRenderOption(options);
task.run();

IReportContext irc = task.getReportContext();
task.close

If you are using previous version the only easy way I can see to do this
is to modify the engineapi.jar to have the RunAndRenderTask or implement
a JavaEventHandler for the report and when it is called it will pass the
report context to the event handler.

Jason

On 8/31/2011 3:56 PM, marc.marshall wrote:
> Hi,
>
> I am unit testing a Birt Report using JUnit. The method that I am
> testing requires a IReportContext object. Is there an easy way of
> creating this object? I know that I can't instantiate the object but is
> there any method of another object that allows me to create a
> IReportContext with an existing *.rptdesign? Thanks in advance for any
> help that you can offer.
>
> Thanks,
>
> Marc
Re: IReportContext [message #721698 is a reply to message #721164] Fri, 02 September 2011 11:46 Go to previous messageGo to next message
marc.marshall is currently offline marc.marshall
Messages: 30
Registered: June 2011
Member
Jason,

Thanks for the reply. I am using Birt 2.6. I guess Birt 2.6 RunAndRenderTask object does not have the getReportContext(). Is this true? I think maybe I should move up to the 3.7 version.

Thanks,

Marc
Re: IReportContext [message #721727 is a reply to message #721698] Fri, 02 September 2011 12:30 Go to previous message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

Marc,

It does have it but it is not exported to the engine-api jar file.

Jason

On 9/2/2011 11:46 AM, marc.marshall wrote:
> Jason,
>
> Thanks for the reply. I am using Birt 2.6. I guess Birt 2.6
> RunAndRenderTask object does not have the getReportContext(). Is this
> true? I think maybe I should move up to the 3.7 version.
>
> Thanks,
>
> Marc
Previous Topic:Page headers depending upon the page number
Next Topic:how to delete temprory file when report is finished created (Is It Possible to do this?)
Goto Forum:
  


Current Time: Tue Jul 29 21:11:00 EDT 2014

Powered by FUDForum. Page generated in 0.01593 seconds