use of com.cinchapi.concourse.thrift.TObject in project concourse by cinchapi.
the class ConcourseServer method selectKeyRecordsTimeOrderPage.
@Override
@TranslateClientExceptions
@VerifyAccessToken
@VerifyReadPermission
public Map<Long, Set<TObject>> selectKeyRecordsTimeOrderPage(String key, List<Long> records, long timestamp, TOrder order, TPage page, AccessToken creds, TransactionToken transaction, String environment) throws TException {
AtomicSupport store = getStore(transaction, environment);
Supplier<SortableColumn<Set<TObject>>> supplier = () -> SortableColumn.multiValued(key, new LinkedHashMap<>(records.size()));
return AtomicOperations.supplyWithRetry(store, atomic -> Operations.selectKeyRecordsOptionalAtomic(atomic, key, records, timestamp, Orders.from(order), Pages.from(page), supplier));
}
use of com.cinchapi.concourse.thrift.TObject in project concourse by cinchapi.
the class TObjectResultDatasetTest method testInsert.
@Test
public void testInsert() {
Map<String, Map<Object, Set<Long>>> expected = new HashMap<String, Map<Object, Set<Long>>>();
int count = Random.getScaleCount();
for (int i = 0; i < count; i++) {
String key = Random.getString();
Map<Object, Set<Long>> value = expected.get(key);
if (value == null) {
value = new HashMap<Object, Set<Long>>();
}
TObject subkey = Convert.javaToThrift(Random.getObject());
Set<Long> subvalue = value.get(subkey);
if (subvalue == null) {
subvalue = new HashSet<Long>();
}
Long element = Random.getLong();
subvalue.add(element);
value.put(subkey, subvalue);
expected.put(key, value);
dataset.insert(element, key, subkey);
}
Assert.assertEquals(expected, dataset.invert());
}
use of com.cinchapi.concourse.thrift.TObject in project concourse by cinchapi.
the class PluginSerializerTest method testSerializeTObject.
@Test
public void testSerializeTObject() {
TObject expected = Convert.javaToThrift(Random.getObject());
ByteBuffer buffer = serializer.serialize(expected);
TObject actual = serializer.deserialize(buffer);
Assert.assertEquals(expected, actual);
}
use of com.cinchapi.concourse.thrift.TObject in project concourse by cinchapi.
the class PluginSerializerTest method testSerializeComplexTObject.
@Test
public void testSerializeComplexTObject() {
int count = Random.getScaleCount();
List<TObject> list = Lists.newArrayListWithCapacity(count);
for (int i = 0; i < count; ++i) {
list.add(Convert.javaToThrift(Random.getObject()));
}
ComplexTObject expected = ComplexTObject.fromJavaObject(list);
ByteBuffer buffer = serializer.serialize(expected);
ComplexTObject actual = serializer.deserialize(buffer);
Assert.assertEquals(expected, actual);
}
use of com.cinchapi.concourse.thrift.TObject in project concourse by cinchapi.
the class PluginSerializerTest method testSerializeDataset.
@Test
public void testSerializeDataset() {
Dataset<Long, String, TObject> expected = new TObjectResultDataset();
Set<Long> records = Sets.newLinkedHashSet();
for (int i = 0; i < Random.getScaleCount(); ++i) {
records.add(Random.getLong());
}
Set<String> keys = Sets.newLinkedHashSet();
for (int i = 0; i < Math.min(Random.getScaleCount(), records.size()); ++i) {
keys.add(Random.getSimpleString());
}
records.forEach((record) -> {
keys.forEach((key) -> {
expected.insert(record, key, Convert.javaToThrift(Random.getObject()));
});
});
ByteBuffer buffer = serializer.serialize(expected);
Dataset<Long, String, TObject> actual = serializer.deserialize(buffer);
Assert.assertEquals(expected, actual);
}
Aggregations