Ejemplo n.º 1
0
 public String createCaptureUrl(RunnerType type) {
   return prefix.prefixPath(
       String.format(
           "/capture/%s/%s/%s/%s/%s/%s",
           CaptureHandler.RUNNER_TYPE,
           type,
           MODE,
           parameters.get(MODE),
           UPLOAD_SIZE,
           parameters.get(UPLOAD_SIZE)));
 }
Ejemplo n.º 2
0
 public String createPageUrl(PageType page) {
   String url =
       prefix.prefixPath(
           String.format(
               "/%s/%s/%s/%s/%s/%s/%s/%s/%s/%s/%s",
               "slave",
               ID,
               parameters.get(ID),
               CaptureHandler.RUNNER_TYPE,
               parameters.get(CaptureHandler.RUNNER_TYPE),
               MODE,
               parameters.get(MODE),
               PAGE,
               page,
               UPLOAD_SIZE,
               parameters.get(UPLOAD_SIZE)));
   logger.trace("creating new url: {} for {}", url, page);
   return url;
 }
Ejemplo n.º 3
0
  @Override
  protected void configureHandlers() {
    // Handler bindings in alphabetical order
    serve(GET, handlerPrefix.prefixPath("/"), HomeHandler.class);
    serve(POST, handlerPrefix.prefixPath("/cache"), FileCacheHandler.class);
    serve(GET, handlerPrefix.prefixPath("/capture"), CaptureHandler.class);
    serve(GET, handlerPrefix.prefixPath("/capture/*"), CaptureHandler.class);
    serve(GET, handlerPrefix.prefixPath("/cmd"), CommandGetHandler.class);
    serve(POST, handlerPrefix.prefixPath("/cmd"), CommandPostHandler.class);
    serve(GET, handlerPrefix.prefixPath("/favicon.ico"), FaviconHandler.class);
    serve(GET, handlerPrefix.prefixPath("/fileSet"), FileSetGetHandler.class);
    serve(POST, handlerPrefix.prefixPath("/fileSet"), FileSetPostHandler.class);

    for (HttpMethod method : HttpMethod.values()) {
      serve(method, handlerPrefix.prefixPath("/forward/*"), ForwardingHandler.class);
    }

    serve(GET, handlerPrefix.prefixPath("/heartbeat"), HeartbeatGetHandler.class);
    serve(POST, handlerPrefix.prefixPath("/heartbeat"), HeartbeatPostHandler.class);
    serve(GET, handlerPrefix.prefixPath("/proxy", JSTD), GatewayConfigurationHandler.class);
    serve(POST, handlerPrefix.prefixPath("/proxy", JSTD), GatewayConfigurationHandler.class);
    serve(GET, handlerPrefix.prefixPath("/gateway", JSTD), GatewayConfigurationHandler.class);
    serve(POST, handlerPrefix.prefixPath("/gateway", JSTD), GatewayConfigurationHandler.class);

    serve(GET, handlerPrefix.prefixPath("/hello"), HelloHandler.class);
    serve(POST, handlerPrefix.prefixPath("/log"), BrowserLoggingHandler.class);
    serve(POST, handlerPrefix.prefixPath("/query/*"), BrowserQueryResponseHandler.class);
    serve(GET, handlerPrefix.prefixPath("/runner/*"), StandaloneRunnerHandler.class);
    serve(GET, handlerPrefix.prefixPath("/slave/*"), SlaveResourceHandler.class);

    if (executionType == ExecutionType.STANDALONE) {
      serve(GET, handlerPrefix.prefixPath("/test/*"), CachingTestResourceHandler.class);
    } else {
      serve(GET, handlerPrefix.prefixPath("/test/*"), NonCachingTestResourceHandler.class);
    }

    serve(GET, handlerPrefix.prefixPath("/quit"), QuitHandler.class);
    serve(GET, handlerPrefix.prefixPath("/quit/*"), QuitHandler.class);
    serve(GET, handlerPrefix.prefixPath("/static/*"), StaticResourceHandler.class);
    serve(GET, handlerPrefix.prefixPath("/bcr"), BrowserControlledRunnerHandler.class);
    serve(GET, handlerPrefix.prefixPath("/bcr/*"), BrowserControlledRunnerHandler.class);

    // Constant bindings
    bindConstant()
        .annotatedWith(BaseResourceLocation.class)
        .to(SlaveResourceService.RESOURCE_LOCATION);
    bindConstant().annotatedWith(BrowserTimeout.class).to(browserTimeout);

    // Miscellaneous bindings
    bind(CapturedBrowsers.class).toInstance(capturedBrowsers);
    bind(JstdTestCaseStore.class).toInstance(testCaseStore);
    bind(new Key<ConcurrentMap<SlaveBrowser, List<String>>>() {})
        .toInstance(new ConcurrentHashMap<SlaveBrowser, List<String>>());
    bind(new Key<ConcurrentMap<SlaveBrowser, Thread>>() {})
        .toInstance(new ConcurrentHashMap<SlaveBrowser, Thread>());
    bind(new Key<Set<FileInfo>>() {}).toInstance(new HashSet<FileInfo>());
    bind(StandaloneRunnerFilesFilter.class).to(StandaloneRunnerFilesFilterImpl.class);
    bind(HandlerPathPrefix.class).toInstance(handlerPrefix);
    bind(Time.class).to(TimeImpl.class);
    bind(Boolean.class).annotatedWith(Names.named("debug")).toInstance(debug);
    bind(new TypeLiteral<Set<FileInfoScheme>>() {}).toInstance(schemes);

    bind(ExecutionType.class).toInstance(executionType);

    MapBinder<PageType, Page> pageBinder = newMapBinder(binder(), PageType.class, Page.class);
    pageBinder.addBinding(CONSOLE).to(ConsolePage.class).in(RequestScoped.class);
    pageBinder.addBinding(HEARTBEAT).to(HeartbeatPage.class).in(RequestScoped.class);
    pageBinder.addBinding(RUNNER).to(RunnerPage.class).in(RequestScoped.class);
    pageBinder.addBinding(STANDALONE_RUNNER).to(StandaloneRunnerPage.class).in(RequestScoped.class);
    pageBinder
        .addBinding(VISUAL_STANDALONE_RUNNER)
        .to(BrowserControlledRunnerPage.class)
        .in(RequestScoped.class);
  }