Examples of Flight


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

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

    beginTxn();
    Flight f = pm.getObjectById(Flight.class, key.getId());
    f.setId(KeyFactory.keyToString(KeyFactory.createKey(key.getKind(), "jimmy")));
    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_NullKey() {
    Key key = ds.put(Flight.newFlightEntity("name", "bos", "mia", 3, 4, 44));

    beginTxn();
    Flight f = pm.getObjectById(Flight.class, key.getId());
    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

import com.google.appengine.datanucleus.test.jdo.Flight;

public class Issue256Test extends JPATestCase {
  public void testRun() {
    beginTxn();
    Flight fl = new Flight("CHI", "LHR", "BA201", 1, 16);
    em.persist(fl);
    commitTxn();
    em.clear();

    beginTxn();
View Full Code Here

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

    EasyMock.expect(mockTxn.isActive()).andReturn(true).anyTimes();
    EasyMock.expect(mockTxn.getApp()).andReturn("test").anyTimes();
    mockTxn.commit();
    EasyMock.replay(mockDatastoreService, mockTxn);

    Flight f1 = new Flight();
    f1.setName("Harold");
    f1.setOrigin("BOS");
    f1.setDest("MIA");
    f1.setYou(1);
    f1.setMe(2);

    Transaction txn = pm.currentTransaction();
    txn.setNontransactionalWrite(nonTransactionalWrite);
    if (explicitDemarcation) {
      txn.begin();
View Full Code Here

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

    txn.setNontransactionalWrite(nonTransactionalWrite);
    if (explicitDemarcation) {
      txn.begin();
    }
    try {
      Flight f1 = pm.getObjectById(Flight.class, KeyFactory.keyToString(flightEntity.getKey()));
      f1.setYou(88);
    } finally {
      if (explicitDemarcation) {
        txn.commit();
      }
      pm.close();
View Full Code Here

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

  private void testWritePermutationWithoutExpectedDatastoreTxn(
      PersistenceManager pm, boolean explicitDemarcation, boolean nonTransactionalOpAllowed) {
    EasyMock.expect(mockDatastoreService.put(EasyMock.isA(Entity.class))).andReturn(null);
    EasyMock.replay(mockDatastoreService, mockTxn);

    Flight f1 = new Flight();
    f1.setName("Harold");
    f1.setOrigin("BOS");
    f1.setDest("MIA");
    f1.setYou(1);
    f1.setMe(2);

    Transaction txn = pm.currentTransaction();
    txn.setNontransactionalWrite(nonTransactionalOpAllowed);
    txn.setNontransactionalRead(nonTransactionalOpAllowed);
    if (explicitDemarcation) {
View Full Code Here

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

    txn.setNontransactionalRead(nonTransactionalOp);
    if (explicitDemarcation) {
      txn.begin();
    }
    try {
      Flight f1 = pm.getObjectById(Flight.class, KeyFactory.keyToString(flightEntity.getKey()));
      f1.setYou(88);
    } finally {
      if (explicitDemarcation) {
        txn.commit();
      }
      pm.close();
View Full Code Here

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

  private void testIllegalWritePermutation(
      PersistenceManager pm, boolean explicitDemarcation, boolean nonTransactionalWrite) {

    EasyMock.replay(mockDatastoreService, mockTxn);

    Flight f1 = new Flight();
    f1.setName("Harold");
    f1.setOrigin("BOS");
    f1.setDest("MIA");
    f1.setYou(1);
    f1.setMe(2);

    Transaction txn = pm.currentTransaction();
    txn.setNontransactionalWrite(nonTransactionalWrite);
    if (explicitDemarcation) {
      txn.begin();
View Full Code Here

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

    switchDatasource(PersistenceManagerFactoryName.nontransactional);
    getExecutionContext().setProperty(PROP_DETACH_ON_CLOSE, true);
    testInsert_NewParentAndChild(NEW_PM_START_END);
  }
  private void testInsert_NewParentAndChild(StartEnd startEnd) throws EntityNotFoundException {
    Flight f = newFlight();
    HasKeyPkJDO hasKeyPk = new HasKeyPkJDO();
    HasOneToOneParentJDO hasParent = new HasOneToOneParentJDO();
    HasOneToOneParentKeyPkJDO hasParentKeyPk = new HasOneToOneParentKeyPkJDO();
    HasEncodedStringPkJDO notDependent = new HasEncodedStringPkJDO();

    HasOneToOneJDO pojo = new HasOneToOneJDO();
    pojo.setFlight(f);
    pojo.setHasKeyPK(hasKeyPk);
    pojo.setHasParent(hasParent);
    hasParent.setParent(pojo);
    pojo.setHasParentKeyPK(hasParentKeyPk);
    hasParentKeyPk.setParent(pojo);
    pojo.setNotDependent(notDependent);

    makePersistentInTxn(pojo, startEnd);

    assertNotNull(f.getId());
    assertNotNull(hasKeyPk.getKey());
    assertNotNull(hasParent.getKey());
    assertNotNull(hasParentKeyPk.getKey());
    assertNotNull(notDependent.getId());
    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.getId(), flightEntity, f.getId());

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

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

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

    startEnd.start();
    pm.makePersistent(f);
    startEnd.end();
    startEnd.start();
    pm.makePersistent(hasKeyPk);
    startEnd.end();
    startEnd.start();
    pm.makePersistent(hasParent);
    startEnd.end();
    startEnd.start();
    pm.makePersistent(hasParentKeyPk);
    startEnd.end();
    assertNotNull(f.getId());
    assertNotNull(hasKeyPk.getKey());
    assertNotNull(hasParent.getKey());
    assertNotNull(hasParentKeyPk.getKey());

    HasOneToOneJDO pojo = new HasOneToOneJDO();
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.