I am trying to test
@Bean
public IntegrationFlow integrationFlow(JobLaunchingGateway jobLaunchingGateway) {
return IntegrationFlows.from(inventoryImportInboundChannelAdapter,
p -> p.poller(Pollers.fixedRate(inventoryImportJobProperties.getPollingFrequency()))).
handle(fileMessageToPath()).
handle(fileMessageToJobRequest()).
handle(jobLaunchingGateway).
log(LoggingHandler.Level.INFO, "headers.id + ': ' + payload").
get();
}
Inventory import channel adapter is s3 adapter, i dont want to connect to S3 for component test. I tried using MockIntegrationContext and it did not work . Please advise
@RunWith(SpringRunner.class)
@SpringBootTest(classes = {ImportInventoryJobIntegrationFlow.class})
@SpringIntegrationTest
public class ImportInventoryJobIntegrationFlowTest {
@MockBean
private MessageSource<?> inventoryImportInboundChannelAdapter;
@MockBean
private Job inventoryImportJob;
@MockBean
private JobRepository jobrepository;
@MockBean
private InventoryImportJobProperties inventoryImportJobProperties;
@Autowired
private MockIntegrationContext mockIntegrationContext;
@Test
public void testChannelAdapter(){
File importFile = Mockito.mock(File.class);
BDDMockito.given(importFile.getParent()).willReturn("test.import");
System.out.println(mockIntegrationContext);
this.mockIntegrationContext.substituteMessageSourceFor("inventoryImportInboundChannelAdapter",
MockIntegration.mockMessageSource(importFile));
}
}
Error getting is: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'inventoryImportInboundChannelAdapter' available