Exemplo n.º 1
0
 /**
  * Create a new model controller client. The client can (and should) be closed without affecting
  * other usages.
  *
  * @return the domain client
  */
 public DomainClient createDomainClient() {
   final DomainTestConnection connection = this.connection;
   if (connection == null) {
     throw new IllegalStateException();
   }
   return DomainClient.Factory.create(connection.createClient());
 }
 @Override
 public void start() {
   if (STARTED.compareAndSet(false, true)) {
     try {
       final DomainCommandBuilder commandBuilder =
           DomainCommandBuilder.of(Environment.WILDFLY_HOME)
               .setBindAddressHint("management", Environment.HOSTNAME)
               .addHostControllerJavaOption("-Djboss.management.http.port=" + Environment.PORT);
       final Process process = Launcher.of(commandBuilder).setRedirectErrorStream(true).launch();
       startConsoleConsumer(process);
       shutdownThread = ProcessHelper.addShutdownHook(process);
       client =
           DomainClient.Factory.create(
               ModelControllerClient.Factory.create(Environment.HOSTNAME, Environment.PORT));
       currentProcess = process;
       final Map<ServerIdentity, ServerStatus> servers = new HashMap<>();
       ServerHelper.waitForDomain(process, client, servers, Environment.TIMEOUT);
       this.servers.putAll(servers);
     } catch (Throwable t) {
       try {
         throw new RuntimeException("Failed to start server", t);
       } finally {
         STARTED.set(false);
         cleanUp();
       }
     }
   }
 }
Exemplo n.º 3
0
 /**
  * Get a shared domain client.
  *
  * @return the domain client
  */
 public synchronized DomainClient getDomainClient() {
   return DomainClient.Factory.create(internalGetOrCreateClient());
 }