Package it.polito.appeal.traci.protocol

Examples of it.polito.appeal.traci.protocol.Command.content()


  }

  @Override
  List<Command> getRequests() {
    Command cmd = new Command(commandID);
    writeRequestTo(cmd.content());
    return Collections.singletonList(cmd);
  }
 
  protected abstract void writeRequestTo(Storage content);
View Full Code Here


  }
 
  @Override
  List<Command> getRequests() {
    Command cmd = new Command(commandID);
    Storage content = cmd.content();
    content.writeByte(varID);
    content.writeStringASCII(objectID);
    return Collections.singletonList(cmd);
  }
View Full Code Here

  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

    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

  }

  @Test
  public void testContent() {
    Command cmd = new Command(sampleStorage());
    assertEquals(AN_INTEGER, cmd.content().readInt());
  }

  @Test
  public void testWriteRawTo() {
    Command cmd = new Command(sampleStorage());
View Full Code Here

    if (time == -1)
      throw new IllegalStateException("time must be set first");
   
    List<Command> reqs = super.getRequests();
    Command req = reqs.iterator().next();
    req.content().writeByte(Constants.TYPE_INTEGER);
    req.content().writeInt(time);
    return reqs;
  }
 
}
View Full Code Here

      throw new IllegalStateException("time must be set first");
   
    List<Command> reqs = super.getRequests();
    Command req = reqs.iterator().next();
    req.content().writeByte(Constants.TYPE_INTEGER);
    req.content().writeInt(time);
    return reqs;
  }
 
}
View Full Code Here

    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());
  }
 
  @Test
  public void testCloseHighLevel() throws IOException {
View Full Code Here

    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());
  }
 
  @Test
  public void testCloseHighLevel() throws IOException {
    RequestMessage reqm = new RequestMessage();
View Full Code Here

    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());
  }
 
  @Test
  public void testCloseHighLevel() throws IOException {
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.