You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Oliver Hummel <hu...@informatik.uni-mannheim.de> on 2006/03/09 11:59:01 UTC

JUnitTask fork problem?

Dear all,

I have a problem with installing a security manager for a JUnitTask. I
use something like the following code to call ant programmatically:

JUnitTask junit = (JUnitTask) project.createTask("junit");
junit.createJvmarg().setValue("-Djava.security.manager");
junit.setTaskName("junit");
junit.setFork(true);
junit.setForkMode(new JUnitTask.ForkMode("once"));
junit.setTimeout(10000);

Testing and everything works fine, the only thing is there is obviously
no security manager installed for the test cases. I.e. printing
System.getSecurityManager in a test case delivers null and I can still
execute any command I like in the test cases.

Seems to me there is a problem with forking here as I cannot see another
JVM starting up in the task manager when I run the program..?

Is this a known issue? Or am I doing something fundamentally wrong here?

Any help is greatly appreciated!

Cheers,

  Oliver





---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: JUnitTask fork problem?

Posted by Dominique Devienne <dd...@gmail.com>.
I'm confused. What's the issue, that the task somehow doesn't fork a
child JVM (I'd be surprised), or that the child JVM doesn't have a
security manager?

If the latter, you'd probably need to explicitly tell Ant to start up
the forked VM with a security manager. I vaguely remember Antoine
doing work to support setting security manager for tasks, but I'm not
sure the security manager would be passed down to a fork VM.

Search for security manager in the doco. --DD

On 3/9/06, Oliver Hummel <hu...@informatik.uni-mannheim.de> wrote:
> Dear all,
>
> I have a problem with installing a security manager for a JUnitTask. I
> use something like the following code to call ant programmatically:
>
> JUnitTask junit = (JUnitTask) project.createTask("junit");
> junit.createJvmarg().setValue("-Djava.security.manager");
> junit.setTaskName("junit");
> junit.setFork(true);
> junit.setForkMode(new JUnitTask.ForkMode("once"));
> junit.setTimeout(10000);
>
> Testing and everything works fine, the only thing is there is obviously
> no security manager installed for the test cases. I.e. printing
> System.getSecurityManager in a test case delivers null and I can still
> execute any command I like in the test cases.
>
> Seems to me there is a problem with forking here as I cannot see another
> JVM starting up in the task manager when I run the program..?
>
> Is this a known issue? Or am I doing something fundamentally wrong here?
>
> Any help is greatly appreciated!
>
> Cheers,
>
>  Oliver
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org