Search in sources :

Example 6 with SienaRestrictedApiException

use of siena.SienaRestrictedApiException in project siena by mandubian.

the class BaseTestNoAutoInc_1_CRUD method testInsertLongAutoID.

public void testInsertLongAutoID() {
    if (supportsAutoincrement()) {
        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));
    } else {
        try {
            PersonLongAutoID maxwell = new PersonLongAutoID();
            maxwell.firstName = "James Clerk";
            maxwell.lastName = "Maxwell";
            maxwell.city = "Edinburgh";
            maxwell.n = 4;
            pm.insert(maxwell);
        } catch (SienaRestrictedApiException ex) {
            return;
        }
        fail();
    }
}
Also used : SienaRestrictedApiException(siena.SienaRestrictedApiException) PersonLongAutoID(siena.base.test.model.PersonLongAutoID)

Example 7 with SienaRestrictedApiException

use of siena.SienaRestrictedApiException in project siena by mandubian.

the class BaseTestNoAutoInc_1_CRUD method testUpdateLongAutoID.

public void testUpdateLongAutoID() {
    if (supportsAutoincrement()) {
        PersonLongAutoID curie = getPersonLongAutoID(LongAutoID_CURIE.id);
        curie.lastName = "Sklodowska–Curie";
        pm.update(curie);
        PersonLongAutoID curie2 = getPersonLongAutoID(LongAutoID_CURIE.id);
        assertEquals(curie2, curie);
    } else {
        try {
            PersonLongAutoID curie = getPersonLongAutoID(LongAutoID_CURIE.id);
        } catch (SienaRestrictedApiException ex) {
            return;
        }
        fail();
    }
}
Also used : SienaRestrictedApiException(siena.SienaRestrictedApiException) PersonLongAutoID(siena.base.test.model.PersonLongAutoID)

Example 8 with SienaRestrictedApiException

use of siena.SienaRestrictedApiException in project siena by mandubian.

the class BaseTestNoAutoInc_1_CRUD method testGetLongAutoID.

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

Example 9 with SienaRestrictedApiException

use of siena.SienaRestrictedApiException in project siena by mandubian.

the class BaseTestNoAutoInc_3_ITER method testIterLimitLongAutoID.

public void testIterLimitLongAutoID() {
    if (supportsAutoincrement()) {
        Iterable<PersonLongAutoID> people = pm.createQuery(PersonLongAutoID.class).order("n").iter(2);
        assertNotNull(people);
        PersonLongAutoID[] array = new PersonLongAutoID[] { LongAutoID_TESLA, LongAutoID_CURIE };
        int i = 0;
        for (PersonLongAutoID person : people) {
            assertEquals(array[i], person);
            i++;
        }
    } else {
        try {
            Iterable<PersonLongAutoID> people = pm.createQuery(PersonLongAutoID.class).order("n").iter(2);
        } catch (SienaRestrictedApiException ex) {
            return;
        }
        fail();
    }
}
Also used : SienaRestrictedApiException(siena.SienaRestrictedApiException) PersonLongAutoID(siena.base.test.model.PersonLongAutoID)

Example 10 with SienaRestrictedApiException

use of siena.SienaRestrictedApiException in project siena by mandubian.

the class BaseTestNoAutoInc_3_ITER method testIterFullLongAutoID.

public void testIterFullLongAutoID() {
    if (supportsAutoincrement()) {
        Iterable<PersonLongAutoID> people = pm.createQuery(PersonLongAutoID.class).order("n").iter();
        assertNotNull(people);
        PersonLongAutoID[] array = new PersonLongAutoID[] { LongAutoID_TESLA, LongAutoID_CURIE, LongAutoID_EINSTEIN };
        int i = 0;
        for (PersonLongAutoID person : people) {
            assertEquals(array[i], person);
            i++;
        }
    } else {
        try {
            Iterable<PersonLongAutoID> people = pm.createQuery(PersonLongAutoID.class).order("n").iter();
        } catch (SienaRestrictedApiException ex) {
            return;
        }
        fail();
    }
}
Also used : SienaRestrictedApiException(siena.SienaRestrictedApiException) PersonLongAutoID(siena.base.test.model.PersonLongAutoID)

Aggregations

SienaRestrictedApiException (siena.SienaRestrictedApiException)23 PersonLongAutoID (siena.base.test.model.PersonLongAutoID)11 SienaException (siena.SienaException)6 Id (siena.Id)5 Field (java.lang.reflect.Field)4 Entity (com.google.appengine.api.datastore.Entity)2 Date (java.util.Date)2 DateTime (siena.DateTime)2 Json (siena.Json)2 SimpleDate (siena.SimpleDate)2 Discovery4Search (siena.base.test.model.Discovery4Search)2 DecimalPrecision (siena.core.DecimalPrecision)2 Polymorphic (siena.core.Polymorphic)2 Embedded (siena.embed.Embedded)2 Key (com.google.appengine.api.datastore.Key)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 IOException (java.io.IOException)1 StringReader (java.io.StringReader)1 BigDecimal (java.math.BigDecimal)1 SQLException (java.sql.SQLException)1