use of com.cinchapi.concourse.server.model.Value in project concourse by cinchapi.
the class CorpusChunkTest method testCannotInsertInImmutableChunk.
@Override
@Test(expected = IllegalStateException.class)
public void testCannotInsertInImmutableChunk() {
Text locator = Variables.register("locator", getLocator());
Value value = Variables.register("value", getStringValue());
Identifier record = Variables.register("record", getRecord());
((CorpusChunk) chunk).insert(locator, value, record, Time.now(), Action.ADD);
if (chunk.length() <= 0) {
value = Variables.register("value", getStringValue());
((CorpusChunk) chunk).insert(locator, value, record, Time.now(), Action.ADD);
}
chunk.transfer(file);
((CorpusChunk) chunk).insert(locator, value, record, Time.now(), Action.ADD);
}
use of com.cinchapi.concourse.server.model.Value in project concourse by cinchapi.
the class CorpusChunkTest method testDataDeduplication.
@Test
public void testDataDeduplication() {
Text locator1 = Text.wrap("name");
Text locator2 = Text.wrap("name");
Value key1 = Value.wrap(Convert.javaToThrift("Fonamey"));
Value key2 = Value.wrap(Convert.javaToThrift("Fonamey"));
Identifier value1 = Identifier.of(1);
Identifier value2 = Identifier.of(1);
CorpusChunk corpus = (CorpusChunk) chunk;
corpus.insert(locator2, key2, value2, Time.now(), Action.ADD);
corpus.insert(locator1, key1, value1, Time.now(), Action.ADD);
Position position = null;
Iterator<Revision<Text, Text, Position>> it = corpus.iterator();
while (it.hasNext()) {
Revision<Text, Text, Position> revision = it.next();
if (position == null) {
position = revision.getValue();
}
Assert.assertSame(locator2, revision.getLocator());
if (revision.getKey().toString().equals("name")) {
Assert.assertSame(locator2, revision.getKey());
}
Assert.assertSame(position, revision.getValue());
}
}
use of com.cinchapi.concourse.server.model.Value in project concourse by cinchapi.
the class CorpusChunkTest method testReproCON_4.
@Test
public void testReproCON_4() {
// TODO file this in jira
Text key = Variables.register("key", Text.wrap("strings"));
Identifier record = Variables.register("record", getRecord());
Value value = Variables.register("value", Value.wrap(Convert.javaToThrift("aaihwopxetdxrumqlbjwgdsjgs tan rczlfjhyhlwhsr aqzpmquui mmmynpklmctgnonaaafagpjgv augolkz")));
((CorpusChunk) chunk).insert(key, value, record, Time.now(), Action.ADD);
Text term = Variables.register("term", Text.wrap("aa"));
Variables.register("chunkDump", chunk.dump());
CorpusRecord searchRecord = CorpusRecord.createPartial(key, term);
((CorpusChunk) chunk).seek(Composite.create(key, term), searchRecord);
Assert.assertTrue(searchRecord.get(term).stream().map(Position::getIdentifier).collect(Collectors.toCollection(LinkedHashSet::new)).contains(record));
}
Aggregations