Last active
December 18, 2015 10:48
-
-
Save spullara/5770711 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package avrobase.fdb; | |
import com.foundationdb.*; | |
import org.junit.Test; | |
import static com.foundationdb.KeySelector.firstGreaterOrEqual; | |
import static com.foundationdb.KeySelector.lastLessThan; | |
import static junit.framework.Assert.assertEquals; | |
/** | |
* Created by sam on 6/12/13. | |
*/ | |
public class RawScanTest { | |
@Test | |
public void testScan() { | |
Database db = FDB.selectAPIVersion(22).open().get(); | |
Transaction tx = db.createTransaction(); | |
tx.clear("a".getBytes(), "b".getBytes()); | |
tx.set("aA".getBytes(), "A".getBytes()); | |
tx.set("aB".getBytes(), "B".getBytes()); | |
tx.set("aC".getBytes(), "C".getBytes()); | |
tx.commit(); | |
tx = db.createTransaction(); | |
RangeQuery range = tx.getRange(firstGreaterOrEqual("aA".getBytes()), lastLessThan("b".getBytes())); | |
int i = 0; | |
for (KeyValue keyValue : range) { | |
System.out.println(new String(keyValue.getValue())); | |
i++; | |
} | |
assertEquals(3, i); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment