Search in sources :

Example 31 with PersonUUID

use of siena.base.test.model.PersonUUID in project siena by mandubian.

the class BaseTestNoAutoInc_DEFAULT method testDeleteObjectNotFound.

public void testDeleteObjectNotFound() {
    try {
        PersonUUID p = new PersonUUID();
        pm.delete(p);
        fail();
    } catch (Exception e) {
        System.out.println("Everything is OK");
    }
}
Also used : PersonUUID(siena.base.test.model.PersonUUID) SienaRestrictedApiException(siena.SienaRestrictedApiException)

Example 32 with PersonUUID

use of siena.base.test.model.PersonUUID in project siena by mandubian.

the class BaseTestNoAutoInc_DEFAULT method testDeleteUUID.

public void testDeleteUUID() {
    PersonUUID curie = getPersonUUID(UUID_CURIE.id);
    pm.delete(curie);
    List<PersonUUID> people = queryPersonUUIDOrderBy("n", 0, false).fetch();
    assertNotNull(people);
    assertEquals(2, people.size());
    assertEquals(UUID_TESLA, people.get(0));
    assertEquals(UUID_EINSTEIN, people.get(1));
}
Also used : PersonUUID(siena.base.test.model.PersonUUID)

Example 33 with PersonUUID

use of siena.base.test.model.PersonUUID in project siena by mandubian.

the class BaseTestNoAutoInc_DEFAULT method testUpdateUUID.

public void testUpdateUUID() {
    PersonUUID curie = getPersonUUID(UUID_CURIE.id);
    curie.lastName = "Sklodowska–Curie";
    pm.update(curie);
    PersonUUID curie2 = getPersonUUID(UUID_CURIE.id);
    assertEquals(curie2, curie);
}
Also used : PersonUUID(siena.base.test.model.PersonUUID)

Example 34 with PersonUUID

use of siena.base.test.model.PersonUUID in project siena by mandubian.

the class GaeAsyncTest method testFilterWithOperatorINStateful.

public void testFilterWithOperatorINStateful() {
    List<PersonUUID> l = getOrderedPersonUUIDs();
    QueryAsync<PersonUUID> query = pm.createQuery(PersonUUID.class).filter("id IN", Arrays.asList(l.get(0).id, l.get(1).id)).stateful().paginate(1);
    SienaFuture<List<PersonUUID>> future = query.fetch();
    List<PersonUUID> people = future.get();
    QueryOptionGaeContext gaeCtx = (QueryOptionGaeContext) query.option(QueryOptionGaeContext.ID);
    assertFalse(gaeCtx.useCursor);
    assertNotNull(people);
    assertEquals(1, people.size());
    assertEquals(l.get(0), people.get(0));
    future = query.nextPage().fetch();
    people = future.get();
    gaeCtx = (QueryOptionGaeContext) query.option(QueryOptionGaeContext.ID);
    assertFalse(gaeCtx.useCursor);
    assertNotNull(people);
    assertEquals(1, people.size());
    assertEquals(l.get(1), people.get(0));
}
Also used : QueryOptionGaeContext(siena.gae.QueryOptionGaeContext) PersonUUID(siena.base.test.model.PersonUUID) List(java.util.List)

Example 35 with PersonUUID

use of siena.base.test.model.PersonUUID in project siena by mandubian.

the class BaseTestNoAutoInc_DEFAULT method testInsertUUID.

/*	@Deprecated
	public void testCountLimitOffset() {
		Query<PersonUUID> query = queryPersonUUIDOrderBy("n", 0, false);
		query.fetch(1);
		assertEquals(2, query.count(2, 1));
	}
*/
public void testInsertUUID() {
    PersonUUID maxwell = new PersonUUID();
    maxwell.firstName = "James Clerk";
    maxwell.lastName = "Maxwell";
    maxwell.city = "Edinburgh";
    maxwell.n = 4;
    pm.insert(maxwell);
    assertNotNull(maxwell.id);
    List<PersonUUID> people = queryPersonUUIDOrderBy("n", 0, false).fetch();
    assertEquals(4, people.size());
    assertEquals(UUID_TESLA, people.get(0));
    assertEquals(UUID_CURIE, people.get(1));
    assertEquals(UUID_EINSTEIN, people.get(2));
    assertEquals(maxwell, people.get(3));
}
Also used : PersonUUID(siena.base.test.model.PersonUUID)

Aggregations

PersonUUID (siena.base.test.model.PersonUUID)69 ArrayList (java.util.ArrayList)15 List (java.util.List)5 QueryOptionGaeContext (siena.gae.QueryOptionGaeContext)4 SienaException (siena.SienaException)2 SienaRestrictedApiException (siena.SienaRestrictedApiException)1