Here is my camel Integration test that we receive an exception after max number of retries is reached. The test is failing with the following error
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.jbhunt.autoconfigure.security.oauth2.configuration.EnhancedJwtAccessTokenConverter]: Constructor threw exception; nested exception is java.lang.IllegalArgumentException: URI is not absolute
Here is the code
@RunWith(SpringRunner.class)
@Configuration
@EnableAutoConfiguration
public class RedeliveryTestIT extends CamelTestSupport {
private static final String TEST_BODY_PAYLOAD = "sent to jms endpoint";
@Autowired
EventRouteBuilder eventRouteBuilder;
@Mock
private EventRepository eventRepository;
@Mock
private ApplicationEventPublisher publisher;
private int counter;
private String methodName;
@Override
protected JndiRegistry createRegistry() throws Exception {
JndiRegistry jndi = super.createRegistry();
jndi.bind("eventService", new EventService(eventRepository, publisher));
return jndi;
}
private Exchange createExchange() {
final Exchange exchange = ExchangeBuilder.anExchange(context()).build();
exchange.getIn().setBody(EventMocks.createEvent());
return exchange;
}
private void configureMockEndpoint() throws Exception {
final AdviceWithRouteBuilder mockAdvice = new AdviceWithRouteBuilder() {
@Override
public void configure() throws Exception {
replaceFromWith("direct:eventMock");
interceptSendToEndpoint("activemq:*")
.skipSendToOriginalEndpoint()
.process(exchange -> exchange.getIn().setHeader("Emp", "place"));
};
};
eventRouteBuilder.configureRoutes(context).getRoutes().get(0).adviceWith(context, mockAdvice);
}
@Test
public void should_increment_redelivery_count_and_send_to_jms_endpoint() throws Exception {
configureMockEndpoint();
final Exchange requestExchange = createExchange();
final Exchange resultExchange = template.send("direct:eventMock", requestExchange);
final String userId = resultExchange.getIn().getHeader("createUserId", String.class);
assertNotNull(userId);
assertNotNull(resultExchange.getIn().getHeader("Emp", String.class));
}
}
Aucun commentaire:
Enregistrer un commentaire