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

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


        return xpath.evaluate("/map/entry[@key = 'message']/@value", new InputSource(new StringReader(xmlResponse)));
    }

    private ProtocolMetaData parseForProtocolMetaData(String xmlResponse) throws XPathExpressionException {
        final ProtocolMetaData protocolMetaData = new ProtocolMetaData();
        final HTTPContext httpContext = new HTTPContext(this.configuration.getRemoteServerAddress(),
                this.configuration.getRemoteServerHttpPort());

        final XPath xpath = XPathFactory.newInstance().newXPath();

        NodeList servlets = (NodeList) xpath.evaluate("/map/entry[@key = 'properties']/map/entry[@value = 'Servlet']",
                new InputSource(new StringReader(xmlResponse)), XPathConstants.NODESET);

        for (int i = 0; i < servlets.getLength(); i++) {
            httpContext.add(new Servlet(servlets.item(i).getAttributes().getNamedItem("key").getNodeValue(), this.deploymentName));
        }

        protocolMetaData.addContext(httpContext);
        return protocolMetaData;
    }
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

         ((HandlerCollection) server.getHandler()).addHandler(wctx);
         wctx.start();
         webAppContextProducer.set(wctx);
        
         HTTPContext httpContext = new HTTPContext(containerConfig.getBindAddress(), containerConfig.getBindHttpPort());
         for(ServletHolder servlet : wctx.getServletHandler().getServlets())
         {
            httpContext.add(new Servlet(servlet.getName(), servlet.getContextPath()));
         }
        
         return new ProtocolMetaData()
            .addContext(httpContext);
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);
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

         ((HandlerCollection) server.getHandler()).addHandler(wctx);
         wctx.start();
         webAppContextProducer.set(wctx);
        
         HTTPContext httpContext = new HTTPContext(containerConfig.getBindAddress(), containerConfig.getBindHttpPort());
         for(ServletHolder servlet : wctx.getServletHandler().getServlets())
         {
            httpContext.add(new Servlet(servlet.getName(), servlet.getContextPath()));
         }
        
         return new ProtocolMetaData()
            .addContext(httpContext);
View Full Code Here

   }

   @Test
   public void shouldBeAbleToInjectBaseContext() throws Exception
   {
      bind(ApplicationScoped.class, ProtocolMetaData.class, new ProtocolMetaData().addContext(new HTTPContext("TEST", 8080)));
      TestEnricher enricher = new ArquillianResourceTestEnricher();
      injector.get().inject(enricher);

      URLBaseContextClass test = new URLBaseContextClass();
      enricher.enrich(test);
View Full Code Here

  
   @Test
   public void shouldBeAbleToInjectServlet() throws Exception
   {
      bind(ApplicationScoped.class, ProtocolMetaData.class,
            new ProtocolMetaData().addContext(new HTTPContext("TEST", 8080)
            .add(new Servlet(URLServletContextClass.class.getSimpleName(), "/test"))));
     
      TestEnricher enricher = new ArquillianResourceTestEnricher();
      injector.get().inject(enricher);
View Full Code Here

TOP

Related Classes of org.jboss.arquillian.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.