Examples of Flight


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

  public void testSimpleUpdate() throws EntityNotFoundException {
    Key key = ds.put(Flight.newFlightEntity("1", "yam", "bam", 1, 2));

    String keyStr = KeyFactory.keyToString(key);
    beginTxn();
    Flight flight = pm.getObjectById(Flight.class, keyStr);

    assertEquals(keyStr, flight.getId());
    assertEquals("yam", flight.getOrigin());
    assertEquals("bam", flight.getDest());
    assertEquals("1", flight.getName());
    assertEquals(1, flight.getYou());
    assertEquals(2, flight.getMe());

    flight.setName("2");
    commitTxn();

    Entity flightCheck = ds.get(key);
    assertEquals("yam", flightCheck.getProperty("origin"));
    assertEquals("bam", flightCheck.getProperty("dest"));
View Full Code Here

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

  public void testSimpleUpdateWithNamedKey() throws EntityNotFoundException {
    Key key = ds.put(Flight.newFlightEntity("named key", "1", "yam", "bam", 1, 2));

    String keyStr = KeyFactory.keyToString(key);
    beginTxn();
    Flight flight = pm.getObjectById(Flight.class, keyStr);

    assertEquals(keyStr, flight.getId());
    assertEquals("yam", flight.getOrigin());
    assertEquals("bam", flight.getDest());
    assertEquals("1", flight.getName());
    assertEquals(1, flight.getYou());
    assertEquals(2, flight.getMe());

    flight.setName("2");
    commitTxn();

    Entity flightCheck = ds.get(key);
    assertEquals("yam", flightCheck.getProperty("origin"));
    assertEquals("bam", flightCheck.getProperty("dest"));
View Full Code Here

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

    Entity flightEntity = Flight.newFlightEntity("1", "yam", "bam", 1, 2);
    Key key = ds.put(flightEntity);

    String keyStr = KeyFactory.keyToString(key);
    beginTxn();
    Flight flight = pm.getObjectById(Flight.class, keyStr);

    flight.setName("2");
    flightEntity.setProperty(DEFAULT_VERSION_PROPERTY_NAME, 2L);
    // we update the flight directly in the datastore right before commit
    ds.put(flightEntity);
    try {
      commitTxn();
View Full Code Here

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

    Entity flightEntity = Flight.newFlightEntity("1", "yam", "bam", 1, 2);
    Key key = ds.put(flightEntity);

    String keyStr = KeyFactory.keyToString(key);
    beginTxn();
    Flight flight = pm.detachCopy(pm.getObjectById(Flight.class, keyStr));
    commitTxn();
    beginTxn();
    flight.setName("2");
    pm.makePersistent(flight);
    flightEntity.setProperty(DEFAULT_VERSION_PROPERTY_NAME, 2L);
    // we update the flight directly in the datastore right before commit
    ds.put(flightEntity);
    try {
View Full Code Here

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

    Entity flightEntity = Flight.newFlightEntity("1", "yam", "bam", 1, 2);
    Key key = ds.put(flightEntity);

    String keyStr = KeyFactory.keyToString(key);
    beginTxn();
    Flight flight = pm.getObjectById(Flight.class, keyStr);

    flight.setName("2");
    flightEntity.setProperty(DEFAULT_VERSION_PROPERTY_NAME, 2L);
    // we remove the flight from the datastore right before commit
    ds.delete(key);
    try {
      commitTxn();
View Full Code Here

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

  public void testNonTransactionalUpdate() throws EntityNotFoundException {
    switchDatasource(PersistenceManagerFactoryName.nontransactional);

    Key key = ds.put(Flight.newFlightEntity("1", "yam", "bam", 1, 2));
    Flight f = pm.getObjectById(Flight.class, KeyFactory.keyToString(key));
    f.setYou(77);
    pm.close();
    Entity flightEntity = ds.get(key);
    assertEquals(77L, flightEntity.getProperty("you"));
    pm = pmf.getPersistenceManager();
  }
View Full Code Here

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

  public void testChangeStringPK_SetNonKeyString() throws EntityNotFoundException {
    Key key = ds.put(Flight.newFlightEntity("named key", "1", "yam", "bam", 1, 2));

    String keyStr = KeyFactory.keyToString(key);
    beginTxn();
    Flight flight = pm.getObjectById(Flight.class, keyStr);

    assertEquals(keyStr, flight.getId());
    assertEquals("yam", flight.getOrigin());
    assertEquals("bam", flight.getDest());
    assertEquals("1", flight.getName());
    assertEquals(1, flight.getYou());
    assertEquals(2, flight.getMe());

    flight.setName("2");
    flight.setId("foo");
    try {
      commitTxn();
      fail("expected exception");
    } catch (JDOFatalUserException e) {
      // good
View Full Code Here

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

  }

  public void testChangeStringPK_SetNull() throws EntityNotFoundException {
    Key key = ds.put(Flight.newFlightEntity("1", "yam", "bam", 1, 2));
    beginTxn();
    Flight f = pm.getObjectById(Flight.class, KeyFactory.keyToString(key));
    f.setId(null);
    pm.makePersistent(f);
    try {
      commitTxn();
      fail("expected exception");
    } catch (JDOFatalUserException e) {
View Full Code Here

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

  }

  public void testChangePK_SetKeyString() throws EntityNotFoundException {
    Key key = ds.put(Flight.newFlightEntity("1", "yam", "bam", 1, 2));
    beginTxn();
    Flight f = pm.getObjectById(Flight.class, KeyFactory.keyToString(key));
    f.setId(KeyFactory.keyToString(KeyFactory.createKey(Flight.class.getSimpleName(), "yar")));
    f.setYou(77);
    pm.makePersistent(f);
    try {
      commitTxn();
      fail("expected exception");
    } catch (JDOFatalUserException e) {
View Full Code Here

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

  public void testUpdateStrPrimaryKey_SetNewName() {
    Key key = ds.put(Flight.newFlightEntity("name", "bos", "mia", 3, 4, 44));

    beginTxn();
    Flight f = pm.getObjectById(Flight.class, key.getId());
    f.setId("other");
    pm.makePersistent(f);
    try {
      commitTxn();
      fail("expected exception");
    } catch (JDOFatalUserException e) {
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.