@Test
 public void canAirportBeFoundOnId() {
   Airport a = entityManager().find(Airport.class, 1L);
   assertNotNull(a);
   assertNotNull(a.getAddress());
   assertNotNull(a.getRegion());
 }
Ejemplo n.º 2
0
 // Give a number to a arriving plane
 public int registerNewAproache(Airport a) {
   this.planeList.add(new Plane(Motor.getNowDate()));
   planeWaitingToLand = true;
   a.getTrack().setDelayToLand();
   int id = planeList.get(planeList.size() - 1).setId(planeList.size() - 1);
   return id;
 }
Ejemplo n.º 3
0
  public static void main(String[] args) throws IOException {
    Airport a = new Airport();
    Motor.setStartDate();
    try {
      CsvManager.csvManagerInit();
    } catch (IOException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
      System.out.println("Error to initiate Csv Manager");
    }

    for (int i = 0; i < 3 * 30 * 24 * 60; i++) {
      // Step up the system
      Motor.stepUp();

      // add new plane
      if (randomPlaneArriver()) {
        int planeNumber = a.getTower().registerNewAproache(a);
        a.getTower().addToLandList(planeNumber);
        System.out.println("Plane P" + planeNumber + " is waiting to land");
      }

      a.getTrack().handler(a);
      a.getTaxiways()[Taxiway.TAXIWAY_ARRIVE].handler(a);
      a.getTaxiways()[Taxiway.TAXIWAY_LEAVE].handler(a);
      for (int j = 0; j < a.getGates().length; j++) {
        a.getGates()[j].handler(a);
      }
      System.out.println(" ");
    }
    for (int i = 0; i < a.getTower().planeList.size(); i++) {
      a.getTower().getPlaneById(i).writeLog();
    }

    Measure.getRet().printAll();
    Measure.getFreq().printFreqLog();
  }
 @Test(expected = ConstraintViolationException.class)
 public void airportCantBePersistedWithoutRegion() {
   airport.setRegion(null);
   entityManager().persist(airport);
 }
 private void createAirport() {
   airport = new Airport();
   airport.setName("Brussels Airport");
   airport.setRegion(getRegion());
   airport.setAddress(getAddress());
 }