Is there a way that I can configure custom node types for Apache Jackrabbit to be registered when a new repository is instantiated?
I am automating my build using Apache Maven and have some unit tests to run with JUnit and integration tests to run with Jetty and want to be able to easily set-up and tear-down a test repository.
If you are able to upgrade to the newly-released Jackrabbit 2.0.0, you can programmatically create and register nodetypes. The main hook is the JSR-283 NodeTypeManager which doubles as a factory for new NodeTypes, and a place for them to be registered. Just register them in the setup method of your JUnit tests, and you should be good to go.
I suggest that you define your nodetypes using a CND file and configure your JUnit test cases to register them for you, as in this example. I would say the most appropriate way to do so is to define an abstract test case which performs this configuration.
Also notice that the node types are associated to a workspace, and not to the whole repository.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With