WildFly Arquillian for Domains

discussion
api

#1

Hello All,
I’m working on updating WildFly Arquillian for domains. The first question I have is are people currently using wildfly-arquillian-container-domain-*? If so do you have some examples of how you’re using it?

There are some things I’d like to change on how the container currently works. Currently a new container is created and assigned for each server group and each server in a domain. I think the container name format is a bit odd and it doesn’t allow for multiple container configurations to be used. Instead of using @TargetsContainer("server-group-name") I’d like to introduce a new annotation @TargetsServerGroup("server-group-name"). There would also be a @TargetsServerGroups as well as the @TargetsServerGroup to be repeatable so a deployment can be deployed to multiple server groups.

We would probably have to have a @TargetsServer(host="host-name", server="server-name") annotation as well for in container test methods. I haven’t thought this part through completely yet. Essentially we just need to be more explicit rather than use a random syntax.

As part of that above change I’d like to remove, possibly keeping it around for legacy usages, the extra containers that are created and introduce a new API to optionally control the lifecycle of a host, a server or a server group. The main reason for removal is you can start or stop any server-group or server with the ContainerController API regardless if it’s a mode=manual container or not.

I’ve got two ideas on the API and I’m not certain which would be preferred.

Option 1: DomainController

public interface DomainController {

    Set<Host> getHosts();

    Host getHost(String name);

    Set<ServerGroup> getServerGroups();

    ServerGroup getServerGroup(String name);
}

This would be injectable via the @ArquillianResource and optionally use the @TargetsContainer qualifier to specify which container the injected object should be querying/controlling. From an implementation perspective this is probably the easiest with the exception of knowing you’re executing the correct DomainController on the correct container.

Option 2: DomainContainerController

public interface DomainContainerController extends ContainerController {

    Set<Host> getHosts(String containerQualifier);

    Host getHost(String containerQualifier, String name);

    Set<ServerGroup> getServerGroups(String containerQualifier);
    
    ServerGroup getServerGroup(String containerQualifier, String name);
}

This is essentially the same concept only it’s an extension of the ContainerController. The one benefit of this approach is it’s easier to determine if the container is running and throw an exception if you try to execute any of the methods on a server that has not been started.

From a user perspective I like option 1 unless you’re using multiple containers. In that case option 2 might be more desirable. I’m not a daily user of Arquillian and I’ve not used it much at all for a domain container. Any opinions on these approaches or a different approach are welcome.

Thanks in advance.