Hi, I am fairly new to Camel.
I am writing some test cases, trying to integrate Camel with Spring.

My testCase is 

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration
@PropertySource("classpath:test.properties")
public class DistributionTargetProcessorTest extends CamelSpringTestSupport
{

    protected CamelContext camelContext;

    protected ProducerTemplate template;

   @Autowired fields.....

 @Configuration
    static class SomeTestConfiguration {
     @Bean
        public AutowiredField someRepositoy() {
            return Mockito.mock(SomeRepository.class);

         etc....
        }

 @Before
    public void startServices() throws Exception {
        
        deleteDirectory("activemq-data");
        camelContext = new DefaultCamelContext();
        camelContext.addRoutes(new MockRoute());
        template = camelContext.createProducerTemplate();
        camelContext.start();
    }

@Test
    public void testClientInvocation() throws Exception {
                
        String out = "";
        try {

        template.sendBodyAndHeaders("direct:testDistProcessor",
generateConfirmationContainer(), getConfirmationHeaders());
        
        }
        catch (Exception npe) {
        }
    }

@Override
        protected AbstractApplicationContext createApplicationContext() {
                return new 
ClassPathXmlApplicationContext("spring/conf-ctx.xml");
                }

public class MockRoute extends RouteBuilder {
        
    public void configure() {
        from("direct:testDistProcessor")
                .process(new TargetProcessor())               
                .end();
    }   
}

public class DistributionTargetProcessor implements Processor{


    @Value("${some.property}")
    private String someProperty;

    @Override
    public void process(Exchange exchange) throws Exception {



in my context

<context:property-placeholder
location="file:///${home}/cfg/test.properties"/>


The properties in my Processor come as null. Also any autowire fields come
as null. 
I am guessing the spring application context is not configured properly but
could some point out what's wrong?




--
View this message in context: 
http://camel.465427.n5.nabble.com/Can-t-read-properties-from-Processor-tp5728996.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to