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

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


     
      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

      {
         return null;
      }
      if(metaData.hasContext(HTTPContext.class))
      {
         HTTPContext context = metaData.getContext(HTTPContext.class);
         if(resource.value() != null && resource.value() != ArquillianResource.class)
         {
            // TODO: we need to check for class. Not all containers have ServletClass available.
            Servlet servlet = context.getServletByName(resource.value().getSimpleName());
            if( servlet == null)
            {
               servlet = context.getServletByName(resource.value().getName());
               //throw new RuntimeException("No Servlet named " + resource.value().getSimpleName() + " found in metadata");
            }
            if(servlet == null)
            {
               return null;
            }
            return toURL(servlet);
         }
         // TODO: evaluate, if all servlets are in the same context, and only one context exists, we can find the context        
         else if(allInSameContext(context.getServlets()))
         {
            return toURL(context.getServlets().get(0));
         }
         else
         {
            return toURL(context);
         }
View Full Code Here

    }

    public HTTPContext getHTTPDeploymentMetaData(Server server, String uniqueDeploymentName) {

        URI webURI = getProtocolURI(server, PROTOCOL_HTTP);
        HTTPContext context = new HTTPContext(webURI.getHost(), webURI.getPort());
        try {
            ModelNode deploymentNode = readResource(createHostServerDeploymentAddress(
                    server.getHost(), server.getName(), uniqueDeploymentName), false); // don't include runtime information, workaround for bug in web statistics

            if (isWebArchive(uniqueDeploymentName)) {
View Full Code Here

    public ProtocolMetaData getDeploymentMetaData(String deploymentName) {
        URI webURI = getSubSystemURI(WEB);

        ProtocolMetaData metaData = new ProtocolMetaData();
        metaData.addContext(new JMXContext(getConnection()));
        HTTPContext context = new HTTPContext(webURI.getHost(), webURI.getPort());
        metaData.addContext(context);
        try {
            ModelNode deploymentNode = readResource(createDeploymentAddress(deploymentName));

            if (isWebArchive(deploymentName)) {
View Full Code Here

         standardHost.addChild(standardContext);

         standardContextProducer.set(standardContext);

         String contextPath = standardContext.getPath();
         HTTPContext httpContext = new HTTPContext(bindAddress, bindPort);

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

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

         throw new DeploymentException("Could not deploy " + archive.getName(), e);
      }
     
      try
      {
         HTTPContext httpContext = new HTTPContext(
               ADDRESS,
               configuration.getBindHttpPort());
        
         findServlets(httpContext, resolveWebArchiveNames(archive));
        
View Full Code Here

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

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

            // Avoids "inconvertible types" error in windows build
            if (archiveName.endsWith(".war")) {
                httpContext.add(new Servlet("ArquillianServletRunner", "/" + getArchiveNameWithoutExtension(archive)));
            } else if (archiveName.endsWith(".ear") && appInfo.webApps.size() > 0) {
                final String contextRoot = System.getProperty("tomee.arquillian.ear.context", configuration.getWebContextToUseWithEars());
                if (contextRoot != null) {
                    httpContext.add(new Servlet("ArquillianServletRunner", ("/" + contextRoot).replace("//", "/")));
                } else {
                    for (final WebAppInfo web : appInfo.webApps) { // normally a single webapp is supported cause of arquillian resolution
                        httpContext.add(new Servlet("ArquillianServletRunner", ("/" + web.contextRoot).replace("//", "/")));
                    }
                }
            } else {
                httpContext.add(new Servlet("ArquillianServletRunner", "/arquillian-protocol")); // needs another jar to add the fake webapp
            }
            addServlets(httpContext, appInfo);

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

        }
        return null;
    }

    private static ProtocolMetaData newHttpProtocolMetaData(final ServerService ss, final String contextRoot) {
        final HTTPContext httpContext = new HTTPContext(ss.getIP(), ss.getPort());
        httpContext.add(new Servlet("ArquillianServletRunner", contextRoot));
        return new ProtocolMetaData().addContext(httpContext);
    }
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 existing = null;
            try {
                existing = existingContext.get();
            } catch (final Throwable t) {
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.