use of com.cinchapi.concourse.thrift.TObject in project concourse by cinchapi.
the class StoreTest method getValues.
/**
* Return a set of TObject values
*
* @return the values
*/
private Set<TObject> getValues() {
Set<TObject> values = Sets.newHashSet();
for (int i = 0; i < TestData.getScaleCount(); i++) {
TObject value = null;
while (value == null || values.contains(value)) {
value = TestData.getTObject();
}
values.add(value);
}
return values;
}
use of com.cinchapi.concourse.thrift.TObject in project concourse by cinchapi.
the class StoreTest method testBrowseKeyWithTime.
@Test
public void testBrowseKeyWithTime() {
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);
}
}
}
long timestamp = Time.now();
for (TObject value : getValues()) {
for (int i = 0; i < TestData.getScaleCount() % 4; i++) {
long record = TestData.getLong();
if (!store.verify(key, value, record)) {
add(key, value, record);
}
}
}
Assert.assertEquals(data.asMap(), store.browse(key, timestamp));
}
use of com.cinchapi.concourse.thrift.TObject in project concourse by cinchapi.
the class StoreTest method testVerifyAfterAdd.
@Test
public void testVerifyAfterAdd() {
String key = TestData.getSimpleString();
TObject value = TestData.getTObject();
long record = TestData.getLong();
add(key, value, record);
Assert.assertTrue(store.verify(key, value, record));
}
use of com.cinchapi.concourse.thrift.TObject in project concourse by cinchapi.
the class StoreTest method testFetchAfterAddMultiAndRemoveMultiWithTime.
@Test
public void testFetchAfterAddMultiAndRemoveMultiWithTime() {
String key = Variables.register("key", TestData.getSimpleString());
long record = Variables.register("record", TestData.getLong());
Set<TObject> values = Variables.register("values", getValues());
for (TObject value : values) {
add(key, value, record);
}
Iterator<TObject> it = values.iterator();
while (it.hasNext()) {
TObject value = it.next();
if (TestData.getInt() % 3 == 0) {
it.remove();
remove(key, value, record);
}
}
long timestamp = Time.now();
List<TObject> otherValues = Variables.register("otherValues", Lists.<TObject>newArrayList());
for (TObject value : getValues()) {
while (values.contains(value) || otherValues.contains(value)) {
value = TestData.getTObject();
}
add(key, value, record);
otherValues.add(value);
}
Set<TObject> valuesCopy = Sets.newHashSet(values);
for (TObject value : getValues()) {
if (valuesCopy.contains(value) || otherValues.contains(value)) {
remove(key, value, record);
otherValues.remove(value);
valuesCopy.remove(value);
}
}
Assert.assertEquals(values, store.select(key, record, timestamp));
}
use of com.cinchapi.concourse.thrift.TObject in project concourse by cinchapi.
the class StoreTest method testBrowseRecord.
@Test
public void testBrowseRecord() {
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);
}
}
}
Assert.assertEquals(data.asMap(), store.select(record));
}
Aggregations