Examples of JsonCommand


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

Examples of com.google.jstestdriver.JsonCommand

    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

Examples of com.google.jstestdriver.JsonCommand

    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

Examples of com.google.jstestdriver.JsonCommand

    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

Examples of com.google.jstestdriver.JsonCommand

    }
  }

  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

Examples of com.google.jstestdriver.JsonCommand

    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

Examples of com.google.jstestdriver.JsonCommand

*
*/
public class NoopCommand extends Command {

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

Examples of org.mifosplatform.infrastructure.core.api.JsonCommand

        final String json = wrapper.getJson();
        CommandProcessingResult result = null;
        try {
            final JsonElement parsedCommand = this.fromApiJsonHelper.parse(json);
            final JsonCommand command = JsonCommand.from(json, parsedCommand, this.fromApiJsonHelper, wrapper.getEntityName(),
                    wrapper.getEntityId(), wrapper.getSubentityId(), wrapper.getGroupId(), wrapper.getClientId(), wrapper.getLoanId(),
                    wrapper.getSavingsId(), wrapper.getTransactionId(), wrapper.getHref(), wrapper.getProductId());

            result = this.processAndLogCommandService.processAndLogCommand(wrapper, command, isApprovedByChecker);
        } catch (final RollbackTransactionAsCommandIsNotApprovedByCheckerException e) {
View Full Code Here

Examples of org.mifosplatform.infrastructure.core.api.JsonCommand

                commandSourceInput.getEntityName(), commandSourceInput.resourceId(), commandSourceInput.subresourceId(),
                commandSourceInput.getResourceGetUrl(), commandSourceInput.getProductId(), commandSourceInput.getOfficeId(),
                commandSourceInput.getGroupId(), commandSourceInput.getClientId(), commandSourceInput.getLoanId(),
                commandSourceInput.getSavingsId(), commandSourceInput.getTransactionId());
        final JsonElement parsedCommand = this.fromApiJsonHelper.parse(commandSourceInput.json());
        final JsonCommand command = JsonCommand.fromExistingCommand(makerCheckerId, commandSourceInput.json(), parsedCommand,
                this.fromApiJsonHelper, commandSourceInput.getEntityName(), commandSourceInput.resourceId(),
                commandSourceInput.subresourceId(), commandSourceInput.getGroupId(), commandSourceInput.getClientId(),
                commandSourceInput.getLoanId(), commandSourceInput.getSavingsId(), commandSourceInput.getTransactionId(),
                commandSourceInput.getResourceGetUrl(), commandSourceInput.getProductId());
View Full Code Here

Examples of org.mifosplatform.infrastructure.core.api.JsonCommand

        if (command.hasParameter(InterestRateChartSlabApiConstants.incentivesParamName)) {
            final JsonArray array = command.arrayOfParameterNamed(InterestRateChartSlabApiConstants.incentivesParamName);
            if (array != null) {
                for (int i = 0; i < array.size(); i++) {
                    final JsonObject incentiveElement = array.get(i).getAsJsonObject();
                    JsonCommand incentivesCommand = JsonCommand.fromExistingCommand(command, incentiveElement);
                    if (incentivesCommand.parameterExists(InterestIncentiveApiConstants.idParamName)) {
                        final Long interestIncentiveId = incentivesCommand
                                .longValueOfParameterNamed(InterestIncentiveApiConstants.idParamName);
                        final InterestIncentives interestIncentives = chartSlab.findInterestIncentive(interestIncentiveId);
                        if (interestIncentives == null) {
                            baseDataValidator.parameter(InterestIncentiveApiConstants.idParamName).value(interestIncentiveId)
                                    .failWithCode("no.interest.incentive.associated.with.id");
                        } else if (incentivesCommand.parameterExists(deleteParamName)) {
                            if (chartSlab.removeInterestIncentive(interestIncentives)) {
                                deleteIncentives.put(idParamName, interestIncentiveId);
                            }
                        } else {
                            interestIncentives.update(incentivesCommand, IncentiveChanges, baseDataValidator, locale);
                        }
                    } else {
                        Integer entityType = incentivesCommand.integerValueOfParameterNamed(entityTypeParamName, locale);
                        Integer conditionType = incentivesCommand.integerValueOfParameterNamed(conditionTypeParamName, locale);
                        Integer attributeName = incentivesCommand.integerValueOfParameterNamed(attributeNameParamName, locale);
                        String attributeValue = incentivesCommand.stringValueOfParameterNamed(attributeValueParamName);
                        Integer incentiveType = incentivesCommand.integerValueOfParameterNamed(incentiveTypeparamName, locale);
                        BigDecimal amount = incentivesCommand.bigDecimalValueOfParameterNamed(amountParamName, locale);
                        InterestIncentivesFields incentivesFields = InterestIncentivesFields.createNew(entityType, attributeName,
                                conditionType, attributeValue, incentiveType, amount, baseDataValidator);
                        InterestIncentives incentives = new InterestIncentives(chartSlab, incentivesFields);
                        chartSlab.addInterestIncentive(incentives);
                    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.