Examples of Flight


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

    switchDatasource(PersistenceManagerFactoryName.nontransactional);
    getExecutionContext().setProperty(PROP_DETACH_ON_CLOSE, true);
    testNewParentNewChild_StringKeyOnParent(NEW_PM_START_END);
  }
  private void testNewParentNewChild_StringKeyOnParent(StartEnd startEnd) throws EntityNotFoundException {
    Flight f = newFlight();
    HasKeyPkJDO hasKeyPk = new HasKeyPkJDO();
    HasOneToOneStringPkParentJDO hasParent = new HasOneToOneStringPkParentJDO();
    HasOneToOneStringPkParentKeyPkJDO hasParentKeyPk = new HasOneToOneStringPkParentKeyPkJDO();

    HasOneToOneStringPkJDO pojo = new HasOneToOneStringPkJDO();
    pojo.setId("yar");
    pojo.setFlight(f);
    pojo.setHasKeyPK(hasKeyPk);
    pojo.setHasParent(hasParent);
    hasParent.setParent(pojo);
    pojo.setHasParentKeyPK(hasParentKeyPk);
    hasParentKeyPk.setParent(pojo);

    makePersistentInTxn(pojo, startEnd);

    assertNotNull(f.getId());
    assertNotNull(hasKeyPk.getKey());
    assertNotNull(hasParent.getKey());
    assertNotNull(hasParentKeyPk.getKey());
    assertNotNull(pojo.getId());

    Entity flightEntity = ds.get(KeyFactory.stringToKey(f.getId()));
    assertNotNull(flightEntity);
    assertEquals("jimmy", flightEntity.getProperty("name"));
    assertEquals("bos", flightEntity.getProperty("origin"));
    assertEquals("mia", flightEntity.getProperty("dest"));
    assertEquals(2L, flightEntity.getProperty("me"));
    assertEquals(3L, flightEntity.getProperty("you"));
    assertEquals(44L, flightEntity.getProperty("flight_number"));
    assertEquals(KeyFactory.stringToKey(f.getId()), flightEntity.getKey());
    assertKeyParentEquals(pojo.getClass(), pojo.getId(), flightEntity, f.getId());

    Entity hasKeyPkEntity = ds.get(hasKeyPk.getKey());
    assertNotNull(hasKeyPkEntity);
    assertEquals(hasKeyPk.getKey(), hasKeyPkEntity.getKey());
    assertKeyParentEquals(pojo.getClass(), pojo.getId(), hasKeyPkEntity, hasKeyPk.getKey());
View Full Code Here

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

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

  public void testAddAlreadyPersistedChildToParent_NoTxnDifferentPm() {
    switchDatasource(PersistenceManagerFactoryName.nontransactional);
    Flight f1 = new Flight();
    HasOneToOneJDO pojo = new HasOneToOneJDO();
    pm.makePersistent(f1);
    f1 = pm.detachCopy(f1);
    pm.close();
    pm = pmf.getPersistenceManager();
View Full Code Here

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

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

  public void testAddAlreadyPersistedChildToParent_NoTxnSamePm() {
    switchDatasource(PersistenceManagerFactoryName.nontransactional);
    Flight f1 = new Flight();
    HasOneToOneJDO pojo = new HasOneToOneJDO();
    pm.makePersistent(f1);
    pojo.setFlight(f1);
    try {
      pm.makePersistent(pojo);
View Full Code Here

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

    pm.getFetchPlan().setMaxFetchDepth(3);
    testChildAtMultipleLevels(NEW_PM_START_END);
  }
  private void testChildAtMultipleLevels(StartEnd startEnd) throws EntityNotFoundException {
    HasOneToOneChildAtMultipleLevelsJDO pojo = new HasOneToOneChildAtMultipleLevelsJDO();
    Flight f1 = new Flight();
    pojo.setFlight(f1);
    HasOneToOneChildAtMultipleLevelsJDO child = new HasOneToOneChildAtMultipleLevelsJDO();
    Flight f2 = new Flight();
    child.setFlight(f2);
    pojo.setChild(child);
    startEnd.start();
    pm.makePersistent(pojo);
    startEnd.end();
    startEnd.start();
    pojo = pm.getObjectById(HasOneToOneChildAtMultipleLevelsJDO.class, pojo.getId());
    assertEquals(f1.getId(), pojo.getFlight().getId());
    assertEquals(child.getId(), pojo.getChild().getId());
    assertEquals(child.getFlight(), f2);
    assertNull(child.getChild());
    startEnd.end();

    Entity pojoEntity = ds.get(pojo.getId());
    Entity childEntity = ds.get(child.getId());
    Entity flight1Entity = ds.get(KeyFactory.stringToKey(f1.getId()));
    Entity flight2Entity = ds.get(KeyFactory.stringToKey(f2.getId()));
    assertEquals(flight1Entity.getKey(), pojoEntity.getProperty("flight_id_OID"));
    assertEquals(childEntity.getKey(), pojoEntity.getProperty("child_id_OID"));
    assertEquals(flight2Entity.getKey(), childEntity.getProperty("flight_id_OID"));
    assertTrue(childEntity.hasProperty("child_id_OID"));
    assertNull(childEntity.getProperty("child_id_OID"));
View Full Code Here

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

    PutPolicy policy = new PutPolicy();
    DatastoreServiceInterceptor.install(getStoreManager(), policy);
    try {
      pmf.close();
      switchDatasource(startEnd.getPmfName());
      Flight flight = new Flight();
      pojo.setFlight(flight);
      pojo.setHasParent(hasParent);
      HasKeyPkJDO hasKeyPk = new HasKeyPkJDO();
      pojo.setHasKeyPK(hasKeyPk);
View Full Code Here

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

    }
    assertEquals(expectedPutsOnChildDelete, policy.putParamList.size());
  }

  private Flight newFlight() {
    Flight flight = new Flight();
    flight.setName("jimmy");
    flight.setOrigin("bos");
    flight.setDest("mia");
    flight.setMe(2);
    flight.setYou(3);
    flight.setFlightNumber(44);
    return flight;
  }
View Full Code Here

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

*/
public class JDOEmbeddedTest extends JDOTestCase {

  public void testEmbeddedWithGeneratedId() throws EntityNotFoundException {
    HasEmbeddedJDO pojo = new HasEmbeddedJDO();
    Flight f = new Flight();
    f.setId("yarg");
    f.setFlightNumber(23);
    f.setName("harold");
    f.setOrigin("bos");
    f.setDest("mia");
    f.setYou(24);
    f.setMe(25);
    pojo.setFlight(f);

    Flight f2 = new Flight();
    f2.setId("blarg");
    f2.setFlightNumber(26);
    f2.setName("jimmy");
    f2.setOrigin("jfk");
    f2.setDest("sea");
    f2.setYou(28);
    f2.setMe(29);
    pojo.setAnotherFlight(f2);

    HasEmbeddedJDO.Embedded1 embedded1 = new HasEmbeddedJDO.Embedded1();
    pojo.setEmbedded1(embedded1);
    embedded1.setVal1("v1");
    embedded1.setMultiVal1(Utils.newArrayList("yar1", "yar2"));
    HasEmbeddedJDO.Embedded2 embedded2 = new HasEmbeddedJDO.Embedded2();
    embedded2.setVal2("v2");
    embedded2.setMultiVal2(Utils.newArrayList("bar1", "bar2"));
    embedded1.setEmbedded2(embedded2);
    beginTxn();
    pm.makePersistent(pojo);
    commitTxn();

    Entity e = ds.get(KeyFactory.createKey(kindForClass(pojo.getClass()), pojo.getId()));
    assertTrue(e.hasProperty("flightId")); // Uses column names from embedded mapping
    assertTrue(e.hasProperty("origin")); // Uses column names from Flight class since not overridden
    assertTrue(e.hasProperty("dest")); // Uses column names from Flight class since not overridden
    assertTrue(e.hasProperty("name")); // Uses column names from Flight class since not overridden
    assertTrue(e.hasProperty("you")); // Uses column names from Flight class since not overridden
    assertTrue(e.hasProperty("me")); // Uses column names from Flight class since not overridden
    assertTrue(e.hasProperty("flight_number")); // Uses column names from Flight class since not overridden
    assertTrue(e.hasProperty("ID")); // Uses column names from embedded mapping
    assertTrue(e.hasProperty("ORIGIN")); // Uses column names from embedded mapping
    assertTrue(e.hasProperty("DEST")); // Uses column names from embedded mapping
    assertTrue(e.hasProperty("NAME")); // Uses column names from embedded mapping
    assertTrue(e.hasProperty("YOU")); // Uses column names from embedded mapping
    assertTrue(e.hasProperty("ME")); // Uses column names from embedded mapping
    assertTrue(e.hasProperty("FLIGHTNUMBER")); // Uses column names from embedded mapping
    assertTrue(e.hasProperty("val1"));
    assertTrue(e.hasProperty("multiVal1"));
    assertTrue(e.hasProperty("val2"));
    assertTrue(e.hasProperty("multiVal2"));
    assertEquals(18, e.getProperties().size());

    assertEquals(1, countForClass(HasEmbeddedJDO.class));
    assertEquals(0, countForClass(Flight.class));
    switchDatasource(PersistenceManagerFactoryName.transactional);
    beginTxn();
    pojo = pm.getObjectById(HasEmbeddedJDO.class, pojo.getId());
    assertNotNull(pojo.getFlight());
    // it's weird but flight doesn't have an equals() method
    assertTrue(f.customEquals(pojo.getFlight()));
    assertNotNull(pojo.getAnotherFlight());
    assertTrue(f2.customEquals(pojo.getAnotherFlight()));
   
    assertNotNull(pojo.getEmbedded1());
    assertEquals("v1", pojo.getEmbedded1().getVal1());
    assertEquals(Utils.newArrayList("yar1", "yar2"), pojo.getEmbedded1().getMultiVal1());
    assertNotNull(pojo.getEmbedded1().getEmbedded2());
View Full Code Here

Examples of com.nagarro.jsag.fjt.gall.models.Flight

        final ModelAndView modelAndView = new ModelAndView(FlightSearchController.FLIGHT_SEARCH);
        System.out.println("in flight search post");
        try {
            final Iterator<Flight> flightIterator = this.flightSearchService.search(flightSearchData).iterator();
            while (flightIterator.hasNext()) {
                final Flight flight = flightIterator.next();
                System.out.println(flight);
                flightSearchData.addSearchResult(flight);
            }
        } catch (final ServiceException serviceException) {
            System.err.print(serviceException.getMessage());
View Full Code Here

Examples of dao.tro.Flight

        try {
            trui = Long.parseLong(request.getParameter("flightNumber"));
        } catch (NumberFormatException e) {
            log.info("I catch an exception "+e);
        }
        Flight flight = factory.getFlightDAO().showInformation(trui);
        flight.setDepartureAirport(factory.getAirportDAO().loadCountryName(flight.getDepartureAirport()));
        flight.setDestinationAirport(factory.getAirportDAO().loadCountryName(flight.getDestinationAirport()));
        ActionResult actionResult = new ActionResult();
        actionResult.setUrlAddress("flt/ShowFlightInformation.jsp");
        if (flight!=null) {
            actionResult.setUrlAddress("/flt/ShowFlightInformation.jsp");
        } else {
View Full Code Here

Examples of it.cdq.model.db.Flight

  @Transactional
  public void multiAddTest() {
    Airport a = new Airport();
    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
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.