Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for externalizing the mapping from the ArquillianDescriptor container def to the DeployableContainer ContainerConfiguration instance #552

Closed
starksm64 opened this issue Jun 15, 2024 · 1 comment · Fixed by #553
Assignees

Comments

@starksm64
Copy link
Member

Issue Overview

I have created a prototype json based ArquillianDescriptor implementation using the shrinkwrap DescriptorImporter SPI, but there is a limitation on where it can be used because of this org.jboss.arquillian.container.impl.ContainerImpl method:

    @Override
    public ContainerConfiguration createDeployableConfiguration() throws Exception {
        ContainerConfiguration config = SecurityActions.newInstance(
            deployableContainer.getConfigurationClass(), new Class<?>[0], new Object[0]);
        MapObject.populate(config, containerConfiguration.getContainerProperties()); // This line needs to be externalized
        config.validate();
        return config;
    }

The containerConfiguration instance variable is a org.jboss.arquillian.config.descriptor.api.ContainerDef that results from the parse of the arquillian.xml descriptor by default. If one has overriden the parser to use a different format, the call to get the ContainerDef#getContainerProperties() becomes limiting on the types one can pass from the parsed ArquillianDescriptor to the org.jboss.arquillian.container.spi.client.container.ContainerConfiguration implementation a container provides.

Expected Behaviour

One should be able to provide a mapper from the ContainerDef and the ContainerConfiguration to allow for richer types in configurations.

There needs to be an interface that is provided by the org.jboss.arquillian.container.spi.client.container.DeployableContainer

public interface DeployableContainer<T extends ContainerConfiguration> {
    // ControllableContainer
    Class<T> getConfigurationClass();

    default ConfigurationMapper<T> getConfigurationMapper() {
       // Return the old behavior ...
    }

where ConfigurationMapper is a new interface:

package org.jboss.arquillian.container.spi.client.container;

public interface ConfigurationMapper<T extends ContainerConfiguration> {
    void populate(T config, ContainerDef containerDef);
}
Current Behaviour

Only scalar types and strings are supported

@starksm64 starksm64 self-assigned this Jun 15, 2024
@starksm64
Copy link
Member Author

This would be useful even with the current aquillian.xml parser because you can override how the string to object mapping is performed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant