Search in sources :

Example 91 with TObject

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;
}
Also used : TObject(com.cinchapi.concourse.thrift.TObject)

Example 92 with TObject

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));
}
Also used : TObject(com.cinchapi.concourse.thrift.TObject) ConcourseBaseTest(com.cinchapi.concourse.test.ConcourseBaseTest) Test(org.junit.Test)

Example 93 with TObject

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));
}
Also used : TObject(com.cinchapi.concourse.thrift.TObject) ConcourseBaseTest(com.cinchapi.concourse.test.ConcourseBaseTest) Test(org.junit.Test)

Example 94 with TObject

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));
}
Also used : TObject(com.cinchapi.concourse.thrift.TObject) ConcourseBaseTest(com.cinchapi.concourse.test.ConcourseBaseTest) Test(org.junit.Test)

Example 95 with TObject

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));
}
Also used : TObject(com.cinchapi.concourse.thrift.TObject) ConcourseBaseTest(com.cinchapi.concourse.test.ConcourseBaseTest) Test(org.junit.Test)

Aggregations

TObject (com.cinchapi.concourse.thrift.TObject)242 Test (org.junit.Test)100 ComplexTObject (com.cinchapi.concourse.thrift.ComplexTObject)98 Set (java.util.Set)98 AtomicSupport (com.cinchapi.concourse.server.storage.AtomicSupport)96 TranslateClientExceptions (com.cinchapi.concourse.server.aop.TranslateClientExceptions)91 VerifyAccessToken (com.cinchapi.concourse.server.aop.VerifyAccessToken)91 VerifyReadPermission (com.cinchapi.concourse.server.aop.VerifyReadPermission)88 Map (java.util.Map)76 AbstractSyntaxTree (com.cinchapi.ccl.syntax.AbstractSyntaxTree)72 SortableTable (com.cinchapi.concourse.data.sort.SortableTable)71 Store (com.cinchapi.concourse.server.storage.Store)66 Order (com.cinchapi.concourse.lang.sort.Order)63 SortableColumn (com.cinchapi.concourse.data.sort.SortableColumn)61 SortableSet (com.cinchapi.concourse.data.sort.SortableSet)60 ByteBuffer (java.nio.ByteBuffer)60 Operator (com.cinchapi.concourse.thrift.Operator)59 Entry (java.util.Map.Entry)59 Convert (com.cinchapi.concourse.util.Convert)57 Sets (com.google.common.collect.Sets)57