Examples of Flight


Examples of classes.Flight

         * airline companies
         * Note! The unique identifier is the flight number
         */

        // Flight from Barcelona - Prais
        Flight flight = new Flight("KLM1200", "Barcelona", "Paris", "25-NOV-2012",
                "12:54", "3:15", "30-NOV-2012", "13:45", "4:25", "A7", "250");
        dao.put(flight);
        flight = new Flight("LHT213", "Barcelona", "Paris", "25-NOV-2012",
                "18:00", "21:20", "30-NOV-2012", "1400", "18:00", "C34", "280");
        dao.put(flight);
        flight = new Flight("AFR4502", "Barcelona", "Paris", "25-NOV-2012",
                "21:25", "23:45", "30-NOV-2012", "8:45", "12:05", "B9", "300");
        dao.put(flight);


        //Flight from Liverpool to Madrid
        flight = new Flight("KLM1400", "Liverpool", "Madrid", "25-NOV-2012",
                "18:20", "21:20", "30-NOV-2012", "14:45", "18:05", "B5", "320");
        dao.put(flight);
        flight = new Flight("LHT21211", "Liverpool", "Madrid", "25-NOV-2012",
                "18:00", "21:20", "30-NOV-2012", "1400", "18:00", "C34", "280");
        dao.put(flight);
        flight = new Flight("AFR045", "Liverpool", "Madrid", "25-NOV-2012",
                "21:25", "23:45", "30-NOV-2012", "8:45", "12:05", "B9", "300");
        dao.put(flight);

        //Flight from Vienna to Rome
        dao.put(flight);
        flight = new Flight("KLM140", "Vienna", "Rome", "25-NOV-2012",
                "18:20", "21:20", "30-NOV-2012", "14:45", "18:05", "B5", "320");
        dao.put(flight);
        flight = new Flight("LHT2311", "Vienna", "Rome", "25-NOV-2012",
                "18:20", "21:20", "30-NOV-2012", "14:45", "18:05", "B5", "320");
        dao.put(flight);
        flight = new Flight("AFR5630", "Vienna", "Rome", "25-NOV-2012",
                "18:20", "21:20", "30-NOV-2012", "14:45", "18:05", "B5", "320");
        dao.put(flight);

        //Flight from Antalya to Zagreb
        flight = new Flight("KLM560", "Antalya", "Zagreb", "25-NOV-2012",
                "18:20", "21:20", "30-NOV-2012", "14:45", "18:05", "B5", "320");
        dao.put(flight);
        flight = new Flight("LHT12030", "Antalya", "Zagreb", "25-NOV-2012",
                "18:00", "21:20", "30-NOV-2012", "14:00", "18:00", "C34", "280");
        dao.put(flight);
        flight = new Flight("AFR2100", "Antalya", "Zagreb", "25-NOV-2012",
                "21:25", "23:45", "30-NOV-2012", "8:45", "12:05", "B9", "300");
        dao.put(flight);


        response.setContentType("text/html;charset=UTF-8");
View Full Code Here

Examples of com.bddinaction.flyinghigh.model.Flight

    }

    @Override
    public Flight findFlightByNumber(String airportCode, String flightNumber) {
        Airport departureAirport = airportService.findAirportByCode(airportCode);
        return new Flight(flightNumber,departureAirport, new Airport("SYD","Sydney"), "06:00");
    }
View Full Code Here

Examples of com.google.appengine.datanucleus.test.jdo.Flight

public class JDOMapTest extends JDOTestCase {

  public void testInsert() {
    HasOneToManyMapJDO pojo = new HasOneToManyMapJDO();
    pojo.setVal("First");
    Flight fl = new Flight("LHR", "CHI", "BA201", 1, 15);
    pojo.addFlight(fl.getName(), fl);
    Flight fl2 = new Flight("BCN", "MAD", "IB3311", 2, 26);
    pojo.addFlight(fl2.getName(), fl2);
    pojo.addBasicEntry(1, "First Entry");
    pojo.addBasicEntry(2, "Second Entry");

    Object id = null;
    beginTxn();
    pm.makePersistent(pojo);
    pm.flush();
    id = JDOHelper.getObjectId(pojo);
    commitTxn();
    pm.evictAll(); // Make sure not cached

    beginTxn();
    HasOneToManyMapJDO pojoRead = (HasOneToManyMapJDO)pm.getObjectById(id);

    Map<String, Flight> map1 = pojoRead.getFlightsByName();
    assertNotNull("Map<String,Flight> is null!", map1);
    assertEquals(2, map1.size());
    assertTrue(map1.containsKey("BA201"));
    Flight fl11 = map1.get("BA201");
    assertEquals("LHR", fl11.getOrigin());
    assertEquals("CHI", fl11.getDest());
    assertTrue(map1.containsKey("IB3311"));
    Flight fl12 = map1.get("IB3311");
    assertEquals("BCN", fl12.getOrigin());
    assertEquals("MAD", fl12.getDest());

    Map<Integer, String> map2 = pojoRead.getBasicMap();
    assertNotNull("Map<Integer,String> is null!", map2);
    assertEquals(2, map2.size());
    assertTrue(map2.containsKey(1));
View Full Code Here

Examples of com.google.appengine.datanucleus.test.jdo.Flight

  public void testDeletePersistentAll_NoTxn() {
    switchDatasource(PersistenceManagerFactoryName.nontransactional);
    Key k1 = ds.put(newFlightEntity());
    Key k2 = ds.put(newFlightEntity());
    Flight f1 = pm.getObjectById(Flight.class, k1);
    Flight f2 = pm.getObjectById(Flight.class, k2);
    pm.deletePersistentAll(f1, f2);
    assertEquals(0, countForClass(Flight.class));
    assertEquals(1, batchRecorder.batchOps);

    Key k3 = ds.put(newFlightEntity());
    Key k4 = ds.put(newFlightEntity());
    Flight f3 = pm.getObjectById(Flight.class, k3);
    Flight f4 = pm.getObjectById(Flight.class, k4);
    pm.deletePersistentAll(Utils.newArrayList(f3, f4));
    assertEquals(0, countForClass(Flight.class));
    assertEquals(2, batchRecorder.batchOps);
  }
View Full Code Here

Examples of com.google.appengine.datanucleus.test.jdo.Flight

  }

  public void testDeletePersistentAll_OneEntity_NoTxn() {
    switchDatasource(PersistenceManagerFactoryName.nontransactional);
    Key k1 = ds.put(newFlightEntity());
    Flight f1 = pm.getObjectById(Flight.class, k1);
    pm.deletePersistentAll(f1);
    assertEquals(0, countForClass(Flight.class));
    assertEquals(0, batchRecorder.batchOps);

    Key k2 = ds.put(newFlightEntity());
    Flight f2 = pm.getObjectById(Flight.class, k2);
    pm.deletePersistentAll(Utils.newArrayList(f2));
    assertEquals(0, countForClass(Flight.class));
    assertEquals(0, batchRecorder.batchOps);
  }
View Full Code Here

Examples of com.google.appengine.datanucleus.test.jdo.Flight

  public void testDeletePersistentAll_Txn_MultipleEntityGroups() {
    switchDatasource(PersistenceManagerFactoryName.transactional);
    Key k1 = ds.put(newFlightEntity());
    Key k2 = ds.put(newFlightEntity());
    beginTxn();
    Flight f1 = pm.getObjectById(Flight.class, k1);
    commitTxn();
    beginTxn();
    Flight f2 = pm.getObjectById(Flight.class, k2);
    commitTxn();
    beginTxn();
    try {
      pm.deletePersistentAll(f1, f2);
      fail("expected exception");
    } catch (JDOUserException e) {
      // good
    }
    rollbackTxn();
    assertEquals(2, countForClass(Flight.class));
    // We don't get to the batch delete because we blow up
    // before we get there.
    assertEquals(0, batchRecorder.batchOps);

    Key k3 = ds.put(newFlightEntity());
    Key k4 = ds.put(newFlightEntity());
    beginTxn();
    Flight f3 = pm.getObjectById(Flight.class, k3);
    commitTxn();
    beginTxn();
    Flight f4 = pm.getObjectById(Flight.class, k4);
    commitTxn();
    beginTxn();
    try {
      pm.deletePersistentAll(Utils.newArrayList(f3, f4));
      fail("expected exception");
View Full Code Here

Examples of com.google.appengine.datanucleus.test.jdo.Flight

  public void testDeletePersistentAll_OneEntity_Txn() {
    switchDatasource(PersistenceManagerFactoryName.transactional);
    Key k1 = ds.put(newFlightEntity());
    beginTxn();
    Flight f1 = pm.getObjectById(Flight.class, k1);
    pm.deletePersistentAll(f1);
    commitTxn();
    assertEquals(0, countForClass(Flight.class));
    assertEquals(0, batchRecorder.batchOps);

    Key k2 = ds.put(newFlightEntity());
    beginTxn();
    Flight f2 = pm.getObjectById(Flight.class, k2);
    pm.deletePersistentAll(Utils.newArrayList(f2));
    commitTxn();
    assertEquals(0, countForClass(Flight.class));
    assertEquals(0, batchRecorder.batchOps);
  }
View Full Code Here

Examples of com.google.appengine.datanucleus.test.jdo.Flight

  }

  public void testInsertWithCustomIdPolicy() throws EntityNotFoundException {
    setupCustomIdentifierPolicy("___", "PREFIX", "SUFFIX", "UpperCase");

    Flight f1 = new Flight();
    f1.setOrigin("BOS");
    f1.setDest("MIA");
    f1.setMe(2);
    f1.setYou(4);
    f1.setName("Harold");
    f1.setFlightNumber(400);
    pm.makePersistent(f1);
    Entity entity = ds.get(KeyFactory.stringToKey(f1.getId()));
    assertNotNull(entity);
    assertEquals("PREFIX" + Flight.class.getSimpleName().toUpperCase() + "SUFFIX", entity.getKind());
    assertEquals("Harold", entity.getProperty("NAME"));
    // column name isn't generated if explicitly set
    assertEquals(400L, entity.getProperty("flight_number"));
View Full Code Here

Examples of com.google.appengine.datanucleus.test.jdo.Flight

    assertEquals(1, countForClass(Flight.class));
  }

  public void testDeleteCascades() {
    HasOneToManyListJDO parent = new HasOneToManyListJDO();
    Flight f = new Flight();
    parent.getFlights().add(f);
    beginTxn();
    pm.makePersistent(parent);
    commitTxn();
    assertEquals(1, countForClass(Flight.class));
View Full Code Here

Examples of com.google.appengine.datanucleus.test.jdo.Flight

  }

  public void testQueryWithCustomIdPolicy() {
    setupCustomIdentifierPolicy("___", "PREFIX", "SUFFIX", "UpperCase");

    Flight f1 = new Flight();
    f1.setOrigin("BOS");
    f1.setDest("MIA");
    f1.setMe(2);
    f1.setYou(4);
    f1.setName("Harold");
    f1.setFlightNumber(400);
    pm.makePersistent(f1);

    Flight f2 = new Flight();
    f2.setOrigin("BOS");
    f2.setDest("MIA");
    f2.setMe(2);
    f2.setYou(4);
    f2.setName("Harold2");
    f2.setFlightNumber(401);
    pm.makePersistent(f2);

    Query q = pm.newQuery("select from " + Flight.class.getName()
        + " where flightNumber > 300 "
        + " order by flightNumber desc");
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.