Package com.google.appengine.datanucleus.test.jdo

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);

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


    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 delete
    ds.delete(key);
    try {
      pm.deletePersistent(flight);
View Full Code Here

  public void testNonTransactionalDelete() 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));
    pm.deletePersistent(f);
    pm.close();
    try {
      ds.get(key);
      fail("expected enfe");
View Full Code Here

    commitTxn();
    beginTxn();
    e = Flight.newFlightEntity("name", "origin", "not null", 23, 24);
    ds.put(null, e);
    q.setUnique(true);
    Flight flight = (Flight) q.execute();
    assertEquals("not null", flight.getDest());
  }
View Full Code Here

    commitTxn();
    beginTxn();
    e = Flight.newFlightEntity("name", "origin", "not null", 23, 24);
    ds.put(null, e);
    q.setUnique(true);
    Flight flight = (Flight) q.execute((String) null);
    assertEquals("not null", flight.getDest());
  }
View Full Code Here

    commitTxn();
    beginTxn();
    e = Flight.newFlightEntity("name", "origin", "not mia", 23, 24);
    ds.put(null, e);
    q.setUnique(true);
    Flight flight = (Flight) q.execute();
    assertEquals("not mia", flight.getDest());
  }
View Full Code Here

    commitTxn();
    beginTxn();
    e = Flight.newFlightEntity("name", "origin", "not mia", 23, 24);
    ds.put(null, e);
    q.setUnique(true);
    Flight flight = (Flight) q.execute("mia");
    assertEquals("not mia", flight.getDest());
  }
View Full Code Here

    @SuppressWarnings("unchecked")
    List<String> ids = (List<String>) q.execute();
    assertEquals(2, ids.size());
    assertEquals(KeyFactory.keyToString(e1.getKey()), ids.get(0));
    assertEquals(KeyFactory.keyToString(e2.getKey()), ids.get(1));
    Flight f = pm.getObjectById(Flight.class, e1.getKey());
    assertEquals("jimmy", f.getName());
    f.setName("not jimmy");
    commitTxn();
    beginTxn();
    f = pm.getObjectById(Flight.class, e1.getKey());
    assertEquals("not jimmy", f.getName());
    commitTxn();
  }
View Full Code Here

    assertEquals(2, ids.get(1).length);
    assertEquals(KeyFactory.keyToString(e1.getKey()), ids.get(0)[0]);
    assertEquals(KeyFactory.keyToString(e1.getKey()), ids.get(0)[1]);
    assertEquals(KeyFactory.keyToString(e2.getKey()), ids.get(1)[0]);
    assertEquals(KeyFactory.keyToString(e2.getKey()), ids.get(1)[1]);
    Flight f = pm.getObjectById(Flight.class, e1.getKey());
    assertEquals("jimmy", f.getName());
    f.setName("not jimmy");
    commitTxn();
    beginTxn();
    f = pm.getObjectById(Flight.class, e1.getKey());
    assertEquals("not jimmy", f.getName());
    commitTxn();
  }
View Full Code Here

    @SuppressWarnings("unchecked")
    List<Object[]> results = (List<Object[]>) q.execute();
    assertEquals(1, results.size());
    assertEquals(2, results.get(0).length);
    assertEquals(KeyFactory.keyToString(e1.getKey()), results.get(0)[0]);
    Flight f = pm.getObjectById(Flight.class, e2.getKey());
    assertEquals(f, results.get(0)[1]);
  }
View Full Code Here

TOP

Related Classes of com.google.appengine.datanucleus.test.jdo.Flight

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.