-1
我想寫我的駱駝JPA例如RouteTest類和預期的,因爲下面一行它不起作用:駱駝JPA等待命名空間處理
捆綁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();
}
}
謝謝你的回答。我剛剛添加了我正在使用的藍圖和RouteTest代碼。 –
你的classpath中有aries blueprint嗎(maven pom)?哦,順便說一句。 CamelBlueprintTestSupport對JPA不起作用,對於簡單的Camel測試很好,但由於PojoSR而與JPA搞砸,我真的推薦使用Pax-Exam或更好的Pax-Exam-Karaf。 –
我已經添加了依賴到白羊座,現在我有一個新問題:( [Blueprint Extender:1] BlueprintContainerImpl INFO Bundle RouteTest正在等待依賴關係[(&(&(!(org.apache.aries.jpa.proxy .factory = *))(osgi.unit.name = JP-A-示例-PU))(objectClass的= javax.persistence.EntityManagerFactory))] –