use of com.cinchapi.concourse.thrift.TObject in project concourse by cinchapi.
the class StoreTest method addRecords.
/**
* Add {@code key} as a value that satisfies {@code operator} relative to
* {@code min}.
*
* @param key
* @param min
* @param operator
* @return the records added
*/
private Set<Long> addRecords(String key, Object min, Operator operator) {
Set<Long> records = getRecords();
int count = 0;
for (long record : records) {
Object n = null;
while (n == null || (operator == Operator.GREATER_THAN && Objects.isLessThanOrEqualTo(n, min)) || (operator == Operator.GREATER_THAN_OR_EQUALS && Objects.isLessThan(n, min)) || (operator == Operator.LESS_THAN && Objects.isGreaterThanOrEqualTo(n, min)) || (operator == Operator.LESS_THAN_OR_EQUALS && Objects.isGreaterThan(n, min)) || (operator == Operator.NOT_EQUALS && Objects.isEqualTo(n, min)) || (operator == Operator.EQUALS && !Objects.isEqualTo(n, min))) {
n = operator == Operator.EQUALS ? min : TestData.getObject();
}
TObject value = Convert.javaToThrift(n);
add(key, value, record);
Variables.register(operator + "_write_" + count, key + " AS " + value + " IN " + record);
count++;
}
return records;
}
use of com.cinchapi.concourse.thrift.TObject in project concourse by cinchapi.
the class StoreTest method testFetchAfterAddMulti.
@Test
public void testFetchAfterAddMulti() {
String key = TestData.getSimpleString();
long record = TestData.getLong();
Set<TObject> values = getValues();
for (TObject value : values) {
add(key, value, record);
}
Assert.assertEquals(values, store.select(key, record));
}
use of com.cinchapi.concourse.thrift.TObject in project concourse by cinchapi.
the class StoreTest method testBrowseRecordWithTime.
@Test
public void testBrowseRecordWithTime() {
Multimap<String, TObject> data = Variables.register("data", HashMultimap.<String, TObject>create());
long record = TestData.getLong();
for (String key : getKeys()) {
for (int i = 0; i < TestData.getScaleCount() % 4; i++) {
TObject value = TestData.getTObject();
if (!data.containsEntry(key, value)) {
data.put(key, value);
add(key, value, record);
}
}
}
long timestamp = Time.now();
for (String key : getKeys()) {
for (int i = 0; i < TestData.getScaleCount() % 4; i++) {
TObject value = TestData.getTObject();
if (!store.verify(key, value, record)) {
add(key, value, record);
}
}
}
Assert.assertEquals(data.asMap(), store.select(record, timestamp));
}
use of com.cinchapi.concourse.thrift.TObject in project concourse by cinchapi.
the class StoreTest method testBrowseKey.
// TODO test audit
@Test
public void testBrowseKey() {
Multimap<TObject, Long> data = Variables.register("data", TreeMultimap.<TObject, Long>create());
String key = TestData.getSimpleString();
for (TObject value : getValues()) {
for (int i = 0; i < TestData.getScaleCount() % 4; i++) {
long record = TestData.getLong();
if (!data.containsEntry(value, record)) {
data.put(value, record);
add(key, value, record);
}
}
}
Assert.assertEquals(data.asMap(), store.browse(key));
}
use of com.cinchapi.concourse.thrift.TObject in project concourse by cinchapi.
the class StoreTest method testVerifyAfterAddAndRemove.
@Test
public void testVerifyAfterAddAndRemove() {
String key = TestData.getSimpleString();
TObject value = TestData.getTObject();
long record = TestData.getLong();
add(key, value, record);
remove(key, value, record);
Assert.assertFalse(store.verify(key, value, record));
}
Aggregations