use of com.google.cloud.datastore.Entity in project jetty.project by eclipse.
the class GCloudSessionTestSupport method listSessions.
public void listSessions() throws Exception {
GqlQuery.Builder builder = Query.gqlQueryBuilder(ResultType.ENTITY, "select * from " + GCloudSessionDataStore.EntityDataModel.KIND);
Query<Entity> query = builder.build();
QueryResults<Entity> results = _ds.run(query);
assertNotNull(results);
System.err.println("SESSIONS::::::::");
while (results.hasNext()) {
Entity e = results.next();
System.err.println(e.getString("clusterId") + " expires at " + e.getLong("expiry"));
}
System.err.println("END OF SESSIONS::::::::");
}
use of com.google.cloud.datastore.Entity in project google-cloud-java by GoogleCloudPlatform.
the class ITDatastoreSnippets method testEntityAddGet.
@Test
public void testEntityAddGet() {
String key = registerKey("my_single_key_add");
datastoreSnippets.addSingleEntity(key);
Entity entity = datastoreSnippets.getEntityWithKey(key);
assertEquals("value", entity.getString("propertyName"));
}
use of com.google.cloud.datastore.Entity in project google-cloud-java by GoogleCloudPlatform.
the class ITDatastoreSnippets method addEntity.
private void addEntity(String keyName, String keyClass, String property, String value) {
Key key = datastore.newKeyFactory().setKind(keyClass).newKey(keyName);
Entity.Builder entityBuilder = Entity.newBuilder(key);
entityBuilder.set(property, value);
Entity entity = entityBuilder.build();
datastore.put(entity);
}
use of com.google.cloud.datastore.Entity in project google-cloud-java by GoogleCloudPlatform.
the class ITDatastoreSnippets method testEntityPutGet.
@Test
public void testEntityPutGet() {
String key = registerKey("my_single_key_put");
datastoreSnippets.putSingleEntity(key);
Entity entity = datastoreSnippets.getEntityWithKey(key);
assertEquals("value", entity.getString("propertyName"));
}
use of com.google.cloud.datastore.Entity in project google-cloud-java by GoogleCloudPlatform.
the class ITTransactionSnippets method testIsActive.
@Test
public void testIsActive() {
Transaction transaction = datastore.newTransaction();
TransactionSnippets transactionSnippets = new TransactionSnippets(transaction);
Key key = transactionSnippets.isActive();
Entity result = datastore.get(key);
assertNotNull(result);
datastore.delete(key);
}
Aggregations