You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by TheWinch <vi...@thalesgroup.com> on 2009/07/08 12:52:26 UTC
Error during integration testing with Eclipse
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.
Re: Error during integration testing with Eclipse
Posted by Freeman Fang <fr...@gmail.com>.
Hi,
You mentioned you test in SMX4. I don't think you can start embeded
smx container with configure file like
<sm:container id="jbi" embedded="true" createMBeanServer="false"
monitorInstallationDirectory="false">...
in smx4.
Are you sure you want to test against SMX4?
SMX4 is osgi based container, so if you want to test such JBI endpoint
in SMX4, you should follow the example [1], basically you need add
endpoint bundes for your test.
And if you actually want to write testcase against SMX3, take a look
at this example [2], you may also need go through the pom.xml and
spring.xml[3] used for this test.
[1]https://svn.apache.org/repos/asf/servicemix/smx4/features/trunk/examples/itests/tests/src/test/java/org/apache/servicemix/examples/CXFNMRIntegrationTest.java
[2]https://svn.apache.org/repos/asf/servicemix/smx3/branches/servicemix-3.2/deployables/serviceengines/servicemix-cxf-se/src/test/java/org/apache/servicemix/cxfse/CxfSeSpringTest.java
[3]https://svn.apache.org/repos/asf/servicemix/smx3/branches/servicemix-3.2/deployables/serviceengines/servicemix-cxf-se/src/test/resources/org/apache/servicemix/cxfse/spring.xml
Freeman
On 2009-7-8, at 下午9:18, TheWinch wrote:
>
> I have the same error with CXF-SE:
>
> org.springframework.beans.factory.BeanDefinitionStoreException:
> Unrecognized
> xbean namespace mapping: http://servicemix.apache.org/cxfse/1.0
>
>
> I have the following in my pom.xml (I have copied the jar in D:\):
>
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-surefire-plugin</artifactId>
> <version>2.4.3</version>
> <configuration>
> <additionalClasspathDependencies>
>
> <additionalClasspathDependency>file://D:/servicemix-cxf-
> se-2009.01.jar</additionalClasspathDependency>
> </additionalClasspathDependencies>
> </configuration>
> </plugin>
>
> and in my spring.xml I basically replaced all references to JSR181
> with
> references to CXF-SE:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <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:cxfse="http://servicemix.apache.org/cxfse/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/cxfse/1.0
>
> http://servicemix.apache.org/schema/servicemix-cxfse-2009.01.xsd">
>
> <sm:container id="jbi" embedded="true" createMBeanServer="false"
> monitorInstallationDirectory="false">
> <sm:deployments>
> <sm:installSharedLibrary groupId="org.apache.servicemix"
> artifactId="servicemix-shared"/>
> <sm:installComponent groupId="org.apache.servicemix"
> artifactId="servicemix-cxf-se"/>
> </sm:deployments>
> <sm:activationSpecs>
> <sm:activationSpec>
> <sm:component>
> <cxfse:component>
> <cxfse:endpoints>
> <cxfse:endpoint service="test:service"
> endpoint="endpoint">
> <cxfse:pojo>
> <bean
> class="eu.diva.tis.thinkingtool.resource.ResourceFinder">
> <property name="context" ref="context"/>
> </bean>
> </cxfse:pojo>
> </cxfse:endpoint>
> </cxfse:endpoints>
> </cxfse:component>
> </sm:component>
> </sm:activationSpec>
> </sm:activationSpecs>
> </sm:container>
> </beans>
>
> --
> View this message in context: http://www.nabble.com/Error-during-integration-testing-with-Eclipse-tp24389307p24391387.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>
--
Freeman Fang
------------------------
Open Source SOA: http://fusesource.com
Re: Error during integration testing with Eclipse
Posted by TheWinch <vi...@thalesgroup.com>.
I have the same error with CXF-SE:
org.springframework.beans.factory.BeanDefinitionStoreException: Unrecognized
xbean namespace mapping: http://servicemix.apache.org/cxfse/1.0
I have the following in my pom.xml (I have copied the jar in D:\):
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.4.3</version>
<configuration>
<additionalClasspathDependencies>
<additionalClasspathDependency>file://D:/servicemix-cxf-se-2009.01.jar</additionalClasspathDependency>
</additionalClasspathDependencies>
</configuration>
</plugin>
and in my spring.xml I basically replaced all references to JSR181 with
references to CXF-SE:
<?xml version="1.0" encoding="UTF-8"?>
<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:cxfse="http://servicemix.apache.org/cxfse/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/cxfse/1.0
http://servicemix.apache.org/schema/servicemix-cxfse-2009.01.xsd">
<sm:container id="jbi" embedded="true" createMBeanServer="false"
monitorInstallationDirectory="false">
<sm:deployments>
<sm:installSharedLibrary groupId="org.apache.servicemix"
artifactId="servicemix-shared"/>
<sm:installComponent groupId="org.apache.servicemix"
artifactId="servicemix-cxf-se"/>
</sm:deployments>
<sm:activationSpecs>
<sm:activationSpec>
<sm:component>
<cxfse:component>
<cxfse:endpoints>
<cxfse:endpoint service="test:service"
endpoint="endpoint">
<cxfse:pojo>
<bean
class="eu.diva.tis.thinkingtool.resource.ResourceFinder">
<property name="context" ref="context"/>
</bean>
</cxfse:pojo>
</cxfse:endpoint>
</cxfse:endpoints>
</cxfse:component>
</sm:component>
</sm:activationSpec>
</sm:activationSpecs>
</sm:container>
</beans>
--
View this message in context: http://www.nabble.com/Error-during-integration-testing-with-Eclipse-tp24389307p24391387.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.
Re: Error during integration testing with Eclipse
Posted by Freeman Fang <fr...@gmail.com>.
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