@Test public void updateEntity_entityStored_shouldUpdateEntity() throws EntityNotFoundException { Entity sentEntity = createEntityInDatastore(KIND_NAME, PROPERTY_NAME, A_NAME); Long entityId = sentEntity.getKey().getId(); sentEntity.setProperty(PROPERTY_NAME, ANOTHER_NAME); entityService.updateEntity(sentEntity); Entity savedEntity = getEntityFromEntityResource(entityId); assertEquals(ANOTHER_NAME, savedEntity.getProperty(PROPERTY_NAME)); }
@Override public Entity updateEntity(Entity entity) throws EntityNotFoundException { AppEngineHelper.disableApiHooks(); entity.getKey(); DatastoreService datastore = DatastoreServiceFactory.getDatastoreService(); datastore.put(entity); return datastore.get(entity.getKey()); }
EntityServiceImpl implements EntityService { @Override public Entity updateEntity(Entity entity) throws EntityNotFoundException { AppEngineHelper.disableApiHooks(); entity.getKey(); DatastoreService datastore = DatastoreServiceFactory.getDatastoreService(); datastore.put(entity); return datastore.get(entity.getKey()); } }
EntityServiceImpl implements EntityService { @Override public Entity updateEntity(Entity entity) throws EntityNotFoundException { AppEngineHelper.disableApiHooks(); entity.getKey(); DatastoreService datastore = DatastoreServiceFactory.getDatastoreService(); datastore.put(entity); return datastore.get(entity.getKey()); } @Inject  EntityServiceImpl(
            DatastoreHelper datastoreHelper); }
EntityServiceImpl implements EntityService { @Override public Entity updateEntity(Entity entity) throws EntityNotFoundException { AppEngineHelper.disableApiHooks(); entity.getKey(); DatastoreService datastore = DatastoreServiceFactory.getDatastoreService(); datastore.put(entity); return datastore.get(entity.getKey()); } @Inject  EntityServiceImpl(
            DatastoreHelper datastoreHelper); @Override Entity getEntity(String encodedKey); @Override Entity updateEntity(Entity entity); @Override void deleteEntity(Key entityKey); }
EntityServiceImpl implements EntityService { @Override public Entity updateEntity(Entity entity) throws EntityNotFoundException { AppEngineHelper.disableApiHooks(); entity.getKey(); DatastoreService datastore = DatastoreServiceFactory.getDatastoreService(); datastore.put(entity); return datastore.get(entity.getKey()); } @Inject  EntityServiceImpl(
            DatastoreHelper datastoreHelper); @Override Entity getEntity(String encodedKey); @Override Entity updateEntity(Entity entity); @Override void deleteEntity(Key entityKey);  }