Package it.polito.appeal.traci.protocol

Examples of it.polito.appeal.traci.protocol.ResponseContainer


   */
  @Override
  void pickResponses(Iterator<ResponseContainer> responseIterator)
      throws TraCIException {
   
    ResponseContainer respc = responseIterator.next();
    StatusResponse statusResp = respc.getStatus();
    Utils.checkStatusResponse(statusResp, commandID);
   
  }
View Full Code Here


    return Collections.singletonList(cmd);
  }

  @Override
  void pickResponses(Iterator<ResponseContainer> responseIterator) throws TraCIException {
    ResponseContainer respc = responseIterator.next();
    StatusResponse statusResp = respc.getStatus();
    Utils.checkStatusResponse(statusResp, commandID);
    Command resp = respc.getResponse();
    Utils.checkByte(resp.content(), varID);
    Utils.checkObjectID(resp.content(), objectID);
   
    V value = readValue(resp);
    setDone(value);
View Full Code Here

    reqm.writeTo(outStream);
   
    ResponseMessage respm = new ResponseMessage(inStream);
    assertEquals(1, respm.responses().size());
   
    ResponseContainer pair = respm.responses().get(0);
    assertEquals(Constants.CMD_GETVERSION, pair.getStatus().id());
   
    Command resp = pair.getResponse();
    assertEquals(Constants.CMD_GETVERSION, resp.id());
    assertEquals(1, resp.content().readInt());
    System.out.println(resp.content().readStringASCII());
  }
View Full Code Here

    reqm.writeTo(outStream);
   
    ResponseMessage respm = new ResponseMessage(inStream);
    assertEquals(1, respm.responses().size());
   
    ResponseContainer pair = respm.responses().get(0);
    assertEquals(Constants.CMD_CLOSE, pair.getStatus().id());
    assertEquals("Goodbye", pair.getStatus().description()); // undocumented!
   
    assertNull(pair.getResponse());
  }
View Full Code Here

    reqm.writeTo(outStream);
   
    ResponseMessage respm = new ResponseMessage(inStream);
    assertEquals(1, respm.responses().size());
   
    ResponseContainer pair = respm.responses().get(0);
    assertEquals(Constants.CMD_GETVERSION, pair.getStatus().id());
   
    Command resp = pair.getResponse();
    assertEquals(Constants.CMD_GETVERSION, resp.id());
    assertEquals(API_VERSION, resp.content().readInt());
    log.info(resp.content().readStringASCII());
  }
View Full Code Here

    reqm.writeTo(outStream);
   
    ResponseMessage respm = new ResponseMessage(inStream);
    assertEquals(1, respm.responses().size());
   
    ResponseContainer pair = respm.responses().get(0);
    assertEquals(Constants.CMD_CLOSE, pair.getStatus().id());
   
    assertNull(pair.getResponse());
  }
View Full Code Here

  }
 
  public synchronized Object do_job_get(SumoCommand sc) throws IOException{
   
    Object output = null;
    ResponseContainer rc = queryAndVerifySingle(sc.cmd);
    Command resp = rc.getResponse();
 
    verifyGetVarResponse(resp, sc.response, sc.input2, sc.input3);
    verify("", sc.output_type, (int)resp.content().readUnsignedByte());
   
    if(sc.output_type == Constants.TYPE_INTEGER){output = resp.content().readInt();
View Full Code Here

    if (commands.size() > responses.size())
      throw new TraCIException("not enough responses received");
   
    for (int i=0; i<commands.size(); i++) {
      Command cmd = commands.get(i);
      ResponseContainer responsePair = responses.get(i);
      StatusResponse statusResp = responsePair.getStatus();
      verify("command and status IDs match", cmd.id(), statusResp.id());
      if (statusResp.result() != Constants.RTYPE_OK)
        throw new TraCIException("SUMO error for command "
            + statusResp.id() + ": " + statusResp.description());
    }
View Full Code Here

   */
  @Override
  void pickResponses(Iterator<ResponseContainer> responseIterator)
      throws TraCIException {
   
    ResponseContainer respc = responseIterator.next();
    StatusResponse statusResp = respc.getStatus();
    Utils.checkStatusResponse(statusResp, commandID);
   
  }
View Full Code Here

    return Collections.singletonList(cmd);
  }

  @Override
  void pickResponses(Iterator<ResponseContainer> responseIterator) throws TraCIException {
    ResponseContainer respc = responseIterator.next();
    StatusResponse statusResp = respc.getStatus();
    Utils.checkStatusResponse(statusResp, commandID);
    Command resp = respc.getResponse();
    Utils.checkByte(resp.content(), varID);
    Utils.checkObjectID(resp.content(), objectID);
   
    V value = readValue(resp);
    setDone(value);
View Full Code Here

TOP

Related Classes of it.polito.appeal.traci.protocol.ResponseContainer

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.