Hi,

servicemix-jsr181 is kinda deprecated and not supported in Smx 4.0 anymore.
You should use servicemix-cxfse instead.
Freeman

On 2009-7-8, at 下午6:52, TheWinch wrote:


Hi,

I'm trying to test a jsr181 deployment using integration testing. I have an
annotated pojo that I want to test.

My environment:
- servicemix 4.0.0
- maven 2.0.9
- eclipse Ganymede with Maven integration plugin

I have configured the testing environment properly: test classes &
ressources go to target/test-classes. See all the files below. When I launch my test (using Run as... Maven test) I get the following error (same error
when launching from command line):

test(eu.diva.tis.thinkingtool.resource.MySpringComponentTest) Time elapsed:
0.406 sec  <<< ERROR!
org.springframework.beans.factory.BeanDefinitionStoreException: Unrecognized
xbean namespace mapping: http://servicemix.apache.org/jsr181/1.0cmd

I guess this is because the servicemix-jsr181 is not on the classpath, but I
cannot find how to add it. I read the tutorial about Camel integration
testing but it dod not help much. If someone has an idea, I'd be very
grateful !

My pom.xml:


<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd";>
 <modelVersion>4.0.0</modelVersion>

 <groupId>eu.diva.tis.thinkingtool</groupId>
 <artifactId>resource-finder</artifactId>
 <packaging>bundle</packaging>
 <name>DiVA :: Sample Bundle</name>
 <version>1.0.0-SNAPSHOT</version>

 <dependencies>
   <dependency>
        <groupId>org.apache.servicemix</groupId>
        <artifactId>servicemix-utils</artifactId>
        <version>${servicemix-utils.version}</version>
   </dependency>
   <dependency>
     <groupId>org.apache.servicemix</groupId>
     <artifactId>servicemix-core</artifactId>
     <version>3.3</version>
     <scope>provided</scope>
   </dependency>
   <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.6</version>
        <type>jar</type>
        <scope>test</scope>
   </dependency>
   <dependency>
        <groupId>org.apache.servicemix</groupId>
        <artifactId>servicemix-jsr181</artifactId>
        <version>2009.01</version>
        <type>zip</type>
        <classifier>installer</classifier>
        <scope>test</scope>
   </dependency>
   <dependency>
        <groupId>eu.diva.tis</groupId>
        <artifactId>diva-tis-api</artifactId>
        <version>1.0.0-SNAPSHOT</version>
        <scope>compile</scope>
   </dependency>
 </dependencies>

 <build>
        <resources>
     <resource>
       <directory>src/main/resources</directory>
       <includes>
         <include>**/*</include>
       </includes>
     </resource>
   </resources>
   <plugins>
<!-- configure the bundle plugin with some additional imports -->
     <plugin>
       <groupId>org.apache.felix</groupId>
       <artifactId>maven-bundle-plugin</artifactId>
       <version>1.4.1</version>
       <extensions>true</extensions>
       <configuration>
         <instructions>
<Bundle-SymbolicName>${pom.artifactId}</Bundle- SymbolicName>

<Import- Package >org.apache.servicemix.bean,org.apache.servicemix.common.osgi,*</ Import-Package>
         </instructions>
       </configuration>
     </plugin>
   </plugins>
 </build>
 <properties>
        <servicemix-utils.version>1.1.0</servicemix-utils.version>
        <servicemix-version>4.0.0</servicemix-version>
 </properties>
</project>


my src/test/resources/spring.xml:


<beans xmlns="http://www.springframework.org/schema/beans";
           xmlns:sm="http://servicemix.apache.org/config/1.0";
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
           xmlns:jsr181="http://servicemix.apache.org/jsr181/1.0";
      xmlns:test="urn:test"
      xsi:schemaLocation="
        http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring- beans.xsd
        http://servicemix.apache.org/jsr181/1.0

http://servicemix.apache.org/schema/servicemix-jsr181-2009.01.xsd";>

 <sm:container id="jbi" embedded="true" createMBeanServer="false">
        <sm:deployments>
     <sm:installSharedLibrary groupId="org.apache.servicemix"
artifactId="servicemix-shared"/>
     <sm:installComponent groupId="org.apache.servicemix"
artifactId="servicemix-jsr181"/>
   </sm:deployments>
   <sm:activationSpecs>
     <sm:activationSpec>
        <sm:component>
          <jsr181:component>
            <jsr181:endpoints>
           <jsr181:endpoint annotations="jsr181"
                                        service="test:service"
                                        endpoint="endpoint">
                <jsr181:pojo>
                        <bean
class="eu.diva.tis.thinkingtool.resource.ResourceFinder">
                                <property name="context" ref="context"/>
                        </bean>
                </jsr181:pojo>
           </jsr181:endpoint>
            </jsr181:endpoints>
            </jsr181:component>
       </sm:component>
     </sm:activationSpec>
   </sm:activationSpecs>
 </sm:container>
</beans>


my test case:


public class MySpringComponentTest extends SpringTestSupport {

   @Test
   public void test() throws Exception {
      // TODO: add stuff here
   }

   protected AbstractXmlApplicationContext createBeanFactory() {
       return new ClassPathXmlApplicationContext("spring.xml");
   }

}


--
View this message in context: 
http://www.nabble.com/Error-during-integration-testing-with-Eclipse-tp24389307p24389307.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.



--
Freeman Fang
------------------------
Open Source SOA: http://fusesource.com

Reply via email to