Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: color test

...

Warning
titleTODO

 
INS When to use this JBI Component
INS Using the component that you created
provide exact position in the SVN! 
/samples/hello-world-SE-SU-SA/
integrate from SVN source like it is done at Configuration  at http://www.servicemix.org/site/visualisation.html

maybe moving the content of overlapping existing docus to this new tut and - where appropriate - delete the old ones (only leaving a redirect).
http://www.servicemix.org/site/notes-on-creating-jbi-component-using-maven2.html
http://www.servicemix.org/site/creating-a-standard-jbi-component.htmlImage Removed
is already fully incorporated, so delete content and point from there to here

provide additional reading

Maybe add testing 

...

First, we create a directory hello-world-SE-SU-SA and open a command line in this folder. Now we execute the following command (it has to be one line but was split to be readable):

No Formatpanel

mvn

archetype:create

-DarchetypeGroupId=org.apache.servicemix.tooling

-DarchetypeArtifactId=servicemix-service-engine


-DarchetypeVersion=3.0-incubating

-DgroupId=org.

apache

apache.servicemix.samples.helloWorldSE

-DartifactId=hello-world-SE

Code Block

color test mvn archetype:create -DarchetypeGroupId=org.apache.servicemix.tooling -DarchetypeArtifactId=servicemix-service-engine
-DarchetypeVersion=3.0-incubating -DgroupId=org.apache.servicemix.samples.helloWorldSE -DartifactId=hello-world-SE

The first three parameters identify the maven 2 archetype to use, while the last two parameters define the generated maven 2 project. The version information "3.0-incubating" may have to be changed; a look at any of ServiceMix' pom.xml reveals the version to use. Maven uses the group ID (printed in pink) as default Java package (see Defaulting package to group ID: in output below as well), thus invalid characters like minus, percent etc. must be avoided or a custom package name has to be given as parameter. The output looks like this (only relevant information preserved):

The first three parameters identify the maven 2 archetype to use, while the last two parameters define the generated maven 2 project. The version information "3.0-incubating" may have to be changed; a look at any of ServiceMix' pom.xml reveals the version to use. Maven uses the group ID (printed in pink) as default Java package (see Defaulting package to group ID: in output below as well), thus invalid characters like minus, percent etc. must be avoided or a custom package name has to be given as parameter. The output looks like this (only relevant information preserved):

No Format
No Format
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'archetype'.
[INFO] ----------------------------------------------------------------------------
[INFO] Building Maven Default Project
[INFO]    task-segment: [archetype:create] (aggregator-style)
[INFO] ----------------------------------------------------------------------------
...
[INFO] Defaulting package to group ID: org.apache.servicemix.samples.helloWorldSE
...
[INFO] ********************* End of debug info from resources from generated POM ***********************
[INFO] Archetype created in dir: C:\0hello-world-SE-SU-SA\hello-world-SE
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------

...

Doing automated testing of the code is possible as well. As ServiceMix' root POM disables testing, it has to be activated for the subprojects that shall be tested. To do so, the <build> entity of our pom.xml has to be enriched byactivated for the subprojects that shall be tested. To do so, the <build> entity of our pom.xml has to be enriched by

No Format

<pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                   
No Format

        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <configuration>
                       
                    <configuration>
                        <skip>false</skip><!-- this overrides ServiceMix' root POM and forces to execute the tests -->
                                       </configuration>
                               </plugin>
                       </plugins>
               </pluginManagement>

 where <skip>false</skip> is the relevant line of code. Now, tests will be done when executing

...

The output shall look like the followingINFO Scanning for projects...
INFO ----------------------------------------------------------------------------
INFO Building A custom project
INFO task-segment: test
INFO ----------------------------------------------------------------------------
...
INFO test
INFO Setting reports dir: c:\java\tmp\servicemix-xslt\target/surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
surefire Running org.apache.servicemix.helloWorldSE.MySpringComponentTest
...
surefire Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 1,422 sec
INFO ------------------------------------------------------------------------
INFO BUILD SUCCESSFUL
INFO ------------------------------------------------------------------------
INFO Total time: 42 seconds
INFO Finished at: Thu May 11 22:50:58 CEST 2006
INFO Final Memory: 8M/18M
INFO ------------------------------------------------------------------------ 
Adding

The default implementation of the component accepts InOut MEPs and return the input content as the out message.

...