Deepak -
Where do you define the bean so Camel can find it?
Normally, I’d put the bean in another Spring XML file (in
src/test/resources/META-INF/spring for symmetry), and then change the
application context such that it will load both Spring XML files.
protected AbstractApplicationContext createApplicationContext() {
return new
ClassPathXmlApplicationContext("classpath:META-INF/spring/camel-context.xml","classpath:META-INF/spring/test-beans.xml");
}
> On May 18, 2016, at 12:13 AM, Deepak kumar <[email protected]> wrote:
>
> Hi Quinn,
> My test class looks like this. When i am trying to run i am getting error
> message like- No bean "testProcessor" found in the registry.
>
> public class FirstTest extends CamelSpringTestSupport{
>
> @Override
> protected AbstractApplicationContext createApplicationContext() {
> return new ClassPathXmlApplicationContext("camel-context.xml");
> }
>
> @Override
> public String isMockEndpoints() {
> return "*";
> }
>
> @Override
> public CamelContext createCamelContext() {
> CamelContext context = new DefaultCamelContext();
> ActiveMQConnectionFactory cf = new
> ActiveMQConnectionFactory("vm://localhost?broker.persistent=false");
> ActiveMQConfiguration config=new ActiveMQConfiguration();
> config.setConnectionFactory(cf);
>
> ActiveMQComponent activeMQComponent = new ActiveMQComponent();
> activeMQComponent.setConfiguration(config);
> context.addComponent("jms", activeMQComponent);
> TestProcessor dp=new TestProcessor();
> return context;
> }
>
>
> @Test
> public void test() throws InterruptedException{
> MockEndpoint mock = getMockEndpoint("mock:bean:testProcessor");
>
> HashMap header=new HashMap<>();
> header.put("token","ABCD");
> template.setDefaultEndpointUri("bean:testPreProcessor");
> template.sendBodyAndHeader("direct:test","Hello World",header);
> assertMockEndpointsSatisfied();
>
> }
>
> }
>
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/mock-http-endpoint-and-retrieving-value-form-properties-file-tp5782604p5782727.html
> Sent from the Camel - Users mailing list archive at Nabble.com.