super(configurationName);
}
@Override
protected void extraJBIConfiguration(final @Nullable Document jbiDocument) {
assert jbiDocument != null;
final Element compo = getComponentElement(jbiDocument);
// Here, add a component configuration directly in the component JBI descriptor.
final Element transport = addElement(jbiDocument, compo, BcGatewayJbiConstants.EL_TRANSPORT_LISTENER);
transport.setAttribute(BcGatewayJbiTestConstants.ATTR_TRANSPORT_LISTENER_ID,
AbstractEnvironmentTest.TEST_TRANSPORT_NAME);
}
}
@BeforeAll
private static void completesComponentUnderTestConfiguration() throws Exception {
COMPONENT_UNDER_TEST
.setParameter(
new QName("http://petals.ow2.org/components/extensions/version-5", "properties-file"),
new ParameterGenerator() {
@Override
public String generate() throws Exception {
final Properties componentProperties = new Properties();
final File componentPropertiesFile = Files
.createTempFile(tempFolder, "component-properties", "properties").toFile();
try (final FileOutputStream fos = new FileOutputStream(componentPropertiesFile)) {
componentProperties.store(fos, "Initial placeholders");
}
return componentPropertiesFile.getAbsolutePath();
}
})
.registerServiceToDeploy(VALID_INTEGRATION_SU_PROVIDE, new ServiceConfigurationFactory() {
@Override
public ServiceConfiguration create() {
final URL wsdlUrl = Thread.currentThread().getContextClassLoader()
.getResource("su/valid/integrationMailService.wsdl");
assertNotNull(wsdlUrl, "WSDl not found");
final ProvidesServiceConfiguration serviceConfiguration = new ProvidesServiceConfiguration(
IntegrationService.INTERFACE_NAME, INTEGRATION_SVC_NAME, INTEGRATION_EDP, wsdlUrl);
serviceConfiguration.setParameter(
new QName(MailConstants.MAIL_SERVICE_NS, MailConstants.SCHEME_PATHELEMENT),
MailConstants.MAIL_SCHEME_SMTP);
...
return serviceConfiguration;
}
})
.registerServiceToDeploy(VALID_SU_CONSUME_POP3, new ServiceConfigurationFactory() {
@Override
public ServiceConfiguration create() {
final ConsumesServiceConfiguration serviceConfiguration = new ConsumesServiceConfiguration(
PROVIDER_ITF_NAME, PROVIDER_SVC_NAME, PROVIDER_EDP);
serviceConfiguration.setOperation(CONSUMED_OPERATION);
serviceConfiguration.setTimeout(CONSUMED_TIMEOUT);
serviceConfiguration.setParameter(
new QName(MailConstants.MAIL_SERVICE_NS, MailConstants.SCHEME_PATHELEMENT),
MailConstants.MAIL_SCHEME_POP3);
...
return serviceConfiguration;
}
})
.registerExternalServiceProvider(PROVIDER_EDP, PROVIDER_SVC_NAME, PROVIDER_ITF_NAME)
.postInitComponentUnderTest();
}
@Test
public void receiveMail() throws Exception {
...
COMPONENT.receiveAsExternalProvider(
ServiceProviderImplementation.statusMessage(ExchangeStatus.DONE).with(new MessageChecks() {
@Override
public void checks(Message message) throws Exception {
...
}
}), 4000, true);
// Check MONIT traces
final List<LogRecord> monitLogs = COMPONENT_UNDER_TEST.getInMemoryLogHandler().getAllRecords(Level.MONIT);
assertEquals(4, monitLogs_1.size());
final FlowLogData consumeExtLogData = assertMonitMailConsumerBeginLog(..., monitLogs.get(0));
final FlowLogData provideLogData = assertMonitProviderBeginLog(..., monitLogs.get(1));
assertMonitProviderEndLog(provideLogData, monitLogs.get(2));
assertMonitConsumerExtEndLog(consumeExtLogData, monitLogs.get(3));
}
}
{code}
{anchor:from57xto58x}
h1. From 5.7.x to 5.8.x
h2. Migrating your component runtime
Please apply the following changes in the source code of your custom component:
* Placeholders are no more defined through {{Properties}} but through {{Placeholders}}.