Search in sources :

Example 61 with Value

use of com.cinchapi.concourse.server.model.Value in project concourse by cinchapi.

the class RangeTokensTest method testConvertNotEqualRangeToken.

@Test
public void testConvertNotEqualRangeToken() {
    Text key = TestData.getText();
    Operator operator = Operator.NOT_EQUALS;
    Value value = TestData.getValue();
    RangeToken token = RangeToken.forReading(key, operator, value);
    Iterable<Range<Value>> ranges = RangeTokens.convertToRange(token);
    Assert.assertEquals(Lists.newArrayList(Range.lessThan(value), Range.greaterThan(value)), ranges);
}
Also used : Operator(com.cinchapi.concourse.thrift.Operator) Value(com.cinchapi.concourse.server.model.Value) Text(com.cinchapi.concourse.server.model.Text) Range(com.google.common.collect.Range) ConcourseBaseTest(com.cinchapi.concourse.test.ConcourseBaseTest) Test(org.junit.Test)

Example 62 with Value

use of com.cinchapi.concourse.server.model.Value in project concourse by cinchapi.

the class RangeTokensTest method testConvertGreaterThanOrEqualsRangeToken.

@Test
public void testConvertGreaterThanOrEqualsRangeToken() {
    Text key = TestData.getText();
    Operator operator = Operator.GREATER_THAN_OR_EQUALS;
    Value value = TestData.getValue();
    RangeToken token = RangeToken.forReading(key, operator, value);
    Range<Value> range = Iterables.getOnlyElement(RangeTokens.convertToRange(token));
    Assert.assertEquals(range, Range.atLeast(value));
}
Also used : Operator(com.cinchapi.concourse.thrift.Operator) Value(com.cinchapi.concourse.server.model.Value) Text(com.cinchapi.concourse.server.model.Text) ConcourseBaseTest(com.cinchapi.concourse.test.ConcourseBaseTest) Test(org.junit.Test)

Example 63 with Value

use of com.cinchapi.concourse.server.model.Value in project concourse by cinchapi.

the class RangeTokensTest method testConvertLessThanRangeToken.

@Test
public void testConvertLessThanRangeToken() {
    Text key = TestData.getText();
    Operator operator = Operator.LESS_THAN;
    Value value = TestData.getValue();
    RangeToken token = RangeToken.forReading(key, operator, value);
    Range<Value> range = Iterables.getOnlyElement(RangeTokens.convertToRange(token));
    Assert.assertEquals(range, Range.lessThan(value));
}
Also used : Operator(com.cinchapi.concourse.thrift.Operator) Value(com.cinchapi.concourse.server.model.Value) Text(com.cinchapi.concourse.server.model.Text) ConcourseBaseTest(com.cinchapi.concourse.test.ConcourseBaseTest) Test(org.junit.Test)

Example 64 with Value

use of com.cinchapi.concourse.server.model.Value in project concourse by cinchapi.

the class RangeTokensTest method testConvertGreaterThanRangeToken.

@Test
public void testConvertGreaterThanRangeToken() {
    Text key = TestData.getText();
    Operator operator = Operator.GREATER_THAN;
    Value value = TestData.getValue();
    RangeToken token = RangeToken.forReading(key, operator, value);
    Range<Value> range = Iterables.getOnlyElement(RangeTokens.convertToRange(token));
    Assert.assertEquals(range, Range.greaterThan(value));
}
Also used : Operator(com.cinchapi.concourse.thrift.Operator) Value(com.cinchapi.concourse.server.model.Value) Text(com.cinchapi.concourse.server.model.Text) ConcourseBaseTest(com.cinchapi.concourse.test.ConcourseBaseTest) Test(org.junit.Test)

Example 65 with Value

use of com.cinchapi.concourse.server.model.Value in project concourse by cinchapi.

the class RangeTokensTest method testConvertBetweenRangeToken.

@Test
public void testConvertBetweenRangeToken() {
    Text key = TestData.getText();
    Operator operator = Operator.BETWEEN;
    Value value1 = TestData.getValue();
    Value value2 = null;
    while (value2 == null || value1.equals(value2)) {
        value2 = TestData.getValue();
    }
    RangeToken token = RangeToken.forReading(key, operator, value1.compareTo(value2) < 0 ? value1 : value2, value1.compareTo(value2) > 0 ? value1 : value2);
    Range<Value> range = Iterables.getOnlyElement(RangeTokens.convertToRange(token));
    Assert.assertEquals(range, Range.closedOpen(value1.compareTo(value2) < 0 ? value1 : value2, value1.compareTo(value2) > 0 ? value1 : value2));
}
Also used : Operator(com.cinchapi.concourse.thrift.Operator) Value(com.cinchapi.concourse.server.model.Value) Text(com.cinchapi.concourse.server.model.Text) ConcourseBaseTest(com.cinchapi.concourse.test.ConcourseBaseTest) Test(org.junit.Test)

Aggregations

Value (com.cinchapi.concourse.server.model.Value)73 Text (com.cinchapi.concourse.server.model.Text)60 Test (org.junit.Test)43 ConcourseBaseTest (com.cinchapi.concourse.test.ConcourseBaseTest)34 Identifier (com.cinchapi.concourse.server.model.Identifier)25 CountDownLatch (java.util.concurrent.CountDownLatch)22 Set (java.util.Set)14 Operator (com.cinchapi.concourse.thrift.Operator)10 Action (com.cinchapi.concourse.server.storage.Action)6 Range (com.google.common.collect.Range)6 LinkedHashSet (java.util.LinkedHashSet)6 TObject (com.cinchapi.concourse.thrift.TObject)5 LazyTransformSet (com.cinchapi.common.collect.lazy.LazyTransformSet)3 RangeToken (com.cinchapi.concourse.server.concurrent.RangeToken)3 ImmutableSet (com.google.common.collect.ImmutableSet)3 ByteBuffer (java.nio.ByteBuffer)3 Path (java.nio.file.Path)3 NavigableSet (java.util.NavigableSet)3 CoalescableTreeMap (com.cinchapi.common.collect.CoalescableTreeMap)2 Position (com.cinchapi.concourse.server.model.Position)2