本文整理了Java中com.impetus.kundera.query.Query
类的一些代码示例,展示了Query
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query
类的具体详情如下:
包路径:com.impetus.kundera.query.Query
类名称:Query
[英]Query Interface, clients query class must implement these method in order to support pagination.
[中]查询接口,客户端查询类必须实现这些方法才能支持分页。
代码示例来源:origin: Impetus/Kundera
@Override
public Iterator<X> iterate()
{
return ((com.impetus.kundera.query.Query)query).iterate();
}
代码示例来源:origin: Impetus/Kundera
@Override
public void setFetchSize(Integer fetchsize)
{
((com.impetus.kundera.query.Query)query).setFetchSize(fetchsize);
}
代码示例来源:origin: Impetus/Kundera
@Override
public void close()
{
((com.impetus.kundera.query.Query)query).close();
}
代码示例来源:origin: Impetus/Kundera
@Test
public void chunkScrollTest() throws Exception
{
//without where clause
int chunkSize = 50;
Query query = (Query) em.createQuery("Select p from PersonHBase p", PersonHBase.class);
query.setFetchSize(1000);
Iterator<PersonHBase> iter = query.iterate();
IResultIterator<PersonHBase> iIter = (IResultIterator<PersonHBase>) iter;
assertScrolling(chunkSize, iIter);
//with where clause
String name = "vivek";
query = (Query) em.createQuery("Select p from PersonHBase p where p.personName = '"+name+"'", PersonHBase.class);
query.setFetchSize(1000);
iter = query.iterate();
iIter = (IResultIterator<PersonHBase>) iter;
assertScrolling(chunkSize, iIter);
}
代码示例来源:origin: Impetus/Kundera
Assert.assertEquals(FlushModeType.AUTO, FlushModeType.AUTO);
((Query) query).setFetchSize(100);
Assert.assertNotNull(((Query) query).getFetchSize());
Assert.assertEquals(100, ((Query) query).getFetchSize().intValue());
Assert.assertNull(((Query) query).iterate());
((Query) query).close();
代码示例来源:origin: Impetus/Kundera
@Override
public Integer getFetchSize()
{
return ((com.impetus.kundera.query.Query)query).getFetchSize();
}
代码示例来源:origin: Impetus/Kundera
@Override
public void applyTTL(int ttlInSeconds)
{
((com.impetus.kundera.query.Query)query).applyTTL(ttlInSeconds);
}
代码示例来源:origin: Impetus/Kundera
private void assertOnFetch(Query query, Integer fetchSize, int available)
{
query.setFetchSize(fetchSize);
int counter = 0;
Iterator<PersonMongo> iter = query.iterate();
while (iter.hasNext())
{
Assert.assertNotNull(iter.next());
counter++;
}
Assert.assertEquals(counter, fetchSize == null || available < fetchSize ? available : fetchSize);
try
{
iter.next();
Assert.fail();
}
catch (NoSuchElementException nsex)
{
Assert.assertNotNull(nsex.getMessage());
}
}
代码示例来源:origin: Impetus/Kundera
private void assertOnFetch(Query query, Integer fetchSize, int available)
{
query.setFetchSize(fetchSize);
int counter=0;
Iterator<PrimeUser> iter = query.iterate();
while (iter.hasNext())
{
Assert.assertNotNull(iter.next());
counter++;
}
Assert.assertEquals(counter, fetchSize != null && fetchSize == 0 ? 0:available);
try
{
iter.next();
Assert.fail();
}
catch (NoSuchElementException nsex)
{
Assert.assertNotNull(nsex.getMessage());
}
}
代码示例来源:origin: Impetus/Kundera
/**
* Assert book scrolling.
*
* @param queryClause
* the query clause
* @param expected
* the expected
* @return the list
*/
private List<Book> assertBookScrolling(String queryClause, int expected)
{
Query query = (Query) em.createQuery(queryClause, Book.class);
int count = 0;
Iterator<Book> bookItr = query.iterate();
List<Book> books = new ArrayList<Book>();
while (bookItr.hasNext())
{
Book book = bookItr.next();
Assert.assertNotNull(book);
count++;
books.add(book);
}
Assert.assertTrue(count > 0);
Assert.assertTrue(count == expected);
return books;
}
代码示例来源:origin: Impetus/Kundera
private void assertOnFetch(Query query, Integer fetchSize, int expectedCount)
{
query.setFetchSize(fetchSize);
int counter = 0;
Iterator<PersonCouchDB> iter = query.iterate();
while (iter.hasNext())
{
Assert.assertNotNull(iter.next());
counter++;
}
Assert.assertEquals(counter, fetchSize == null || expectedCount < fetchSize ? expectedCount : fetchSize);
try
{
iter.next();
Assert.fail();
}
catch (NoSuchElementException nsex)
{
Assert.assertNotNull(nsex.getMessage());
}
}
代码示例来源:origin: Impetus/Kundera
private void assertOnTokenScroll(String queryClause, int expected)
{
Query query = (Query) em.createQuery(queryClause, MongoToken.class);
int count = 0;
Iterator<MongoToken> tokens = query.iterate();
while (tokens.hasNext())
{
MongoToken token = tokens.next();
Assert.assertNotNull(token);
Assert.assertNotNull(token.getClient());
Assert.assertEquals(2, token.getClient().getTokens().size());
count++;
}
Assert.assertTrue(count > 0);
Assert.assertTrue(count == expected);
}
代码示例来源:origin: Impetus/Kundera
private void assertOnFetch(Query query, Integer fetchSize, int available)
{
query.setFetchSize(fetchSize);
int counter=0;
Iterator<CassandraPrimeUser> iter = query.iterate();
while (iter.hasNext())
{
Assert.assertNotNull(iter.next());
counter++;
}
Assert.assertEquals(counter, fetchSize == null || available < fetchSize?available:fetchSize);
try
{
iter.next();
Assert.fail();
}
catch (NoSuchElementException nsex)
{
Assert.assertNotNull(nsex.getMessage());
}
}
代码示例来源:origin: Impetus/Kundera
private void assertOnTokenScroll(String queryClause, int expected)
{
Query query = (Query) em.createQuery(queryClause, HbaseToken.class);
int count = 0;
Iterator<HbaseToken> tokens = query.iterate();
while (tokens.hasNext())
{
HbaseToken token = tokens.next();
Assert.assertNotNull(token);
Assert.assertNotNull(token.getClient());
Assert.assertEquals(2, token.getClient().getTokens().size());
count++;
}
Assert.assertTrue(count > 0);
Assert.assertTrue(count == expected);
}
代码示例来源:origin: Impetus/Kundera
private void assertOnFetch(Query query, Integer fetchSize, int available)
{
query.setFetchSize(fetchSize);
int counter = 0;
Iterator<PersonHBase> iter = query.iterate();
while (iter.hasNext())
{
Assert.assertNotNull(iter.next());
counter++;
}
Assert.assertEquals(counter, fetchSize == null || available < fetchSize ? available : fetchSize);
try
{
iter.next();
Assert.fail();
}
catch (NoSuchElementException nsex)
{
Assert.assertNotNull(nsex.getMessage());
}
}
代码示例来源:origin: Impetus/Kundera
private void assertOnTokenScroll(String queryClause, int expected)
{
Query query = (Query) em.createQuery(queryClause, CouchDBToken.class);
int count = 0;
Iterator<CouchDBToken> tokens = query.iterate();
while (tokens.hasNext())
{
CouchDBToken token = tokens.next();
Assert.assertNotNull(token);
Assert.assertNotNull(token.getClient());
Assert.assertEquals(2, token.getClient().getTokens().size());
count++;
}
Assert.assertTrue(count > 0);
Assert.assertTrue(count == expected);
}
代码示例来源:origin: Impetus/Kundera
private void assertOnFetch(Query query, Integer fetchSize, int available)
{
query.setFetchSize(fetchSize);
int counter = 0;
Iterator<PersonRDBMS> iter = query.iterate();
while (iter.hasNext())
{
Assert.assertNotNull(iter.next());
counter++;
}
Assert.assertEquals(counter, fetchSize == null || available < fetchSize ? available : fetchSize);
try
{
iter.next();
Assert.fail();
}
catch (NoSuchElementException nsex)
{
Assert.assertNotNull(nsex.getMessage());
}
}
代码示例来源:origin: Impetus/Kundera
private void assertOnTokenScroll(String queryClause, int expected)
{
Query query = (Query) em.createQuery(queryClause,
Token.class);
int count=0;
Iterator<Token> tokens = query.iterate();
while(tokens.hasNext())
{
Token token = tokens.next();
Assert.assertNotNull(token);
Assert.assertNotNull(token.getClient());
Assert.assertEquals(2, token.getClient().getTokens().size());
count++;
}
Assert.assertTrue(count > 0);
Assert.assertTrue(count == expected);
}
代码示例来源:origin: Impetus/Kundera
query.setFetchSize(fetchSize);
int counter = 0;
Iterator<Book> iter = query.iterate();
代码示例来源:origin: Impetus/Kundera
private void assertOnTokenScroll(String queryClause, int expected)
{
com.impetus.kundera.query.Query query = (com.impetus.kundera.query.Query) em.createQuery(queryClause,
Token.class);
int count=0;
Iterator<Token> tokens = query.iterate();
while(tokens.hasNext())
{
Token token = tokens.next();
Assert.assertNotNull(token);
Assert.assertNotNull(token.getClient());
Assert.assertEquals(2, token.getClient().getTokens().size());
count++;
}
Assert.assertTrue(count > 0);
Assert.assertTrue(count == expected);
}
内容来源于网络,如有侵权,请联系作者删除!