Package com.google.jstestdriver

Examples of com.google.jstestdriver.JsonCommand


    BrowserQueryResponseHandler handler =
        new BrowserQueryResponseHandler(null, null, capturedBrowsers, streamedResponses);

    handler.service("1", "response", "true", null, writer);
    assertEquals(new Gson().toJson(
        new JsonCommand(JsonCommand.CommandType.STOP, Lists.newArrayList("Stopping due to missing browser."))), out.toString());
  }
View Full Code Here


    Response response = new Response();
    response.setType(ResponseType.RESET_RESULT.name());
    response.setResponse(new Gson().toJson(new LoadedFiles()));
    response.setBrowser(new BrowserInfo());

    JsonCommand resetCommand = new JsonCommand(CommandType.RESET, Collections.<String>emptyList());
    slave.createCommand(gson.toJson(resetCommand));
    slave.dequeueCommand();

    handler.service(id, gson.toJson(response), "", null, writer);
View Full Code Here

    if (browser != null) {
      boolean isLast = Boolean.parseBoolean(done);
      try {
        serviceBrowser(response, isLast, responseId, writer, browser);
      } catch (JsonParseException e) {
        writer.print(gson.toJson(new JsonCommand(JsonCommand.CommandType.STOP, null)));
        writer.flush();
        throw new RuntimeException("Unable to parse: " + response, e);
      }
    } else {
      // TODO(corysmith): handle this better.
      logger.error("Unknown browser {} with response {}.\n Known {}", new Object[]{id, response, browsers.getSlaveBrowsers()});
      writer.print(gson.toJson(new JsonCommand(JsonCommand.CommandType.STOP, Lists.newArrayList("Stopping due to missing browser."))));
      try {
        Thread.sleep(1000); // pause to make sure the browser doesn't spin.
      } catch (InterruptedException e) {
       
      }
View Full Code Here

    browser.createCommand(data);
  }

  // TODO(corysmith): figure out what this does.
  private String translateUrls(String data) {
    JsonCommand command = gson.fromJson(data, JsonCommand.class);

    if (command.getCommand().equals(
        JsonCommand.CommandType.LOADTEST.getCommand())) {
      List<String> parameters = command.getParameters();
      String fileSourcesList = parameters.get(0);
      List<FileSource> fileSources = gson.fromJson(fileSourcesList,
          new TypeToken<List<FileSource>>() {
          }.getType());
      parameters.remove(0);
View Full Code Here

    }
  }

  public void service(final SlaveBrowser slaveBrowser) {
    logger.debug("Adding noop command.");
    slaveBrowser.createCommand(gson.toJson(new JsonCommand(CommandType.NOOP, null)));
    LinkedList<String> runAllTestsParameters = new LinkedList<String>();

    runAllTestsParameters.add("false");
    runAllTestsParameters.add("false");
    runAllTestsParameters.add("0");
    logger.debug("adding run all tests command.");
    slaveBrowser.createCommand(gson.toJson(new JsonCommand(CommandType.RUNALLTESTS,
        runAllTestsParameters)));
    // stop the executor until the next refresh.
    slaveBrowser.createCommand(gson.toJson(new JsonCommand(CommandType.STOP, null)));
   
  }
View Full Code Here

    LinkedList<String> runAllTestsParameters = new LinkedList<String>();

    runAllTestsParameters.add("false");
    runAllTestsParameters.add("false");
    runAllTestsParameters.add("0");
    slaveBrowser.createCommand(gson.toJson(new JsonCommand(CommandType.RUNALLTESTS,
        runAllTestsParameters)));

    if (LOGGER.isDebugEnabled() && !reportingThreads.containsKey(slaveBrowser)) {
      final Thread thread = new Thread(new Runnable() {
        @Override
View Full Code Here

*
*/
public class NoopCommand extends Command {

  public NoopCommand() {
    super(new Gson().toJson(new JsonCommand(JsonCommand.CommandType.NOOP, null)));
  }
View Full Code Here

TOP

Related Classes of com.google.jstestdriver.JsonCommand

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.