Package it.cdq.model.db

Examples of it.cdq.model.db.Trip


      baseurl = getBaseurl();

      start(baseurl);

      while (true) {
        Trip trip = service.getNextElement(getOperator());

        if (trip == null)
          break;// continue:

        if (existElement(trip)) {
View Full Code Here


    airportRepository.add(a);

    Flight f = new Flight();
    flightRepository.add(f);

    Trip t = new Trip();
    tripRepository.add(t);

    Assert.assertTrue(airportRepository.list().size() == 1);
    Assert.assertTrue(flightRepository.list().size() == 1);
    Assert.assertTrue(tripRepository.list().size() == 1);

    f.setDestination(a);
    f.setOrigin(a);
    f.setDate(new Date());
    t.setArrival(f);
    t.setDeparture(f);
    tripRepository.add(t);

    Assert.assertTrue(tripRepository.list().size() == 1);
  }
View Full Code Here

  @Transactional
  public void takeTripTest() {
    List<Trip> list = new ArrayList<Trip>();

    for (int i = 0; i < ITERATION; i++) {
      Trip trip = new Trip();
      trip.setArrival(mockFight("a", "b", i));
      trip.setDeparture(mockFight("b", "a", i));
      trip.setCreationTripDate(new Date());
      list.add(trip);
    }

    for (Trip trip : list)
      tripRepository.takeTrip(trip);
View Full Code Here

  @Transactional
  public void takeTripDuplicateTest() {
    List<Trip> list = new ArrayList<Trip>();

    for (int i = 0; i < ITERATION; i++) {
      Trip trip = new Trip();
      trip.setArrival(mockFight("a", "b", 1));
      trip.setDeparture(mockFight("a", "b", 1));
      trip.setCreationTripDate(new Date());
      list.add(trip);
    }

    for (Trip trip : list)
      tripRepository.takeTrip(trip);
View Full Code Here

  @Transactional
  public void discardSimilarTripTest() {
    List<Trip> list = new ArrayList<Trip>();

    for (int i = 0; i < 14; i++) {
      Trip trip = new Trip();
      trip.setArrival(mockFight("a", "b", 0));
      trip.setDeparture(mockFight("b", "a", 0));
      Calendar c = Calendar.getInstance();
      c.add(Calendar.DAY_OF_YEAR, i);
      trip.getArrival().setDate(c.getTime());
      trip.getDeparture().setDate(c.getTime());
      trip.setCreationTripDate(new Date());
      list.add(tripRepository.takeTrip(trip));
    }
    Assert.assertTrue(tripRepository.list().size() == list.size());

    for (Trip trip : list) {
View Full Code Here

      if (t.getArrival().getOperator().equals(operator)) {
        filtered.add(t);
      }
    }
    while (true) {
      Trip trip = codoquService.getNextElement(operator);
      if (trip == null)
        break;
    }

    Assert
View Full Code Here

    super(Trip.class);
  }

  public Trip takeTrip(Trip sample) {

    Trip result = searchTrip(sample);
    if (result != null) {
      logger.info("Trip [" + counter.get() + "] alredy present : " + sample);
      return result;
    }
View Full Code Here

    for (Option option : options) {
      if (option.isCandidate()) {
        i++;
        for (Trip tripDate : tripDates) {

          Trip clone = tripDate.clone();

          Airport a = new Airport();
          a.setAirportname(option.getOriginLabel());
          a.setIataCode(option.getOrigin());

          Airport b = new Airport();
          b.setAirportname(option.getDestinationLabel());
          b.setIataCode(option.getDestination());

          Flight arrival = clone.getArrival();
          arrival.setOrigin(a);
          arrival.setDestination(b);
          arrival.setCandidate(true);
          arrival.setModificationDate(new Date());
          arrival.setOperator(option.getOperator());

          Flight departure = clone.getDeparture();
          departure.setOrigin(b);
          departure.setDestination(a);
          departure.setCandidate(true);
          departure.setModificationDate(new Date());
          departure.setOperator(option.getOperator());
View Full Code Here

    arrival.setDate(arrivalDate);

    Flight departure = new Flight();
    departure.setDate(departureDate);

    Trip trip = new Trip();
    trip.setArrival(arrival);
    trip.setDeparture(departure);
    list.add(trip);

  }
View Full Code Here

    List<Trip> list = tripRepository.list(query, 1);
    if (CollectionUtils.isEmpty(list))
      return null;

    Trip trip = list.get(0);
    trip.setStarProcessingDate(new Date());
    tripRepository.update(trip);

    return trip;
  }
View Full Code Here

TOP

Related Classes of it.cdq.model.db.Trip

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.