我正在尝试为我的camel jpa示例编写一个RouteTest类,由于以下行,它无法按预期工作:
Bundle RouteTest正在等待命名空间处理程序[http://aries.apache.org/xmlns/jpa/v1.1.0]
请在此处找到blueprint.xml文件
<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:camel="http://camel.apache.org/schema/blueprint"
xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0"
xmlns:jpa="http://aries.apache.org/xmlns/jpa/v1.1.0"
xsi:schemaLocation="
http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
http://camel.apache.org/schema/blueprint http://camel.apache.org/schema/blueprint/camel-blueprint.xsd
http://aries.apache.org/xmlns/jpa/v1.1.0 http://aries.apache.org/schemas/jpa/jpa_110.xsd">
<bean id="jpa" class="org.apache.camel.component.jpa.JpaComponent">
<jpa:unit unitname="persistence-pu" property="entityManagerFactory" />
</bean>
<camelContext trace="true" id="blueprintContext" xmlns="http://camel.apache.org/schema/blueprint">
<route id="persist">
<from uri="direct:persist"/>
<to uri="jpa:Person"/>
</route>
</camelContext>
</blueprint>
和这里的RouteTest类:
public class RouteTest extends CamelBlueprintTestSupport {
@Override
protected String getBlueprintDescriptor() {
return "/OSGI-INF/blueprint/blueprint.xml";
}
@Test
public void testRoute() throws Exception {
getMockEndpoint("mock:result").expectedMinimumMessageCount(1);
ProducerTemplate producerTemplate = new DefaultCamelContext().createProducerTemplate();
Person person = new Person();
person.setName("Bob");
producerTemplate.sendBody("direct:persist", person);
// assert expectations
assertMockEndpointsSatisfied();
}
}
答案 0 :(得分:0)
您需要提供Aries Blueprint,尤其是您需要提供aries JPA依赖项。你如何测试你的路线?我建议使用Pax-Exam或者更好地使用Pax-Exam-Karaf并使用aries jpa功能。