// DatastoreService mock
pmf.close();
tearDown();
DatastoreService mockDatastore = EasyMock.createMock(DatastoreService.class);
DatastoreServiceFactoryInternal.setDatastoreService(mockDatastore);
Transaction txn;
try {
setUp();
Entity pojoEntity = new Entity(HasOneToOneJDO.class.getSimpleName());
ds.put(pojoEntity);
Entity flightEntity = Flight.newFlightEntity(
pojoEntity.getKey(), null, "jimmy", "bos", "mia", 5, 4, 33);
ds.put(flightEntity);
Entity hasKeyPkEntity = new Entity(HasKeyPkJDO.class.getSimpleName(), pojoEntity.getKey());
hasKeyPkEntity.setProperty("str", "yar");
ds.put(hasKeyPkEntity);
Entity hasParentEntity =
new Entity(HasOneToOneParentJDO.class.getSimpleName(), pojoEntity.getKey());
hasParentEntity.setProperty("str", "yap");
ds.put(hasParentEntity);
Entity hasParentKeyPkEntity =
new Entity(HasOneToOneParentKeyPkJDO.class.getSimpleName(), pojoEntity.getKey());
hasParentKeyPkEntity.setProperty("str", "yag");
ds.put(hasParentKeyPkEntity);
// the only get we're going to perform is for the pojo
txn = EasyMock.createMock(Transaction.class);
EasyMock.expect(txn.getId()).andReturn("1").times(2);
txn.commit();
EasyMock.expectLastCall();
EasyMock.replay(txn);
EasyMock.expect(mockDatastore.beginTransaction(EasyMock.isA(TransactionOptions.class))).andReturn(txn);
EasyMock.expect(mockDatastore.get(txn, pojoEntity.getKey())).andReturn(pojoEntity);
EasyMock.replay(mockDatastore);