2013-04-02 8 views
-1

내 낙타 JPA 예를 들어 RouteTest 클래스를 작성려고하고 있기 때문에 다음 행의 예상대로 작동하지 않습니다낙타 JPA

이 번들 RouteTest 네임 스페이스 핸들러를 기다리고 [http://aries.apache.org/xmlns/jpa/v1.1.0]

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(); 
    } 

} 
:

여기

<?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> 

및 파일 blueprint.xml 여기 RouteTest 클래스를 찾아주세요

답변

0

당신은 양자리 청사진을 제공해야하며 특히 양자리 JPA 종속성을 제공해야합니다. 당신은 어떻게 당신의 노선을 테스트합니까? 나는 Pax-Exam을 사용하거나 아마도 Pax-Exam-Karaf를 사용하고 양자리 JPA 기능을 사용하는 것이 좋습니다.

+0

답장을 보내 주셔서 감사합니다. 방금 사용하고있는 청사진과 RouteTest 코드를 추가했습니다. –

+0

클래스 패스 (aven pom)에 양자리 청사진이 있습니까? 오, btw. CamelBlueprintTestSupport는 JPA와 잘 맞지 않습니다. 단순한 Camel 테스트에는 좋지만 PojoSR로 인해 JPA에 빠졌습니다. Pax-Exam 또는 Pax-Exam-Karaf를 사용하는 것이 좋습니다. –

+0

양자리에 종속성을 추가 했으므로 새로운 문제가 생겼습니다. ( [Blueprint Extender : 1] BlueprintContainerImpl 정보 번들 RouteTest가 종속성을 기다리고 있습니다. ((& (& (! (org.apache.aries.jpa.proxy .factory = *)) (osgi.unit.name = jpa-example-pu)) (objectClass = javax.persistence.EntityManagerFactory))] –