You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@chukwa.apache.org by Stuti Awasthi <St...@persistent.co.in> on 2010/12/03 09:51:53 UTC

Why system.exit() present in Demux.java

Hi all,
I am facing issues while executing Junit test cases for my custom processor. This is what I have done :


*         I have created my own processor class extended from AbstractProcessor.java.

*         For testing I wrote the Junit test class and passed .done file location and output directory location to Demux.main()

*         Demux class run and successfully executes my custom processor

*         Convert .done to .evt file in output directory as desired.

Issue : Code of Demux.main() class :

                public static void main(String[] args) throws Exception {
    int res = ToolRunner.run(new Configuration(), new Demux(), args);
    System.exit(res);
                 }

After converting .done file to .evt file , Demux class end the process by System.exit() command due to which control is not returned to my JUnit test class. Because of this the control is not reaching my assertion and testcase is not successful.

Questions

*         I want to know why we have this System.exit() in Demux.java class ?

*         Is there any way I can execute my testcase successfully ? Have any one tested processor classes given by chukwa ? Eg : Syslog, TsProcessor etc

*         Since Demux is a daemon which runs continuously . So does everytime this demux class is called for every .done file ?


Please Suggest

Thanks
Stuti Awasthi

DISCLAIMER
==========
This e-mail may contain privileged and confidential information which is the property of Persistent Systems Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Ltd. does not accept any liability for virus infected mails.

Re: Why system.exit() present in Demux.java

Posted by Eric Yang <er...@gmail.com>.
In the old days, we used a shell script to check the return status of
the submitted job.  This is why we have System.exit in Demux.  In
Chukwa 0.2, demux manager was introduced and interfacing Demux through
Java code.  Hence, the return status is no longer required, but still
works if Demux is invoked through shell script.

regards,
Eric

On Fri, Dec 3, 2010 at 12:51 AM, Stuti Awasthi
<St...@persistent.co.in> wrote:
> Hi all,
>
> I am facing issues while executing Junit test cases for my custom processor.
> This is what I have done :
>
>
>
> ·         I have created my own processor class extended from
> AbstractProcessor.java.
>
> ·         For testing I wrote the Junit test class and passed .done file
> location and output directory location to Demux.main()
>
> ·         Demux class run and successfully executes my custom processor
>
> ·         Convert .done to .evt file in output directory as desired.
>
>
>
> Issue : Code of Demux.main() class :
>
>
>
>                 public static void main(String[] args) throws Exception {
>
>     int res = ToolRunner.run(new Configuration(), new Demux(), args);
>
>     System.exit(res);
>
>                  }
>
>
>
> After converting .done file to .evt file , Demux class end the process by
> System.exit() command due to which control is not returned to my JUnit test
> class. Because of this the control is not reaching my assertion and testcase
> is not successful.
>
>
>
> Questions
>
> ·         I want to know why we have this System.exit() in Demux.java class
> ?
>
> ·         Is there any way I can execute my testcase successfully ? Have any
> one tested processor classes given by chukwa ? Eg : Syslog, TsProcessor etc
>
> ·         Since Demux is a daemon which runs continuously . So does
> everytime this demux class is called for every .done file ?
>
>
>
> Please Suggest
>
>
>
> Thanks
>
> Stuti Awasthi
>
> DISCLAIMER ========== This e-mail may contain privileged and confidential
> information which is the property of Persistent Systems Ltd. It is intended
> only for the use of the individual or entity to which it is addressed. If
> you are not the intended recipient, you are not authorized to read, retain,
> copy, print, distribute or use this message. If you have received this
> communication in error, please notify the sender and delete all copies of
> this message. Persistent Systems Ltd. does not accept any liability for
> virus infected mails.

Re: Why system.exit() present in Demux.java

Posted by Bill Graham <bi...@gmail.com>.
I'm not sure why System.exit get's called but I suspect someone had a
use case to know the return status of the process. If that's causing
problems with unit tests, you could have your unit test call
Demux.run(String[] args) directly.


On Fri, Dec 3, 2010 at 12:51 AM, Stuti Awasthi
<St...@persistent.co.in> wrote:
> Hi all,
>
> I am facing issues while executing Junit test cases for my custom processor.
> This is what I have done :
>
>
>
> ·         I have created my own processor class extended from
> AbstractProcessor.java.
>
> ·         For testing I wrote the Junit test class and passed .done file
> location and output directory location to Demux.main()
>
> ·         Demux class run and successfully executes my custom processor
>
> ·         Convert .done to .evt file in output directory as desired.
>
>
>
> Issue : Code of Demux.main() class :
>
>
>
>                 public static void main(String[] args) throws Exception {
>
>     int res = ToolRunner.run(new Configuration(), new Demux(), args);
>
>     System.exit(res);
>
>                  }
>
>
>
> After converting .done file to .evt file , Demux class end the process by
> System.exit() command due to which control is not returned to my JUnit test
> class. Because of this the control is not reaching my assertion and testcase
> is not successful.
>
>
>
> Questions
>
> ·         I want to know why we have this System.exit() in Demux.java class
> ?
>
> ·         Is there any way I can execute my testcase successfully ? Have any
> one tested processor classes given by chukwa ? Eg : Syslog, TsProcessor etc
>
> ·         Since Demux is a daemon which runs continuously . So does
> everytime this demux class is called for every .done file ?
>
>
>
> Please Suggest
>
>
>
> Thanks
>
> Stuti Awasthi
>
> DISCLAIMER ========== This e-mail may contain privileged and confidential
> information which is the property of Persistent Systems Ltd. It is intended
> only for the use of the individual or entity to which it is addressed. If
> you are not the intended recipient, you are not authorized to read, retain,
> copy, print, distribute or use this message. If you have received this
> communication in error, please notify the sender and delete all copies of
> this message. Persistent Systems Ltd. does not accept any liability for
> virus infected mails.