DigitalState / camunda-coverage-generation

Camunda BPM Unit testing coverage generation using BPMNJS, Groovy, and Camunda Test Assertion Libraries. Also inlcudes a Java Bridge for use from pure Java Classes.
MIT License
5 stars 3 forks source link

FileSystemNotFoundException in CoverageBuilderJavaBridge instantiation v0.11 #10

Closed LucaMozzo closed 6 years ago

LucaMozzo commented 6 years ago

Hello, Thanks for the useful library. I used the example you provided in the README file for Java unit testing, however, I get a java.nio.file.FileSystemNotFoundException at com.sun.nio.zipfs.ZipFileSystemProvider.getFileSystem(ZipFileSystemProvider.java:171) at com.sun.nio.zipfs.ZipFileSystemProvider.getPath(ZipFileSystemProvider.java:157) at java.nio.file.Paths.get(Paths.java:143) at java_nio_file_Paths$get.call(Unknown Source) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:128) at io.digitalstate.camunda.coverage.bpmn.bpmnjs.TemplateGeneration$Trait$Helper.$init$(TemplateGeneration.groovy:16) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:104) at org.codehaus.groovy.runtime.callsite.StaticMetaMethodSite$StaticMetaMethodSiteNoUnwrapNoCoerce.invoke(StaticMetaMethodSite.java:151) at org.codehaus.groovy.runtime.callsite.StaticMetaMethodSite.call(StaticMetaMethodSite.java:91) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:128) at io.digitalstate.camunda.coverage.bpmn.CoverageBuilderJavaBridge.<init>(CoverageBuilderJavaBridge.groovy)

caused by CoverageBuilderJavaBridge coverageBuilder = new CoverageBuilderJavaBridge();

I added the configuration to the test resources and I even tried not specifying a resource at all

Thanks

StephenOTT commented 6 years ago

This is likely a issue with v0.11 and the latest theme updates. its a WIP and something looks to be missed. I am looking at it right now to resolve with a fix.

In the meantime can you test with v0.9

StephenOTT commented 6 years ago

@LucaMozzo okay this has been resolved as part of v0.12

Please test and let me know how it goes. The Unit tests are passing, so if you have a issue, cross-check with the src/test/java/coveragetest/SimpleTestCase.java test

StephenOTT commented 6 years ago

Correction to above. Issue was resolved in v0.12

StephenOTT commented 6 years ago

@LucaMozzo see: https://github.com/DigitalState/camunda-coverage-generation/releases/tag/v0.12

 <dependency>
    <groupId>com.github.digitalstate</groupId>
    <artifactId>camunda-coverage-generation-groovy</artifactId>
    <version>v0.12</version>
    <scope>test</scope>
 </dependency>
LucaMozzo commented 6 years ago

Thanks for the support Stephen. I still get the error in v0.12, but it works fine with 0.9, maybe I could just stick to that

StephenOTT commented 6 years ago

Can you give me a code snippet of the lines causing the issue?

LucaMozzo commented 6 years ago

Sure, so the new error now is

java.lang.ExceptionInInitializerError
    at [xxxxxxxxx].<init>([xxxxxxxxx]Test.java:xx)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at org.junit.runners.BlockJUnit4ClassRunner.createTest(BlockJUnit4ClassRunner.java:217)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:226)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:289)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:291)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:246)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
    at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
    at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
    at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
    at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
    at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
Caused by: java.nio.file.FileSystemNotFoundException
    at com.sun.nio.zipfs.ZipFileSystemProvider.getFileSystem(ZipFileSystemProvider.java:171)
    at com.sun.nio.zipfs.ZipFileSystemProvider.getPath(ZipFileSystemProvider.java:157)
    at java.nio.file.Paths.get(Paths.java:143)
    at java_nio_file_Paths$get.call(Unknown Source)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:128)
    at io.digitalstate.camunda.coverage.bpmn.bpmnjs.CssGeneration.<init>(CssGeneration.groovy:11)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:83)
    at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:105)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:59)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:238)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:242)
    at io.digitalstate.camunda.coverage.bpmn.CoverageBuilder$Trait$Helper.$static$init$(CoverageBuilder.groovy:32)
    at io.digitalstate.camunda.coverage.bpmn.CoverageBuilderJavaBridge.<clinit>(CoverageBuilderJavaBridge.groovy)
    ... 26 more

The line that caused the problem is

CoverageBuilderJavaBridge coverageBuilder = new CoverageBuilderJavaBridge();

and my relevant code looks like

@Rule public ProcessEngineRule rule = new ProcessEngineRule("camunda_config/camunda.cfg.xml");
  CoverageBuilderJavaBridge coverageBuilder = new CoverageBuilderJavaBridge();

@Test
  @Deployment(resources = {"xxxxxx.bpmn"})
  public void xxxxxxxxxxxxxxxxx() {
...
}
StephenOTT commented 6 years ago

@LucaMozzo can you download the repo and run SimpleTestCase.java unit test on your system. Just confirm that the test runs correctly on your setup.

StephenOTT commented 6 years ago

@LucaMozzo looked into it, and looks like its a specific issue with when running outside of the unit tests. Was able to recreate the issue. Should be a small fix.

StephenOTT commented 6 years ago

Ya it is related to switching to Paths() and forgot to instantiate the filesystem

LucaMozzo commented 6 years ago

Okay great, please let me know when you plan to release a fix for that and I will upgrade to the new version!

StephenOTT commented 6 years ago

@LucaMozzo give that a try: https://github.com/DigitalState/camunda-coverage-generation/releases/tag/v0.13

 <dependency>
    <groupId>com.github.digitalstate</groupId>
    <artifactId>camunda-coverage-generation-groovy</artifactId>
    <version>v0.13</version>
    <scope>test</scope>
 </dependency>
LucaMozzo commented 6 years ago

@StephenOTT thanks for the quick response. The problem is now solved!

StephenOTT commented 6 years ago

Glad to hear! If you have any feedback or ideas, views, etc, you are more than welcome to share!

LucaMozzo commented 6 years ago

@StephenOTT Sure! I'll be working with Camunda for a while. I opened another issue with a question, when you have a second to answer, I'm happy to fork and add the example and update the readme!