SNAP Graph Processing Framework (GPF) testTemplateMergingWithOpName test case failed

Followed instructions How to build SNAP from sources but testTemplateMergingWithOpName test case in SNAP Graph Processing Framework (GPF) module failed. Surefire report as below:

  <testcase name="testTemplateMergingWithOpName" classname="org.esa.snap.core.gpf.main.CommandLineToolTemplateTest" time="1.833">
    <error message="No product reader found for &apos;/private/var/folders/c6/ffx74ftx2757tx6jhx7rgb980000gn/T/test.testdata&apos;" type="org.esa.snap.core.gpf.OperatorException">org.esa.snap.core.gpf.OperatorException: No product reader found for '/private/var/folders/c6/ffx74ftx2757tx6jhx7rgb980000gn/T/test.testdata'
	at org.esa.snap.core.gpf.main.CommandLineToolTemplateTest.testTemplateMergingWithOpName(CommandLineToolTemplateTest.java:69)
</error>
    <system-err><![CDATA[INFO: org.hsqldb.persist.Logger: dataFileCache open start
org.esa.snap.core.gpf.OperatorException: No product reader found for '/private/var/folders/c6/ffx74ftx2757tx6jhx7rgb980000gn/T/test.testdata'
	at org.esa.snap.core.gpf.main.DefaultCommandLineContext.readProduct(DefaultCommandLineContext.java:57)
	at org.esa.snap.core.gpf.main.TestCommandLineContext.readProduct(TestCommandLineContext.java:23)
	at org.esa.snap.core.gpf.main.CommandLineTool.readProduct(CommandLineTool.java:521)
	at org.esa.snap.core.gpf.main.CommandLineTool.addProduct(CommandLineTool.java:466)
	at org.esa.snap.core.gpf.main.CommandLineTool.getSourceProductMap(CommandLineTool.java:454)
	at org.esa.snap.core.gpf.main.CommandLineTool.runOperator(CommandLineTool.java:295)
	at org.esa.snap.core.gpf.main.CommandLineTool.runGraphOrOperator(CommandLineTool.java:284)
	at org.esa.snap.core.gpf.main.CommandLineTool.run(CommandLineTool.java:188)
	at org.esa.snap.core.gpf.main.CommandLineTool.run(CommandLineTool.java:121)
	at org.esa.snap.core.gpf.main.CommandLineToolTemplateTest.testTemplateMergingWithOpName(CommandLineToolTemplateTest.java:69)
	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:497)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
	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.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:365)
	at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:273)
	at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:238)
	at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:159)
	at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:384)
	at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:345)
	at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:126)
	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:418)
]]></system-err>
  </testcase>

Anyone facing similar issue?

I just did it and it worked for me.

Also with maven from the command line:

Maybe you try a new mvn clean test run and check if you are on master branch.
Currently I don’t see a reason why it should fail.

I found out that on Mac OSX,

sourceFile.getAbsoluteFile() = /var/folders/c6/ffx74ftx2757tx6jhx7rgb980000gn/T/test.testdata

but

sourceFile.getPath() = /private/var/folders/c6/ffx74ftx2757tx6jhx7rgb980000gn/T/test.testdata

I tried using sourceFile.getCanonicalFile() and got

sourceFile.getCanonicalFile() = /private/var/folders/c6/ffx74ftx2757tx6jhx7rgb980000gn/T/test.testdata

Thus, I tried the following and the test passed:

TestProductIOPlugIn.INSTANCE.getSourceProducts().put(sourceFile.getCanonicalFile(), createSourceProduct());

Thanks.

Found out that in Mac OSX, the /var directory is actually a symbolic link for /private/var.

It appears that:

  1. getAbsolutePath() does not resolve symbolic link
  2. getPath() resolves symbolic link
  3. getCanonicalPath() resolves symbolic link

Would it be possible to change the test case so that it is more robust on operating systems that may use symbolic link for temporary directory?

Yesterday I’ve updated the test. Can you check if it now works for you? On my test Mac it works.
And many thanks for your support.

Yes. This test works. Thank you.