/**
   * Gets the meta-data.
   *
   * @return the meta-data
   * @throws IllegalStateException if this has been {@linkplain #close() closed}
   */
  public ProtocolMetaData getProtocolMetaData(String deploymentName) {
    init();
    ProtocolMetaData metaData = new ProtocolMetaData();
    metaData.addContext(new JMXContext(getConnection()));
    if (undertowSubsystemPresent) {
      URI webURI = getWebUri();
      HTTPContext context = new HTTPContext(webURI.getHost(), webURI.getPort());
      metaData.addContext(context);

      try {
        ModelNode address = new ModelNode();
        address.add(DEPLOYMENT, deploymentName);
        ModelNode deploymentNode = readResource(address);

        if (isWebArchive(deploymentName)) {
          extractWebArchiveContexts(context, deploymentNode);
        } else if (isEnterpriseArchive(deploymentName)) {
          extractEnterpriseArchiveContexts(context, deploymentNode);
        }

      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return metaData;
  }
예제 #2
0
 /**
  * {@inheritDoc}
  *
  * @see
  *     org.jboss.arquillian.container.test.spi.client.protocol.Protocol#getExecutor(org.jboss.arquillian.container.test.spi.client.protocol.ProtocolConfiguration,
  *     org.jboss.arquillian.container.spi.client.protocol.metadata.ProtocolMetaData,
  *     org.jboss.arquillian.container.test.spi.command.CommandCallback)
  */
 @Override
 public ContainerMethodExecutor getExecutor(
     final DaemonProtocolConfiguration protocolConfiguration,
     final ProtocolMetaData metaData,
     final CommandCallback callback) {
   final Collection<DeploymentContext> contexts = metaData.getContexts(DeploymentContext.class);
   assert contexts.size() == 1 : "Should be exactly one deployment context";
   final DeploymentContext context = contexts.iterator().next();
   return new DaemonMethodExecutor(context);
 }
 /* (non-Javadoc)
  * @see org.jboss.arquillian.spi.client.protocol.Protocol#getExecutor(org.jboss.arquillian.spi.client.protocol.ProtocolConfiguration, org.jboss.arquillian.spi.client.protocol.metadata.ProtocolMetaData)
  */
 @Override
 public ServletMethodExecutor getExecutor(
     ServletProtocolConfiguration protocolConfiguration,
     ProtocolMetaData metaData,
     CommandCallback callback) {
   Collection<HTTPContext> contexts = metaData.getContexts(HTTPContext.class);
   if (contexts.size() == 0) {
     throw new IllegalArgumentException(
         "No "
             + HTTPContext.class.getName()
             + " found in "
             + ProtocolMetaData.class.getName()
             + ". "
             + "Servlet protocol can not be used");
   }
   return new ServletMethodExecutor(protocolConfiguration, contexts, callback);
 }