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?

> 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.

> 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.

Kind Regards,
Stefan

Reply via email to