[x3d-public] Testing X3DJSAIL from NetBeans. IMPORTANT!

John Carlson yottzumm at gmail.com
Sat Jun 19 16:14:34 PDT 2021


The important point from all of this, is that JSON input to X3DJSAIL 
does not produce XML that is compatible with Java the JSON was created 
from.  Indeed, I don't even know if the non-canonical XML is compatible 
with the canonical XML. I don't know how to build the 
HelloWorldProgramOutputCanonical.x3d at this point (oh, there's a .xml 
version).   Where is an officially generated XML file that I can compare 
against, and all I have is Java? I'm really getting confused comparing 
all these different XML files.  I would prefer to compare JSON from Java 
(generated in Don's test) to JSON from Java (in my test), so we can 
properly test my usage of the X3DLoaderDOM to load my Document that I 
created from JSON in X3DJSONLD.java

I created a test in NetBeans, under 
www_web3d_org/x3d/stylesheets/java/tests/org/web3d/x3d/tests/JsonLoaderTest.java 
(attached), derived from JsonConversion.java

I ran the file, it's not a proper JUnit test case.


It produced 2 .x3d files, an .xml file, and no .json file, perhaps 
because of this output?

CLASSPATH=/c/x3d-code/www.web3d.org/x3d/stylesheets/java/classes:/c/x3d-code/www.web3d.org/x3d/stylesheets/java/lib/exificient-gui-jar-with-dependencies.jar:/c/x3d-code/www.web3d.org/x3d/stylesheets/java/lib/jdom.jar:/c/x3d-code/www.web3d.org/x3d/stylesheets/java/lib/javax.json-api-1.0.jar:/c/x3d-code/www.web3d.org/x3d/stylesheets/java/lib/support/jaxb/jaxb-api.jar:/c/x3d-code/www.web3d.org/x3d/stylesheets/java/lib/nagasena.jar:/c/x3d-code/www.web3d.org/x3d/stylesheets/java/lib/nagasena-rta.jar:/c/x3d-code/www.web3d.org/x3d/stylesheets/java/lib/saxon9he.jar:/c/x3d-code/www.web3d.org/x3d/stylesheets/java/lib/X3dC14n.jar:/c/x3d-code/www.web3d.org/x3d/stylesheets/java/lib/support/junit-platform-commons-1.5.0.jar:/c/x3d-code/www.web3d.org/x3d/stylesheets/java/lib/support/opentest4j-1.1.0.jar:/c/x3d-code/www.web3d.org/x3d/stylesheets/java/lib/support/junit-platform-launcher-1.5.0.jar:/c/x3d-code/www.web3d.org/x3d/stylesheets/java/lib/support/jupiter/junit-jupiter-api-5.5.0.jar:/c/x3d-code/www.web3d.org/x3d/stylesheets/java/lib/support/jupiter/junit-jupiter-engine-5.5.0.jar:/c/x3d-code/www.web3d.org/x3d/stylesheets/java/lib/support/apiguardian-api-1.1.0.jar:/c/x3d-code/www.web3d.org/x3d/stylesheets/java/classes/test/classes
   invoked from toFileStylesheetConversion(X3dToJson.xslt, 
examples/JsonLoaderTest.json, normalizeCommentWhitespace, true, , )

     at 
org.web3d.x3d.jsail.Core.X3D.toFileStylesheetConversion(X3D.java:1171)
     at 
org.web3d.x3d.jsail.Core.X3D.toFileStylesheetConversion(X3D.java:1024)
     at org.web3d.x3d.jsail.Core.X3D.toFileJSON(X3D.java:1835)
     at org.web3d.x3d.tests.JsonLoaderTest.main(JsonLoaderTest.java:23)

(The X3DJSAIL jar file wasn't found--Not going there right now)

The files are here:

./www_web3d_org/x3d/stylesheets/java/tests/org/web3d/x3d/tests/JsonLoaderTest.java
./www_web3d_org/x3d/stylesheets/java/examples/JsonLoaderTest.x3d
./www_web3d_org/x3d/stylesheets/java/examples/JsonLoaderTestPrettyPrint.intermediate.x3d

./www_web3d_org/x3d/stylesheets/java/examples/LoadedJsonConversion.xml


Here is an important diff to project.properties for cross-platform 
compatibility:

ndex: java/nbproject/project.properties
===================================================================
--- java/nbproject/project.properties   (revision 32247)
+++ java/nbproject/project.properties   (working copy)
@@ -37,17 +37,17 @@
  endorsed.classpath=
  excludes=
  file.reference.java-src=src
-file.reference.apiguardian-api-1.0.0.jar=C:\\apache-ant-1.10.5\\lib\\apiguardian-api-1.0.0.jar
+file.reference.apiguardian-api-1.0.0.jar=lib/support/apiguardian-api-1.1.0.jar
  file.reference.jdom.jar=lib/jdom.jar
-file.reference.junit-jupiter-api.jar=C:\\apache-ant-1.10.5\\lib\\jupiter\\junit-jupiter-api.jar
-file.reference.junit-jupiter-engine.jar=C:\\apache-ant-1.10.5\\lib\\jupiter\\junit-jupiter-engine.jar
-file.reference.junit-platform-commons.jar=C:\\apache-ant-1.10.5\\lib\\junit-platform-commons.jar
-file.reference.junit-platform-engine.jar=C:\\apache-ant-1.10.5\\lib\\junit-platform-engine.jar
-file.reference.junit-platform-launcher.jar=C:\\apache-ant-1.10.5\\lib\\junit-platform-launcher.jar
+file.reference.junit-jupiter-api.jar=lib/support/jupiter/junit-jupiter-api-5.5.0.jar
+file.reference.junit-jupiter-engine.jar=lib/support/jupiter/junit-jupiter-engine-5.5.0.jar
+file.reference.junit-platform-commons.jar=lib/support/junit-platform-commons-1.5.0.jar
+file.reference.junit-platform-engine.jar=lib/support/junit-platform-engine-1.5.0.jar
+file.reference.junit-platform-launcher.jar=lib/support/junit-platform-launcher-1.5.0.jar
  file.reference.jaxb-api.jar=lib/support/jaxb/jaxb-api.jar
  file.reference.nagasena-rta.jar=lib/nagasena-rta.jar
  file.reference.nagasena.jar=lib/nagasena.jar
-file.reference.opentest4j-1.1.0.jar=C:\\apache-ant-1.10.5\\lib\\opentest4j-1.1.0.jar
+file.reference.opentest4j-1.1.0.jar=lib/support/opentest4j-1.1.0.jar
  file.reference.exificient-gui-jar-with-dependencies.jar=lib/exificient-gui-jar-with-dependencies.jar
  file.reference.javax.json-api-1.0.jar=lib/javax.json-api-1.0.jar
  file.reference.saxon9he.jar=lib/saxon9he.jar

There are scads more things to deal with JavaLoaderTest.java, as have 
been previously reported, but from my diffs, and all the errors thrown, 
it kind of appears that the X3DLoaderDOM is causing the problem.   But I 
agree it could be indenting/parent-child issues with X3DJSONLD.  I just 
haven't got any smoking gun which points to X3DJSONLD in my diffs.   
Someone more experienced with diffing XML (and has diffing tools like 
XMLSpy should take over debugging).

So we can load JSON, roughly, but there are problems writing out JSON.  
I haven't figured out if there's an issue with loading the JSON yet, as 
the XML printed in the middle, "examples/LoadedJsonConversion.xml", has 
different indenting and quoting.  What I used to verify the JSON was the 
output JSON, which is currently unavailable due to X3DJSAIL jar not 
being in the CLASSPATH.

We have a good test case and code, it's just that my XML diffing tools 
are crap.

I will pursue running under debug next.

John

-------------- next part --------------
A non-text attachment was scrubbed...
Name: JsonLoaderTest.java
Type: text/x-java
Size: 928 bytes
Desc: not available
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20210619/f199b7c0/attachment.bin>


More information about the x3d-public mailing list