コード例 #1
0
  protected static void waitForHornetQServerActivation(
      JMSOperations operations, boolean expectedActive) throws IOException {
    long start = System.currentTimeMillis();
    long now;
    do {
      ModelNode operation = new ModelNode();
      operation.get(OP_ADDR).set(operations.getServerAddress());
      operation.get(OP).set(READ_RESOURCE_OPERATION);
      operation.get(INCLUDE_RUNTIME).set(true);
      operation.get(RECURSIVE).set(true);
      try {
        ModelNode result = execute(operations.getControllerClient(), operation);
        boolean started = result.get("started").asBoolean();
        boolean active = result.get("active").asBoolean();
        if (started && expectedActive == active) {
          // leave some time to the hornetq children resources to be installed after the server is
          // activated
          Thread.sleep(TimeoutUtil.adjust(500));

          return;
        }
      } catch (Exception e) {
      }
      try {
        Thread.sleep(100);
      } catch (InterruptedException e) {
      }
      now = System.currentTimeMillis();
    } while (now - start < ACTIVATION_TIMEOUT);

    fail("Server did not become active in the imparted time.");
  }
コード例 #2
0
 protected static void checkHornetQServerStartedAndActiveAttributes(
     JMSOperations operations, boolean expectedStarted, boolean expectedActive) throws Exception {
   ModelNode operation = new ModelNode();
   ModelNode address = operations.getServerAddress();
   operation.get(OP_ADDR).set(address);
   operation.get(OP).set(READ_RESOURCE_OPERATION);
   operation.get(INCLUDE_RUNTIME).set(true);
   ModelNode result = execute(operations.getControllerClient(), operation);
   assertEquals(expectedStarted, result.get("started").asBoolean());
   assertEquals(expectedActive, result.get("active").asBoolean());
 }
コード例 #3
0
 protected static void checkJMSQueue(JMSOperations operations, String jmsQueueName, boolean active)
     throws Exception {
   ModelNode address = operations.getServerAddress().add("jms-queue", jmsQueueName);
   checkQueue0(operations.getControllerClient(), address, "queue-address", active);
 }