On 2/15/11 12:41 AM, Stefan Seelmann wrote:
On Tue, Feb 15, 2011 at 12:10 AM, Emmanuel Lecharny<elecha...@gmail.com> wrote:
Hi guys,
today, I continued to document the Dn class. I did it on the confluence
wiki, as I have a tool to export a confluence docuemnt to a docBook format,
which is way more convenient than typing text in XML...
Which tool?
Wikbook. It takes a wiki format and generates docbook formt. Still have
to test it, but I know the guy working on it.
http://code.google.com/p/wikbook/
Here is the current doco about Dn :
https://cwiki.apache.org/confluence/display/DIRAPI/DN+API
Feel free to review, and fix it.
Great, thanks.
One first comment wrt to the code samples. Today I had the idea to
create some code samples on how to use the API in the
documentation/samples directory (I didn't start yet). One idea I had
that it would be cool if the samples project could be added to the
"trunks" aggregator so that changes in trunk are directly reflected in
the samples. The 2nd idea was that it would be cooler if the examples
in the doco could be directly extracted from the samples code. The big
problem with code snippets in doco is that it isn't updated when
refactorings in the main code are done. Maybe Xinclude
(http://www.w3.org/TR/xinclude/) helps here.
I have created a project where I put all the code samples I have added
in the wiki (just to be sure they are not wrong).
I think we can add the code in the apacheds-manual project.
So, yes, good idea !
Ok, that being said, this is a very interesting exercise, as it forces you
to use the API and to think like a user. And what we have is not really
perfect :/
I'm currently trying to leverage the SchemaManager in Dn, which somehow
forced me to create a DefaultSchemaManager INSTANCE static field, which
loads the default schemas (those that are enabled by default). Now, creating
a schema aware DN is just a matter of calling :
Dn dn = new Dn( DefaultSchemaManager.INSTANCE, "dc=example, dc=com");
Works great. Sadly, I had to move the Dn tests out of the shared-ldap-model
otherwise there would be no way to use the SchemaManager instance, as it's
declared in another module. So I moved it to shared-integ (all in all, I
think it's the right place for tests anyway).
I'm now going a step further and move some other tests that requires a
SchemaManager to shared-integ.
I agree that if classes from different modules are used in test then
the right location is the shared-integ module.
Otherwise, if the test should be kept in the model module a
SchemaManager mock is the way to go.
We can discuss that. Frankly, right now, I'm more into checking the Dn
API and writing the doco than thinking about the right place for tests,
so I took the path of least resistance. But, basically, you are 100%
right : we may have to define a MockSchemaManager.
--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com