1 Reply Latest reply on Aug 5, 2015 8:15 AM by Ondra Chaloupka

    Get container common configuration in arquillian test

    Vitalii Chepeliuk Newbie

      Hey guys! I have problem when running server task in manual mode when tearDown() method is invoked e.g.

          @Override

          public void tearDown(ManagementClient managementClient, String containerId) throws Exception {

              if (categories == null || categories.isEmpty()) {

                  return;

              }

       

              final List<ModelNode> updates = new ArrayList<ModelNode>();

       

              for (String category : categories) {

                  if (category == null || category.length() == 0) {

                      continue;

                  }

                  updates.add(Util.createRemoveOperation(PATH_LOGGING.append("logger", category)));

              }

              ModelNode op = Util.createEmptyOperation("write-attribute", PATH_LOGGING.append("console-handler", "CONSOLE"));

              op.get("name").set("level");

              op.get("value").set("INFO");

              CoreUtils.applyUpdates(updates, managementClient.getControllerClient()); // Applying changes fails here

          }

      When I try to run CoreUtils.applyUpdates(updates, managementClient.getControllerClient()); I get AssetionError

      java.lang.AssertionError: null

      at org.jboss.as.protocol.mgmt.ActiveOperationSupport.registerActiveOperation(ActiveOperationSupport.java:151)

      at org.jboss.as.protocol.mgmt.ActiveOperationSupport.registerActiveOperation(ActiveOperationSupport.java:121)

      at org.jboss.as.protocol.mgmt.ManagementChannelHandler.executeRequest(ManagementChannelHandler.java:121)

      at org.jboss.as.controller.client.impl.AbstractModelControllerClient.executeRequest(AbstractModelControllerClient.java:263)

      at org.jboss.as.controller.client.impl.AbstractModelControllerClient.execute(AbstractModelControllerClient.java:168)

      at org.jboss.as.controller.client.impl.AbstractModelControllerClient.executeForResult(AbstractModelControllerClient.java:147)

      at org.jboss.as.controller.client.impl.AbstractModelControllerClient.execute(AbstractModelControllerClient.java:80)

      at org.jboss.as.test.integration.security.common.CoreUtils.applyUpdate(CoreUtils.java:177)

      at org.jboss.as.test.integration.security.common.CoreUtils.applyUpdates(CoreUtils.java:172)

      at org.infinispan.test.integration.security.tasks.AbstractTraceLoggingServer

       

      So tasks are run when the test class is ending and all the deployments are removed but it throws above Error. That should be a bug in arquillian which rejects client connection when all deployments were removed. I found workaround where I run server setup tasks in @BeforeClass and @AfterClass methods. But I need to create managementClient manually and pass it to setup() and tearDown() methods.

      ManagementClient has constructor which takes hostname and port. So my question is if there is possible to get CommonContainerDonfiguration from arquillian resources? I can use observer and catch all events and get configuration from any matched event but I'd like not so overcomplicate code and just inject some resources, then get all containers from it and get container I need by its Id and get Its common configuratin and pass to ManagementClient() constructor.

       

      Thanks Vitalii