Search in sources :

Example 36 with PersonLongAutoID

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

the class BaseTestNoAutoInc_2_FETCH method testFilterOperatorEqualLongAutoID.

public void testFilterOperatorEqualLongAutoID() {
    if (supportsAutoincrement()) {
        PersonLongAutoID person = pm.createQuery(PersonLongAutoID.class).filter("id", LongAutoID_EINSTEIN.id).get();
        assertNotNull(person);
        assertEquals(LongAutoID_EINSTEIN, person);
    } else {
        try {
            PersonLongAutoID person = pm.createQuery(PersonLongAutoID.class).filter("id", LongAutoID_EINSTEIN.id).get();
        } catch (SienaRestrictedApiException ex) {
            return;
        }
        fail();
    }
}
Also used : SienaRestrictedApiException(siena.SienaRestrictedApiException) PersonLongAutoID(siena.base.test.model.PersonLongAutoID)

Example 37 with PersonLongAutoID

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

the class BaseTestNoAutoInc_2_FETCH method testOrderLongAutoId.

public void testOrderLongAutoId() {
    if (supportsAutoincrement()) {
        List<PersonLongAutoID> people = queryPersonLongAutoIDOrderBy("id", "", false).fetch();
        assertNotNull(people);
        assertEquals(3, people.size());
        PersonLongAutoID[] array = new PersonLongAutoID[] { LongAutoID_TESLA, LongAutoID_CURIE, LongAutoID_EINSTEIN };
        int i = 0;
        for (PersonLongAutoID person : people) {
            assertEquals(array[i], person);
            i++;
        }
    } else {
        try {
            List<PersonLongAutoID> people = queryPersonLongAutoIDOrderBy("id", "", false).fetch();
        } catch (SienaRestrictedApiException ex) {
            return;
        }
        fail();
    }
}
Also used : SienaRestrictedApiException(siena.SienaRestrictedApiException) PersonLongAutoID(siena.base.test.model.PersonLongAutoID)

Example 38 with PersonLongAutoID

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

the class BaseAsyncTest method testFilterOperatorEqualLongAutoID.

public void testFilterOperatorEqualLongAutoID() {
    SienaFuture<PersonLongAutoID> future = pm.createQuery(PersonLongAutoID.class).filter("id", LongAutoID_EINSTEIN.id).get();
    PersonLongAutoID person = future.get();
    assertNotNull(person);
    assertEquals(LongAutoID_EINSTEIN, person);
}
Also used : PersonLongAutoID(siena.base.test.model.PersonLongAutoID)

Example 39 with PersonLongAutoID

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

the class BaseAsyncTest 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).get();
    assertNotNull(maxwell.id);
    SienaFuture<List<PersonLongAutoID>> future = queryPersonLongAutoIDOrderBy("n", 0, false).fetch();
    List<PersonLongAutoID> people = future.get();
    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 : ArrayList(java.util.ArrayList) List(java.util.List) PersonLongAutoID(siena.base.test.model.PersonLongAutoID)

Example 40 with PersonLongAutoID

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

the class BaseAsyncTest method testSaveLongAutoID.

public void testSaveLongAutoID() {
    PersonLongAutoID maxwell = new PersonLongAutoID();
    maxwell.firstName = "James Clerk";
    maxwell.lastName = "Maxwell";
    maxwell.city = "Edinburgh";
    maxwell.n = 4;
    pm.save(maxwell).get();
    assertNotNull(maxwell.id);
    SienaFuture<List<PersonLongAutoID>> future = queryPersonLongAutoIDOrderBy("n", 0, false).fetch();
    List<PersonLongAutoID> people = future.get();
    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));
    maxwell.firstName = "James Clerk UPD";
    maxwell.lastName = "Maxwell UPD";
    maxwell.city = "Edinburgh UPD";
    maxwell.n = 5;
    pm.save(maxwell).get();
    assertNotNull(maxwell.id);
    future = queryPersonLongAutoIDOrderBy("n", 0, false).fetch();
    people = future.get();
    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 : ArrayList(java.util.ArrayList) List(java.util.List) 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