Closed Dufgui closed 8 years ago
Thanks, I'll look at it, that's something I wanted to add.
you 're welcome. ;o) I you have the time just to release a compatibility version of emfjson-mongo. Because i build a snap localy but it's not really good and the previous version is ko with the 0.13 version
This should be included in version 0.15.
For your other question, emfjson-mongo will be reworked completely, the correct implementation is more a proof of concept. Keep a look on https://github.com/emfjson/emfjson-mongo
Hello, i add the type when serialize external proxy. Sorry for the merge. My git do a strange bug when i rebase. but you can review. and if it's ok I can rework my commit.
So i test your advice and all is working fine ;o). Thanks. So i commit it. Say me if there is still something to touch
Have you tested the master branch? see comment https://github.com/emfjson/emfjson-jackson/issues/78
Closing for now, please tell me if you have still those issues with 0.15.
Hello, i take the 0.15 and create a unit test with containment proxy of an abstract class. And it's failed ! the i switch back to my branch and it's work. Is it help you ? You want other unit test ? or is it enought ?
https://github.com/Dufgui/emfjson-jackson/commit/1902d210355a3474bb99b49b6ce85f250581cd19
Do you want i rebase my branch to the 0.15, in order to simplify the merge?
I made a pursh to rename my test file to avoid conflict on merge with 0.15
Thanks. If the unit test you added shows the problem it's enough for me to see what's wrong with current version.
So I try a newbranch updated with your 0.15 tag. Hope my tests is more clear
Your test doesn't look to pass either for XMI resources.
If I have test2.xmi that contains
<?xml version="1.0" encoding="ASCII"?>
<model:PhysicalNode xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:model="http://www.emfjson.org/jackson/model" label="p2"/>
and test1.xmi that contains
<?xml version="1.0" encoding="ASCII"?>
<model:PhysicalNode xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:model="http://www.emfjson.org/jackson/model" label="p1">
<child xsi:type="model:PhysicalNode" href="src/test/resources/xmi/test2.xmi#/"/>
</model:PhysicalNode>
And then I run the following test, it will fail on assertNotSame(p2.eResource(), p1.eResource());
ResourceSet resourceSet = new ResourceSetImpl();
resourceSet.getPackageRegistry().put(ModelPackage.eNS_URI, ModelPackage.eINSTANCE);
resourceSet.getResourceFactoryRegistry()
.getExtensionToFactoryMap()
.put("xmi", new XMIResourceFactoryImpl());
Resource x1 = resourceSet.getResource(URI.createURI("src/test/resources/xmi/test1.xmi"), true);
PhysicalNode p1 = (PhysicalNode) x1.getContents().get(0);
AbstractNode p2 = p1.getChild().get(0);
assertTrue(p2.eIsProxy());
assertNotSame(p2.eResource(), p1.eResource());
But this one will succeed, if you resolve the proxy.
AbstractNode p2 = p1.getChild().get(0);
assertTrue(p2.eIsProxy());
assertSame(p2.eResource(), p1.eResource());
EObject resolve = EcoreUtil.resolve(p2, resourceSet);
assertNotSame(resolve.eResource(), p1.eResource());
If you want the first test to succeed, or you don't want to resolve manually, you should set the reference property resolveProxies
to true.
In xcore it is done with resolving
keyword.
abstract class AbstractNode {
String label
contains resolving AbstractNode[] child opposite parent
}
During deserialization, proxies will be put in child
list, only when you access an element in that list, it will be resolve.
I have no more time to work on this for the moment maybe later.... in 1 month i think. sorry
Hello,
due to performance and functionnal reason (cypher and splitting managment), we split by ourself Resources. It's work with Xml but not with your json lib. So i add this use case managment. Hope this code is enought good to be interated.
Have a nice day