Search in sources :

Example 16 with PersonLongAutoID

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

the class BaseTestNoAutoInc_7_BATCH method testGetByKeyLongAutoID.

public void testGetByKeyLongAutoID() {
    if (supportsAutoincrement()) {
        PersonLongAutoID curie = getByKeyPersonLongAutoID(LongAutoID_CURIE.id);
        assertEquals(LongAutoID_CURIE, curie);
    } else {
        try {
            PersonLongAutoID curie = getByKeyPersonLongAutoID(LongAutoID_CURIE.id);
        } catch (SienaRestrictedApiException ex) {
            return;
        }
        fail();
    }
}
Also used : SienaRestrictedApiException(siena.SienaRestrictedApiException) PersonLongAutoID(siena.base.test.model.PersonLongAutoID)

Example 17 with PersonLongAutoID

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

the class BaseTestNoAutoInc_7_BATCH method testGetByKeyNonExisting.

public void testGetByKeyNonExisting() {
    if (supportsAutoincrement()) {
        PersonLongAutoID pers = getByKeyPersonLongAutoID(12345678L);
        assertNull(pers);
    } else {
        try {
            PersonLongAutoID pers = getByKeyPersonLongAutoID(12345678L);
        } catch (SienaRestrictedApiException ex) {
            return;
        }
        fail();
    }
}
Also used : SienaRestrictedApiException(siena.SienaRestrictedApiException) PersonLongAutoID(siena.base.test.model.PersonLongAutoID)

Example 18 with PersonLongAutoID

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

the class BaseTestNoAutoInc_BASE method getPersonLongAutoID.

protected PersonLongAutoID getPersonLongAutoID(Long id) {
    PersonLongAutoID p = new PersonLongAutoID();
    p.id = id;
    pm.get(p);
    return p;
}
Also used : PersonLongAutoID(siena.base.test.model.PersonLongAutoID)

Example 19 with PersonLongAutoID

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

the class BaseTestNoAutoInc_DEFAULT method testInsertLongAutoID.

public void testInsertLongAutoID() {
    PersonLongAutoID maxwell = new PersonLongAutoID();
    maxwell.firstName = "James Clerk";
    maxwell.lastName = "Maxwell";
    maxwell.city = "Edinburgh";
    maxwell.n = 4;
    pm.insert(maxwell);
    assertNotNull(maxwell.id);
    List<PersonLongAutoID> people = queryPersonLongAutoIDOrderBy("n", 0, false).fetch();
    assertEquals(4, people.size());
    assertEquals(LongAutoID_TESLA, people.get(0));
    assertEquals(LongAutoID_CURIE, people.get(1));
    assertEquals(LongAutoID_EINSTEIN, people.get(2));
    assertEquals(maxwell, people.get(3));
}
Also used : PersonLongAutoID(siena.base.test.model.PersonLongAutoID)

Example 20 with PersonLongAutoID

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

the class BaseTestNoAutoInc_DEFAULT method testUpdateLongAutoID.

public void testUpdateLongAutoID() {
    PersonLongAutoID curie = getPersonLongAutoID(LongAutoID_CURIE.id);
    curie.lastName = "Sklodowska–Curie";
    pm.update(curie);
    PersonLongAutoID curie2 = getPersonLongAutoID(LongAutoID_CURIE.id);
    assertEquals(curie2, curie);
}
Also used : PersonLongAutoID(siena.base.test.model.PersonLongAutoID)

Aggregations

PersonLongAutoID (siena.base.test.model.PersonLongAutoID)47 SienaRestrictedApiException (siena.SienaRestrictedApiException)11 ArrayList (java.util.ArrayList)3 List (java.util.List)3 QueryFilter (siena.QueryFilter)2 QueryOption (siena.core.options.QueryOption)2 QueryOptionPage (siena.core.options.QueryOptionPage)2 Json (siena.Json)1 QueryFilterSearch (siena.QueryFilterSearch)1 QueryFilterSimple (siena.QueryFilterSimple)1 QueryOrder (siena.QueryOrder)1