|
Key
This line was removed.
This word was removed. This word was added.
This line was added.
|
Changes (5)
View Page History...
public class MyComponentTest
@ComponentUnderTestExtension(inMemoryLogHandler = @InMemoryLogHandlerExtension, explicitPostInitialization = true)
@ComponentUnderTestExtension(
inMemoryLogHandler = @InMemoryLogHandlerExtension,
installesComponent = true,
startsComponent = true,
explicitPostInitialization = true,
componentConfiguration = @ComponentConfigurationExtension(
name = "componentUnderTest",
implementation = ExtendedComponentConfiguration.class))
inMemoryLogHandler = @InMemoryLogHandlerExtension,
installesComponent = true,
startsComponent = true,
explicitPostInitialization = true,
componentConfiguration = @ComponentConfigurationExtension(
name = "componentUnderTest",
implementation = ExtendedComponentConfiguration.class))
protected static ComponentUnderTest COMPONENT_UNDER_TEST;
protected static class BasicComponentConfiguration extends ComponentConfiguration {
public ExtendedComponentConfiguration(final String configurationName) {
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);
}
}
public ExtendedComponentConfiguration(final String configurationName) {
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 {
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();
}
})
.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();
}
})
COMPONENT_UNDER_TEST.registerServiceToDeploy(VALID_INTEGRATION_SU_PROVIDE, new ServiceConfigurationFactory() {
@Override
public ServiceConfiguration create() {
public ServiceConfiguration create() {
...