Search in sources :

Example 1 with GrowthList

use of org.apache.commons.collections.list.GrowthList in project gradle by gradle.

the class TestTest method method.

public void method() {
    FilenameUtils.separatorsToUnix("my/unix/filename");
    ToStringBuilder.reflectionToString(new Person("name"));
    new GrowthList();
    // compile with api-spi, runtime with api
    new PersonList().doSomethingWithImpl();
}
Also used : PersonList(org.gradle.api.PersonList) GrowthList(org.apache.commons.collections.list.GrowthList) Person(org.gradle.shared.Person)

Example 2 with GrowthList

use of org.apache.commons.collections.list.GrowthList in project gradle by gradle.

the class PersonIntegrationTest method canConstructAPersonWithAName.

@Test
public void canConstructAPersonWithAName() {
    // check our classpath
    List list = new GrowthList();
    // check Jar exists
    File jarFile = new File(System.getProperty("jar.path"));
    assertTrue(jarFile.isFile());
    Person person = PersonTestFixture.create("Larry");
    assertEquals("Larry", person.getName());
}
Also used : List(java.util.List) GrowthList(org.apache.commons.collections.list.GrowthList) GrowthList(org.apache.commons.collections.list.GrowthList) File(java.io.File) Test(org.junit.Test)

Example 3 with GrowthList

use of org.apache.commons.collections.list.GrowthList in project simplejpa by appoxy.

the class LazyList method loadAtleastItems.

private synchronized void loadAtleastItems(int index) {
    if ((backingList != null && nextToken == null) || (!noLimit() && index >= maxResults)) {
        return;
    }
    if (backingList == null) {
        backingList = new GrowthList();
    }
    while (backingList.size() <= index) {
        SelectResult qr;
        try {
            if (logger.isLoggable(Level.FINER))
                logger.finer("query for lazylist=" + origQuery);
            int limit = maxResults - backingList.size();
            String limitQuery = realQuery + " limit " + (noLimit() ? maxResultsPerToken : Math.min(maxResultsPerToken, limit));
            if (em.getFactory().isPrintQueries())
                System.out.println("query in lazylist=" + limitQuery);
            qr = DomainHelper.selectItems(this.em.getSimpleDb(), limitQuery, nextToken, isConsistentRead());
            if (logger.isLoggable(Level.FINER))
                logger.finer("got items for lazylist=" + qr.getItems().size());
            for (Item item : qr.getItems()) {
                backingList.add((E) em.buildObject(genericReturnType, item.getName(), item.getAttributes()));
            }
            if (qr.getNextToken() == null || (!noLimit() && qr.getItems().size() == limit)) {
                nextToken = null;
                break;
            }
            if (!noLimit() && qr.getItems().size() > limit) {
                throw new PersistenceException("Got more results than the limit.");
            }
            nextToken = qr.getNextToken();
        } catch (AmazonClientException e) {
            throw new PersistenceException("Query failed: Domain=" + domainName + " -> " + origQuery, e);
        }
    }
}
Also used : SelectResult(com.amazonaws.services.simpledb.model.SelectResult) Item(com.amazonaws.services.simpledb.model.Item) AmazonClientException(com.amazonaws.AmazonClientException) PersistenceException(javax.persistence.PersistenceException) GrowthList(org.apache.commons.collections.list.GrowthList)

Aggregations

GrowthList (org.apache.commons.collections.list.GrowthList)3 AmazonClientException (com.amazonaws.AmazonClientException)1 Item (com.amazonaws.services.simpledb.model.Item)1 SelectResult (com.amazonaws.services.simpledb.model.SelectResult)1 File (java.io.File)1 List (java.util.List)1 PersistenceException (javax.persistence.PersistenceException)1 PersonList (org.gradle.api.PersonList)1 Person (org.gradle.shared.Person)1 Test (org.junit.Test)1