use of org.infinispan.query.dsl.embedded.testdomain.Transaction in project infinispan by infinispan.
the class EmbeddedRemoteInteropQueryTest method testDuplicateBooleanProjectionRemote.
public void testDuplicateBooleanProjectionRemote() {
Transaction transaction = new TransactionHS();
transaction.setId(3);
transaction.setDescription("Hotel");
transaction.setAccountId(2);
transaction.setAmount(45);
transaction.setDate(new Date(42));
transaction.setDebit(true);
transaction.setValid(true);
cache.put(transaction.getId(), transaction);
QueryFactory qf = Search.getQueryFactory(remoteCache);
Query<Object[]> q = qf.create("SELECT id, isDebit, isDebit FROM sample_bank_account.Transaction WHERE description = 'Hotel'");
List<Object[]> list = q.execute().list();
assertEquals(1, list.size());
assertEquals(3, list.get(0).length);
assertEquals(3, list.get(0)[0]);
assertEquals(true, list.get(0)[1]);
assertEquals(true, list.get(0)[2]);
}
use of org.infinispan.query.dsl.embedded.testdomain.Transaction in project infinispan by infinispan.
the class EmbeddedRemoteInteropQueryTest method testRemoteFullTextQuery.
public void testRemoteFullTextQuery() {
Transaction transaction = new TransactionHS();
transaction.setId(3);
transaction.setDescription("Hotel");
transaction.setLongDescription("Expenses for Infinispan F2F meeting");
transaction.setAccountId(2);
transaction.setAmount(99);
transaction.setDate(new Date(42));
transaction.setDebit(true);
transaction.setValid(true);
cache.put(transaction.getId(), transaction);
QueryFactory qf = Search.getQueryFactory(remoteCache);
// Hibernate Search 6 does not support fields that are sortable and full text at the same time
Query<Transaction> q = qf.create("from sample_bank_account.Transaction where longDescription='Expenses for Infinispan F2F meeting'");
List<Transaction> list = q.execute().list();
assertEquals(1, list.size());
}
use of org.infinispan.query.dsl.embedded.testdomain.Transaction in project infinispan by infinispan.
the class EmbeddedRemoteInteropQueryTest method testDuplicateBooleanProjectionEmbedded.
public void testDuplicateBooleanProjectionEmbedded() {
Transaction transaction = new TransactionHS();
transaction.setId(3);
transaction.setDescription("Hotel");
transaction.setAccountId(2);
transaction.setAmount(45);
transaction.setDate(new Date(42));
transaction.setDebit(true);
transaction.setValid(true);
cache.put(transaction.getId(), transaction);
QueryFactory qf = org.infinispan.query.Search.getQueryFactory(cache);
Query<Object[]> q = qf.create("SELECT id, isDebit, isDebit FROM " + TransactionHS.class.getName() + " WHERE description = 'Hotel'");
List<Object[]> list = q.execute().list();
assertEquals(1, list.size());
assertEquals(3, list.get(0).length);
assertEquals(3, list.get(0)[0]);
assertEquals(true, list.get(0)[1]);
assertEquals(true, list.get(0)[2]);
}
use of org.infinispan.query.dsl.embedded.testdomain.Transaction in project infinispan by infinispan.
the class QueryDslConditionsTest method testGt.
public void testGt() {
QueryFactory qf = getQueryFactory();
// all the transactions greater than a given amount
Query q = qf.from(getModelFactory().getTransactionImplClass()).having("amount").gt(1500).build();
List<Transaction> list = q.list();
assertEquals(1, list.size());
assertTrue(list.get(0).getAmount() > 1500);
}
use of org.infinispan.query.dsl.embedded.testdomain.Transaction in project infinispan by infinispan.
the class QueryDslConditionsTest method testLte.
public void testLte() {
QueryFactory qf = getQueryFactory();
Query q = qf.from(getModelFactory().getTransactionImplClass()).having("amount").lte(1500).build();
List<Transaction> list = q.list();
assertEquals(55, list.size());
for (Transaction t : list) {
assertTrue(t.getAmount() <= 1500);
}
}
Aggregations