Package com.cisco.oss.foundation.tools.simulator.rest.container

Examples of com.cisco.oss.foundation.tools.simulator.rest.container.SimulatorEntity


      String msg = "can not retrieve simulator. simulator on port " + port +  " doesn't exist";
      logger.error(msg);
      return Response.status(Status.BAD_REQUEST).entity(msg).build();
    }

    SimulatorEntity simulator = simulatorService.getSimulator(port);
   
    Writer strWriter = new StringWriter();
   
    try {
      objectMapper.writeValue(strWriter, simulator.getSimulatorResponses());
    } catch (Exception e) {
      logger.error("failed to write simulator to json", e);
      return Response.status(Status.INTERNAL_SERVER_ERROR).entity("failed to write simulator to json").build();
    }
View Full Code Here


      String msg = "can not retrieve simulator. simulator on port " + port +  " doesn't exist";
      logger.error(msg);
      return Response.status(Status.BAD_REQUEST).entity(msg).build();
    }

    SimulatorEntity simulator = simulatorService.getSimulator(port);
   
    Writer strWriter = new StringWriter();
   
    try {
      objectMapper.writeValue(strWriter, simulator.getSimulatorResponses());
    } catch (Exception e) {
      logger.error("failed to write simulator to json", e);
      return Response.status(Status.INTERNAL_SERVER_ERROR).entity("failed to write simulator to json").build();
    }
View Full Code Here

      String msg = "can not retrieve simulator. simulator on port " + port +  " doesn't exist";
      logger.error(msg);
      return Response.status(Status.BAD_REQUEST).entity(msg).build();
    }

    SimulatorEntity simulator = simulatorService.getSimulator(port);
   
    Writer strWriter = new StringWriter();
   
    try {
      objectMapper.writeValue(strWriter, simulator.getSimulatorResponses());
    } catch (Exception e) {
      logger.error("failed to write simulator to json", e);
      return Response.status(Status.INTERNAL_SERVER_ERROR).entity("failed to write simulator to json").build();
    }
View Full Code Here

//    }
//        holder.setInitParameter("port", Integer.toString(port));

    logger.debug("simulator was added on port:" + port);

    SimulatorEntity simulatorEntity = new SimulatorEntity(port);
   
    simulators.put(port, simulatorEntity);
 
    return true;
  }
View Full Code Here

    if (!simulatorExists(port)) {
      logger.error("there is no simulator on port " + port);
      Response.status(0).build();
    }
   
    SimulatorEntity simulator = simulators.get(port);
    String path = uriInfo.getPath();
    path = removeFirstAndLastSlashesFromUrl(path);
    SimulatorRequest simulatorRequest = new SimulatorRequest(method, path, uriInfo.getQueryParameters(),
        headers.getRequestHeaders(), body);
   
    simulator.addRequestToQueue(simulatorRequest);
   
    return simulator.generateResponse(simulatorRequest);
   
  }
View Full Code Here

    return expectedUrl;
  }

  public List<SimulatorRequest> getAllQueueOfSimulator(int port) {

    SimulatorEntity simulator = getSimulator(port);
   
    if (simulator != null) {
      return simulator.getAllRequests();
    }
    return null;
  }
View Full Code Here

    return null;
  }

  public List<SimulatorRequest> getQueueOfSimulator(int port, int numOfMsg) {
   
    SimulatorEntity simulator = getSimulator(port);

    if (simulator != null) {
      return simulator.getLastRequests(numOfMsg);
    }
    return null;
  }
View Full Code Here

    }
    return null;
  }

  public void removeQueueOfSimulator(int port) {
    SimulatorEntity simulator = getSimulator(port);

    if (simulator != null) {
      simulator.removeAllRequests();
      logger.debug("queue of requests was removed for simulator on port:" + port);
    }
  }
View Full Code Here

      logger.debug("queue of requests was removed for simulator on port:" + port);
    }
  }

  public SimulatorRequest removeLastRequestOfSimulator(int port) {
    SimulatorEntity simulator = getSimulator(port);

    if (simulator != null) {
      SimulatorRequest removedLastRequest = simulator.removeLastRequest();
      logger.debug("last request was removed for simulator on port:" + port);
      return removedLastRequest;
    }
   
    return null;
View Full Code Here

    if (!simulatorExists(port)) {
      logger.error("there is no simulator on port " + port);
      return false;
    }
 
    SimulatorEntity simulator = simulators.get(port);
    simulator.setSimulatorNextResponse(simulatorNextResponse);
   
    logger.debug("next response was added to simulator on port:" + port);
   
    return true;
  }
View Full Code Here

TOP

Related Classes of com.cisco.oss.foundation.tools.simulator.rest.container.SimulatorEntity

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.