mendix / UnitTesting

Module to run Mendix and JUnit unit test inside a project
Apache License 2.0
7 stars 12 forks source link

JUnit test detection fails with java.io.FilePermission on local run with emulate cloud security enabled #6

Closed dlhartveld closed 7 years ago

dlhartveld commented 7 years ago

JUnit test detection fails with java.io.FilePermission on local run with emulate cloud security enabled.

In 6.10.3, new apps by default have cloud security emulation enabled. Workaround is to disable cloud security emulation, but this is not documented. Sidenote: JUnit tests are only detected if a constant is set to true. However, this is also undocumented.

Log output:

Unable to find JUnit test classes or methods. 

access denied ("java.io.FilePermission" "C:\Users\David\Projects\Mendix\<PROJECT>-main\deployment\model\bundles\project.jar" "read")

--------

java.security.AccessControlException: access denied ("java.io.FilePermission" "C:\Users\David\Projects\Mendix\<PROJECT>\deployment\model\bundles\project.jar" "read")
    at java.security.AccessControlContext.checkPermission(AccessControlContext.java:457)
    at java.security.AccessController.checkPermission(AccessController.java:884)
    at java.lang.SecurityManager.checkPermission(SecurityManager.java:549)
    at java.lang.SecurityManager.checkRead(SecurityManager.java:888)
    at java.util.zip.ZipFile.<init>(ZipFile.java:211)
    at java.util.zip.ZipFile.<init>(ZipFile.java:150)
    at java.util.zip.ZipFile.<init>(ZipFile.java:164)
    at unittesting.TestManager.processProjectJar(TestManager.java:418)
    at unittesting.TestManager.getClassesForPackage(TestManager.java:464)
    at unittesting.TestManager.getUnitTestClasses(TestManager.java:88)
    at unittesting.TestManager.findJUnitTests(TestManager.java:561)
    at unittesting.TestManager.updateUnitTestList(TestManager.java:526)
    at unittesting.TestManager.findAllTests(TestManager.java:489)
    at unittesting.actions.FindAllUnitTests.executeAction(FindAllUnitTests.java:27)
    at unittesting.actions.FindAllUnitTests.executeAction(FindAllUnitTests.java:16)
    at com.mendix.systemwideinterfaces.core.UserAction.execute(UserAction.java:49)
    at com.mendix.core.actionmanagement.CoreAction.doCall(CoreAction.java:260)
    at com.mendix.core.actionmanagement.CoreAction.call(CoreAction.java:248)
    at com.mendix.core.actionmanagement.ActionManager$1.execute(ActionManager.java:168)
    at com.mendix.util.classloading.Runner.doRunUsingClassLoaderOf(Runner.java:36)
    at com.mendix.core.actionmanagement.ActionManager.executeSync(ActionManager.java:172)
    at com.mendix.core.component.InternalCore.execute(InternalCore.java:414)
    at com.mendix.modules.microflowengine.actions.actioncall.JavaAction.execute(JavaAction.scala:52)
    at com.mendix.modules.microflowengine.microflow.impl.MicroflowObject.execute(MicroflowObject.java:47)
    at com.mendix.modules.microflowengine.microflow.impl.MicroflowImpl.executeAfterBreakingIfNecessary(MicroflowImpl.java:192)
    at com.mendix.modules.microflowengine.microflow.impl.MicroflowImpl.executeAction(MicroflowImpl.java:149)
    at com.mendix.systemwideinterfaces.core.UserAction.execute(UserAction.java:49)
    at com.mendix.core.actionmanagement.CoreAction.doCall(CoreAction.java:260)
    at com.mendix.core.actionmanagement.CoreAction.call(CoreAction.java:248)
    at com.mendix.core.actionmanagement.ActionManager$1.execute(ActionManager.java:168)
    at com.mendix.util.classloading.Runner.doRunUsingClassLoaderOf(Runner.java:36)
    at com.mendix.core.actionmanagement.ActionManager.executeSync(ActionManager.java:172)
    at com.mendix.core.component.InternalCore.execute(InternalCore.java:414)
    at com.mendix.webui.actions.client.ExecuteAction.execute(ExecuteAction.java:144)
    at com.mendix.webui.requesthandling.ClientRequestHandler$$anonfun$handleRequest$1.apply$mcV$sp(ClientRequestHandler.scala:311)
    at com.mendix.webui.requesthandling.ClientRequestHandler$$anonfun$handleRequest$1.apply(ClientRequestHandler.scala:301)
    at com.mendix.webui.requesthandling.ClientRequestHandler$$anonfun$handleRequest$1.apply(ClientRequestHandler.scala:301)
    at com.mendix.core.session.Worker$$anonfun$receive$3$$anonfun$2$$anon$1.execute(ActionDispatching.scala:143)
    at com.mendix.util.classloading.Runner.doRunUsingClassLoaderOf(Runner.java:36)
    at com.mendix.core.session.Worker$$anonfun$receive$3$$anonfun$2.apply(ActionDispatching.scala:145)
    at scala.util.Try$.apply(Try.scala:192)
    at com.mendix.core.session.Worker$$anonfun$receive$3.applyOrElse(ActionDispatching.scala:139)
    at akka.actor.Actor$class.aroundReceive(Actor.scala:465)
    at com.mendix.core.session.Worker.aroundReceive(ActionDispatching.scala:135)
    at akka.actor.ActorCell.receiveMessage(ActorCell.scala:516)
    at akka.actor.ActorCell.invoke(ActorCell.scala:487)
    at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:238)
    at akka.dispatch.Mailbox.run(Mailbox.scala:220)
    at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(AbstractDispatcher.scala:393)
    at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
    at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
    at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
    at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
RoelandSalij commented 7 years ago

Does the error also occur in the 'cloud'?

dlhartveld commented 7 years ago

Sorry, I did not try that and don't have a cloud node available to try it, unfortunately.

dlhartveld commented 7 years ago

Thanks! 👍