Package org.jboss.arquillian.container.spi.client.protocol.metadata

Examples of org.jboss.arquillian.container.spi.client.protocol.metadata.HTTPContext


         final ContextName contextName = getContextName(archive);
         final StandardContext standardContext = (StandardContext) host.findChild(contextName.getName());
         standardContextProducer.set(standardContext);

         final HTTPContext httpContext = new HTTPContext(configuration.getBindAddress(),
               configuration.getBindHttpPort());

         for (String mapping : standardContext.findServletMappings())
         {
            httpContext.add(new Servlet(standardContext.findServletMapping(mapping), contextName.getPath()));
         }

         return new ProtocolMetaData().addContext(httpContext);
      }
      catch (Exception e)
View Full Code Here


    * @throws DeploymentException
    */
   public ProtocolMetaData retrieveContextServletInfo(String context) throws DeploymentException
   {
      ProtocolMetaData protocolMetaData = new ProtocolMetaData();
      HTTPContext httpContext = new HTTPContext(configuration.getBindAddress(), configuration.getBindHttpPort());

      JMXConnector jmxc = null;
      try
      {
         jmxc = connect(configuration.getJmxUri());
      }
      catch (IOException ex)
      {
         throw new DeploymentException(
                      "Unable to contruct metadata for archive deployment.\n" +
                            "Can't connect to '" + configuration.getJmxUri() + "'."
                            + "\n   Make sure JMX remote acces is enabled Tomcat's JVM - e.g. in startup.sh using $JAVA_OPTS."
                            + "\n   Example (with no authentication):" + "\n     -Dcom.sun.management.jmxremote.port="
                            + configuration.getJmxPort() + "\n     -Dcom.sun.management.jmxremote.ssl=false"
                            + "\n     -Dcom.sun.management.jmxremote.authenticate=false", ex);
      }

      Set<ObjectInstance> servletMBeans;
      try
      {
         servletMBeans = getServletMBeans(jmxc, context);
      }
      catch (IOException e)
      {
         throw new DeploymentException("Unable to construct metadata for archive deployment", e);
      }

      // For each servlet MBean of the given context add the servlet info to the HTTPContext.
      for (ObjectInstance oi : servletMBeans)
      {
         String servletName = oi.getObjectName().getKeyProperty("name");
         httpContext.add(new Servlet(servletName, context));
         if (log.isLoggable(Level.FINE))
         {
            log.fine("Added servlet " + oi.toString() + " to HttpContext for archive" + context);
         }
      }
View Full Code Here

     
      ManagementView management = profile.getViewManager();
      management.load();

      // extract server info
      HTTPContext httpContext = extractHTTPContext(management);
      if(httpContext != null)
      {
         metaData.addContext(httpContext);
      }
     
View Full Code Here

      Set<String> contextRootDeployments = management.getMatchingDeploymentName("http\\-.*");
      if(contextRootDeployments.size() > 0)
      {
         String deploymentName = contextRootDeployments.iterator().next();
         String expression = ".*\\-.*?(\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3})-(.*)";
         return new HTTPContext(
               deploymentName.replaceAll(expression, "$1"),
               Integer.parseInt(deploymentName.replaceAll(expression, "$2")));
      }
      return null;
   }
View Full Code Here

    public void undeploy(Descriptor descriptor) throws DeploymentException {
    }

    protected static ProtocolMetaData getProtocolMetaData(String host, int port, Archive<?> archive) {
        HTTPContext httpContext = new HTTPContext(host, port);
        List<String> servlets = extractServlets(archive);
        for (String name : servlets) {
            httpContext.add(new Servlet(name, "")); // GAE apps have root context
        }
        return new ProtocolMetaData().addContext(httpContext);
    }
View Full Code Here

         try
         {
            ProtocolMetaData metadata = new ProtocolMetaData();
            HTTPContextBuilder builder = new HTTPContextBuilder(deploymentName);
            HTTPContext httpContext = builder.createContext();
            HTTPContext context = httpContext;
            metadata.addContext(context);
            return metadata;
         }
         catch (Exception ex)
         {
View Full Code Here

            // to allow different strategies for testing a clustered deployment.
            ObjectName wlServerRuntime = wlServerRuntimes[0];
            String httpUrlAsString = (String) connection.invoke(wlServerRuntime, "getURL",
                  new Object[] {"http"}, new String[] {"java.lang.String"});
            URL serverHttpUrl = new URL(httpUrlAsString);
            httpContext = new HTTPContext(serverHttpUrl.getHost(), serverHttpUrl.getPort());
            ObjectName[] servletRuntimes = findServletRuntimes(wlServerRuntime, deploymentName);
            for (ObjectName servletRuntime : servletRuntimes)
            {
               String servletName = (String) connection.getAttribute(servletRuntime, "ServletName");
               String servletContextRoot = (String) connection.getAttribute(servletRuntime, "ContextPath");
View Full Code Here

        }

        try {
            Thread.currentThread().getContextClassLoader().loadClass(REMOTE_INITIAL_CONTEXT_FACTORY);

            final HTTPContext httpContext = metaData.getContexts(HTTPContext.class).iterator().next();
            final Properties props = new Properties();
            props.setProperty(Context.INITIAL_CONTEXT_FACTORY, REMOTE_INITIAL_CONTEXT_FACTORY);
            props.setProperty(Context.PROVIDER_URL, "http://" + httpContext.getHost() + ":" + httpContext.getPort() + "/tomee/ejb");

            context.set((Context) Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), new Class<?>[]{ Context.class }, new MultipleContextHandler(new InitialContext(), new InitialContext(props))));
        } catch (ClassNotFoundException e) {
            // no-op
        } catch (NamingException e) {
View Full Code Here

            if (options.get("tomee.appinfo.output", false)) {
                Info.marshal(appInfo);
            }

            HTTPContext httpContext = new HTTPContext(configuration.getHost(), configuration.getHttpPort());

            String arquillianServlet;
            // Avoids "inconvertible types" error in windows build
            final Object object = archive;
            if (object instanceof WebArchive) {
                arquillianServlet = "/" + getArchiveNameWithoutExtension(archive);
            } else {
                arquillianServlet = "/arquillian-protocol";
            }
            httpContext.add(new Servlet("ArquillianServletRunner", arquillianServlet));
            addServlets(httpContext, appInfo);

            return new ProtocolMetaData().addContext(httpContext);
        } catch (Exception e) {
            e.printStackTrace();
View Full Code Here

     * @param deployment the archive
     * @return Metadata information
     */
    public ProtocolMetaData parse(Archive<?> deployment) {
        ProtocolMetaData protocol = new ProtocolMetaData();
        HTTPContext context = new HTTPContext(configuration.getHostName(), 80);
        protocol.addContext(context);

        if (ArchiveUtil.isWarArchive(deployment)) {
            extractWebArchiveContexts(context, (WebArchive) deployment);
        } else if (ArchiveUtil.isEarArchive(deployment)) {
View Full Code Here

TOP

Related Classes of org.jboss.arquillian.container.spi.client.protocol.metadata.HTTPContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.