use of com.cinchapi.concourse.thrift.Operator in project concourse by cinchapi.
the class ConcourseCompilerTest method testGroupAnd.
@Test
public void testGroupAnd() {
String key0 = TestData.getString();
Operator operator0 = Operator.EQUALS;
Object value0 = TestData.getObject();
String key1 = TestData.getString();
Operator operator1 = Operator.GREATER_THAN;
Object value1 = TestData.getObject();
Criteria criteria = Criteria.where().key(key0).operator(operator0).value(value0).and().key(key1).operator(operator1).value(value1).build();
List<Symbol> symbols = Parsing.groupExpressions(criteria.symbols());
ExpressionSymbol exp0 = (ExpressionSymbol) symbols.get(0);
ConjunctionSymbol sym = (ConjunctionSymbol) symbols.get(1);
ExpressionSymbol exp1 = (ExpressionSymbol) symbols.get(2);
Assert.assertEquals(3, symbols.size());
Assert.assertEquals(exp0.raw().key(), key0);
Assert.assertEquals(exp0.raw().operator(), operator0);
Assert.assertEquals(exp0.values().get(0).value(), value0);
Assert.assertEquals(sym, ConjunctionSymbol.AND);
Assert.assertEquals(exp1.raw().key(), key1);
Assert.assertEquals(exp1.raw().operator(), operator1);
Assert.assertEquals(exp1.values().get(0).value(), value1);
}
use of com.cinchapi.concourse.thrift.Operator in project concourse by cinchapi.
the class QueryOnRecordIdTest method testQueryOnRecordIdNonEqualOrNonEqualsOperator.
@Test(expected = Exception.class)
public void testQueryOnRecordIdNonEqualOrNonEqualsOperator() {
Operator operator = Operator.GREATER_THAN;
client.find(Criteria.where().key(Constants.JSON_RESERVED_IDENTIFIER_NAME).operator(operator).value(55).build());
}
use of com.cinchapi.concourse.thrift.Operator in project concourse by cinchapi.
the class ConcourseServer method findKeyOperatorValuesOrder.
@Override
@TranslateClientExceptions
@VerifyAccessToken
@VerifyReadPermission
public Set<Long> findKeyOperatorValuesOrder(String key, Operator operator, List<TObject> values, TOrder order, AccessToken creds, TransactionToken transaction, String environment) throws TException {
TObject[] tValues = values.toArray(Array.containing());
AtomicSupport store = getStore(transaction, environment);
Function<Store, SortableSet<Set<TObject>>> function = $store -> {
SortableSet<Set<TObject>> $records = SortableSet.of(Stores.find($store, key, operator, tValues));
$records.sort(Sorting.byValues(Orders.from(order), store));
return $records;
};
SortableSet<Set<TObject>> records = null;
boolean isAtomic = order != NO_ORDER;
while (records == null) {
try {
if (isAtomic) {
records = AtomicOperations.<SortableSet<Set<TObject>>>supplyWithRetry(store, atomic -> function.apply(atomic));
} else {
records = function.apply(store);
}
} catch (InsufficientAtomicityException e) {
isAtomic = true;
}
}
return records;
}
Aggregations