This page (revision-7) was last changed on 17-Dec-2012 16:34 by constin

This page was created on 17-Dec-2012 11:25 by Markus Friedrich

Only authorized users are allowed to rename pages.

Only authorized users are allowed to delete pages.

Page revision history

Version Date Modified Size Author Changes ... Change note
7 17-Dec-2012 16:34 2 KB constin to previous
6 17-Dec-2012 14:38 2 KB Markus Friedrich to previous | to last
5 17-Dec-2012 12:42 1 KB Markus Friedrich to previous | to last How-To Initialize Plugin Manager in workspace ==> How-To Initialize Plugin Manager for JUnit Tests
4 17-Dec-2012 12:42 1 KB Markus Friedrich to previous | to last
3 17-Dec-2012 11:40 1 KB Markus Friedrich to previous | to last
2 17-Dec-2012 11:36 1 KB Markus Friedrich to previous | to last How-To Initialize Plugin Manager ==> How-To Initialize Plugin Manager in workspace
1 17-Dec-2012 11:25 1 KB Markus Friedrich to last

Page References

Incoming links Outgoing links

Version management

Difference between version and

At line 1 changed one line
!! Initializing the Plugin Manager in the workspace
!!!Testing of/with Plugins
At line 3 changed 2 lines
Usually, the main application take care of loading all required plugins at start-up.
When writing your own small demo program (or a junit test), you can initialize the plugins yourself by
The {{PluginManager}} has to be initialized with the plugins, so that the plugins can be tested or that can be used for testing (e.g. JUnit tests using the loading of a knowledge base).
At line 6 changed 5 lines
%%prettify
{{{
InitPluginManager.init();
}}}
/%
Since it is not necessary for this task to build the entire application and the plugins, we propose a different procedure:
You need to include the following code block into the {{pom}} file of the project having the JUnit test; the code is inserted into the plugin section of the build section.
At line 12 removed one line
This method needs to have a file output.txt in the target folder. This file can be generated by maven using the following plugin in the build tag:
At line 16 changed 19 lines
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>test-compile</phase>
<goals>
<goal>build-classpath</goal>
</goals>
<configuration>
<outputDirectory>target/dependencies</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>false</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
<pathSeparator>;</pathSeparator>
<outputFile>target/dependencies/output.txt</outputFile>
</configuration>
</execution>
</executions>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>test-compile</phase>
<goals>
<goal>build-classpath</goal>
</goals>
<configuration>
<outputDirectory>target/dependencies</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>false</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
<outputFile>target/dependencies/output.txt</outputFile>
<pathSeparator>;</pathSeparator>
</configuration>
</execution>
</executions>
At line 34 added 12 lines
With the help of the ''Maven Dependency Plugin'' a file is written into the target directory, that contains the classpath and thus all required plugins.
For this, all plugins need to be specified as dependency, as it is done for building the application; however, the scope "test" is sufficient.
The scope "compile" should be only applied to the main application and plugins, that are extending other plugins.
It is sufficient to execute {{InitPluginManager.init()}} in order to initialize the {{PluginManger}} with the JUnit test using the created file.
Possibly, a test-dependency on {{d3web-PluginManger}} is required, if not already defined before.
In Eclipse, we then execute the tests using the command
{{{ Run As -> Maven Test}}}
which is also the command of Hudson when starting the tests on the integration server. Alternatively, the JUnit tests can be also started by
{{{Runs As -> JUnit Test}}}
if a fresh file with the classpath is provided.
At line 40 changed one line
howto
howto JUnit