OK, I got through it. Here is what is needed:
1. You must use jboss-as-arquillian-container-domain-remote instead of jboss-as-arquillian-container-remote. Best way to do this is to have two profiles: 1 for standalone and one for domain deployment
2. You need to add @TargetsContainer("your-server-group") after each @Deployment in your tests. The "your-server-group" name must match the server groups in your domain. If not, you can add a name map in the arquillian.xml -- I did not try this, but should be simple. That will avoid having to hardcode the server group names
3. You need to use two different arquillian.xml for standalone and domain. For standalone use "<container qualifier="your-server-group" default="true"/> You can also include port and IP information and protocol/servlet info there if needed. For domain use "<group qualifer="jbossas" default="true"><container qualifier="DomainController" /></group> - You should include configuration and protocol/servlet information if needed.
4. The namemap can go in as a property in the domain controller container.Namemap is a comma delimited string or name=value pairs. Not sure which is the name and which is the value.
thanks for figuring that out yourself! There is one thing that might help you, you can have single arquillian.xml file with 2 <group>s and in your profiles simply set arquillian.launch property. Otherwise you hit the nail. Example is here:
Some more observations:
The property is "'containerNameMap" and the name is the name of the server group in the domain and the value is the string in the TargetsContainer() annotation in the code.
You cannot have a server group with the name matching the targetsContainer in the domain. If you do, it will be used instead of the mapped name.
Maybe we could consider this a bug. If I use a mapping, I want to to be used, not ignored. There is a reason why I wanted to deploy to a different servergroup.