Package com.mockey.model

Examples of com.mockey.model.Scenario


    List<Service> services = new ArrayList<Service>();
    Service service = new Service();
    service.setServiceName("testname");
    service.setDescription("test description");

    Scenario scenario = new Scenario();
    scenario.setScenarioName("a");
    scenario.setRequestMessage("request message a");
    scenario.setResponseMessage("response message a");
    service.saveOrUpdateScenario(scenario);
    scenario = new Scenario();
    scenario.setScenarioName("b");
    scenario.setRequestMessage("request message b");
    scenario.setResponseMessage("response message b");
    service.saveOrUpdateScenario(scenario);
    services.add(service);
    Service service2 = new Service();
    service2.setServiceName("testname2");
    service2.setDescription("test description2");

    Scenario scenario2 = new Scenario();
    scenario2.setScenarioName("a");
    scenario2.setRequestMessage("request message a");
    scenario2.setResponseMessage("response message a");
    service2.saveOrUpdateScenario(scenario);
    scenario2 = new Scenario();
    scenario2.setScenarioName("b");
    scenario2.setRequestMessage("request message b");
    scenario2.setResponseMessage("response message b");
    service2.saveOrUpdateScenario(scenario);
    services.add(service2);
    return services;
  }
View Full Code Here


      Iterator<Scenario> uploadedListIter = uploadedService.getScenarios().iterator();
      Iterator<Scenario> inMemListIter = inMemoryService.getScenarios().iterator();

      while (uploadedListIter.hasNext()) {
        Scenario uploadedScenario = (Scenario) uploadedListIter.next();
        boolean inMemScenarioExistTemp = false;
        Scenario inMemScenarioTemp = null;

        while (inMemListIter.hasNext()) {
          inMemScenarioTemp = (Scenario) inMemListIter.next();

          if (inMemScenarioTemp.hasSameNameAndResponse(uploadedScenario)) {

            inMemScenarioExistTemp = true;
            break;
          }
        }
        if (!inMemScenarioExistTemp) {

          // Hey, we have a new scenario.
          // NOTE: incoming/uploaded scenario has an ID.
          // We MUST nullify it, to ensure there's no common Service's
          // scenario's ID
          uploadedScenario.setId(null);
          uploadedScenario.setServiceId(inMemoryService.getId());
          // Tag for Service:Scenario
          uploadedScenario.addTagToList(tagArguments);
          inMemoryService.saveOrUpdateScenario(uploadedScenario);

          readResults.addAdditionMsg("Scenario name '" + uploadedScenario.getScenarioName()
              + "' from uploaded service named '" + uploadedService.getServiceName()
              + "' was merged into service '" + inMemoryService.getServiceName() + "' ");
        } else {
          // OK, we have a MATCHING Scenario.
          // Be sure to add the uploaded-file tags
          inMemScenarioTemp.addTagToList(tagArguments);
          // Be sure to add the uploaded-scenario tags
          inMemScenarioTemp.addTagToList(uploadedScenario.getTag());
          // Save the scenario to the Service
          inMemoryService.saveOrUpdateScenario(inMemScenarioTemp);

          // Although we still need to
          readResults.addConflictMsg("Uploaded Scenario '" + uploadedScenario.getScenarioName()
View Full Code Here

    // - The first save gets a Service ID created.
    // - Scenario's refer to the Service ID
    newService = this.saveOrUpdateService(newService);
    // Now add scenarios
    for (Scenario scenario : service.getScenarios()) {
      Scenario newScenario = new Scenario();
      newScenario.setHttpResponseStatusCode(scenario.getHttpResponseStatusCode());
      newScenario.setMatchStringArg(scenario.getMatchStringArg());
      newScenario.setResponseHeader(scenario.getResponseHeader());
      newScenario.setResponseMessage(scenario.getResponseMessage());
      newScenario.setScenarioName(scenario.getScenarioName());
      newScenario.setTag(scenario.getTag());

      newService.saveOrUpdateScenario(newScenario);

    }
    // Save AGAIN.
View Full Code Here

    }
    return scenarioRef;
  }

  public Scenario getUniversalErrorScenario() {
    Scenario error = null;
    Service service = getServiceById(this.universalErrorServiceId);
    if (service != null) {
      error = service.getScenario(this.universalErrorScenarioId);
    }
    return error;
View Full Code Here

TOP

Related Classes of com.mockey.model.Scenario

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.