Hi,
after the fix for OPENJPA-3017 things are getting much better for my tests,
thank you!
There is however still something to refine about AttributeConverter, I believe.
In particular, in JPAAuthModule [1] we have
@Convert(converter = AuthModuleConfConverter.class)
@Lob
private AuthModuleConf jsonConf;
where AuthModuleConf is an interface that could have multiple implementations.
The converter [2] extending [3] will eventually invoke the utility class [4]
which essentially calls Jackson to (de)serialize from / to String the actual
value.
By running tests, I am noticing that, at least in some cases, the actual
deserialized instance is not returned by the JPA entity.
For StaticAuthModuleConf [5], for example, I can debug that [4] is called with
input
{"_class":"org.apache.syncope.common.lib.auth.StaticAuthModuleConf","users":{"syncope1":
"$cynop3"}}
as expected and that the correct StaticAuthModuleConf instance is returned by
the method.
When calling JPAAuthModule#getConf (which returns the jsonConf field as above), however,
I can see that a proxy instance of StaticAuthModuleConf is returned (which I could expect
somehow), but such proxy is giving an empty "users" map, rather than the one I
could see from [4] output.
Maybe something to refine with that proxy, then?
Thank you again.
Regards.
[1]
https://github.com/apache/syncope/blob/master/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/am/JPAAuthModule.java#L60-L62
[2]
https://github.com/apache/syncope/blob/master/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/converters/AuthModuleConfConverter.java
[3]
https://github.com/apache/syncope/blob/master/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/converters/SerializableConverter.java
[4]
https://github.com/apache/syncope/blob/master/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/serialization/POJOHelper.java#L91
[5]
https://github.com/apache/syncope/blob/master/common/am/lib/src/main/java/org/apache/syncope/common/lib/auth/StaticAuthModuleConf.java
--
Francesco Chicchiriccò
Tirasa - Open Source Excellence
http://www.tirasa.net/
Member at The Apache Software Foundation
Syncope, Cocoon, Olingo, CXF, OpenJPA
https://about.me/ilgrosso