5 Replies Latest reply on Jan 5, 2015 4:45 AM by Karel Piwko

    How to parameterize deployment target during runtime?

    Denys S. Newbie

      Hi. I've got a remote jboss eap 6.3 via which I want to perform integration tests. At the moment to run them on a specific server group I have to specify it via an annotation:

       

      @TargetsContainer("grp-itests")
      
      
      
      
      
      

       

      where a jboss server group is apparently discovered during runtime. However, for my specific needs a developer should be able to change the target container via maven profiles (target server). Now, I can set up

       

      arquillian.launch
      
      
      
      
      
      

       

      parameter or rename container in the arquillian.xml but neither works even if I specify a server group as following:

       

      <?xml version="1.0" encoding="UTF-8"?>
      <arquillian xmlns="http://jboss.org/schema/arquillian"
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                  xsi:schemaLocation="http://jboss.org/schema/arquillian
              http://jboss.org/schema/arquillian/arquillian_1_0.xsd">
        <container qualifier="server-group-here" default="true">
          <configuration>
            <property name="username">${jboss-eap.username}</property>
            <property name="password">${jboss-eap.password}</property>
            <property name="managementAddress">${jboss-eap.hostname}</property>
            <property name="managementPort">${jboss-eap.port}</property>
          </configuration>
        </container>
      </arquillian>
      
      
      
      
      

       

      at which point arquillian always prints out an error that deployment from domain controller is not possible. Now, if I hard code @TargetsContainer as in the former example, tests are executed properly.

       

      From that and from what is written here I assume that server groups (thus target containers) are discovered during runtime and whatever I write in container qualifier in arquillian.xml will be treated as domain controller qualifier and will always overwrite any server group qualifier. I've tried to simply add 2 deployment methods with different targeted containers, but apparently it didn't work.

       

          @Deployment(name="grp-test1")
          @TargetsContainer("grp-test1")
          protected static Archive<?> createLocalDeployment() {
              return createEarDeployment();
          }
      
          @Deployment(name="grp-itest1")
          @TargetsContainer("grp-itest1")
          protected static Archive<?> createRemoteDeployment() {
              return createEarDeployment();
          }
      
          protected static Archive<?> createEarDeployment() {
      //actual deployment here
              }
      
      
      
      
      

       

      with an exception

      org.jboss.arquillian.container.test.impl.client.deployment.ValidationException: DeploymentScenario contains a target (grp-test1) not matching any defined Container in the registry.
      Possible causes are: None of the 11 Containers are marked as default or you have defined a @Deployment with a @TargetsContainer of value (grp-test1) that does not match any found/configured Containers (all of em listed here), see arquillian.xml container@qualifier
        at org.jboss.arquillian.container.test.impl.client.deployment.DeploymentGenerator.throwNoMatchFound(DeploymentGenerator.java:257)
        at org.jboss.arquillian.container.test.impl.client.deployment.DeploymentGenerator.throwTargetNotFoundValidationException(DeploymentGenerator.java:245)
        at org.jboss.arquillian.container.test.impl.client.deployment.DeploymentGenerator.validate(DeploymentGenerator.java:102)
        at org.jboss.arquillian.container.test.impl.client.deployment.DeploymentGenerator.generateDeployment(DeploymentGenerator.java:84)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      
      
      
      
      

       

       

      Thus, I'm wondering how to:

      a) Specify target container, which is discovered during runtime, via some sort of parameter.

      b) Assign a deployment method to a specific container right after discovering the containers as provided by Jboss EAP.

       

      P.S.: We are using 1.1.5.Final version and from what I see in DeploymentGenerator code the feature that I'm requesting is not yet there. Am I correct? Any workarounds?