Package it.polito.appeal.traci

Examples of it.polito.appeal.traci.TrafficLight


    new String[] { "1si_2", ":0_15_0", "1o_0" },
  };
 
  @Test
  public void testControlledLinks() throws IOException {
    TrafficLight tl = repo.getByID("0");
    ControlledLinks links = tl.queryReadControlledLinks().get();
   
    assertEquals(linksLaneIDs.length, links.getLinks().length);
    for (int i=0; i<linksLaneIDs.length; i++) {
      ControlledLink[] linksForSignal = links.getLinks()[i];
      assertEquals(1, linksForSignal.length);
View Full Code Here


    }
  }
 
  @Test
  public void testCompleteProgramDefinition() throws IOException {
    TrafficLight tl = repo.getByID("0");
    Program program = tl.queryReadCompleteDefinition().get();
   
    assertEquals(1, program.getLogics().length);
    Logic logic = program.getLogics()[0];
   
    assertEquals("0", logic.getSubID());
View Full Code Here

    }
  }
 
  @Test
  public void testChangingCompleteProgramDefinition() throws IOException {
    TrafficLight tl = repo.getByID("0");
   
    final Logic expectedLogic = new Logic("0", 0, new Phase[] {
      new Phase(10000, new TLState("rrGGyyyyggrryryr")),
      new Phase(15000, new TLState("GGyyrrrrrrGGrGrG")),
      new Phase(55000, new TLState("yyrrGGGGGGyyGyGy"))
    });
    tl.queryChangeCompleteProgramDefinition().setValue(expectedLogic);
    tl.queryChangeCompleteProgramDefinition().run();
   
    Program newProgram = tl.queryReadCompleteDefinition().get();
   
    assertEquals(1, newProgram.getLogics().length);
    Logic actualLogic = newProgram.getLogics()[0];

    assertEquals(
View Full Code Here

  private static final TLState TEST_TL_STATE = new TLState("rrGGyyyyggrryryr");

  @Test
  public void testChangeState() throws IOException {
    TrafficLight tl = repo.getByID("0");
    ChangeLightsStateQuery q = tl.queryChangeLightsState();
    q.setValue(TEST_TL_STATE);
    q.run();
   
    assertEquals(TEST_TL_STATE, tl.queryReadState().get());
  }
View Full Code Here

    assertEquals(TEST_TL_STATE, tl.queryReadState().get());
  }
 
  @Test
  public void testTrafficLightsPosition() throws IOException {
    TrafficLight tl = repo.getByID("0");
    List<Lane> lanes = tl.queryReadControlledLanes().get();
   
    assertEquals(16, lanes.size());
   
    for (Lane lane : lanes) {
   
View Full Code Here

  };

 
  @Test
  public void testStateAtFirstStep() throws IOException {
    TrafficLight tl = repo.getByID("0");
    TLState tlState = tl.queryReadState().get();
    final LightState[] states = tlState.lightStates;
    assertEquals(16, states.length);
    assertArrayEquals(PHASES[0], states);
  }
View Full Code Here

TOP

Related Classes of it.polito.appeal.traci.TrafficLight

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.