use of com.ms.silverking.cloud.dht.client.ConstantVersionProvider in project SilverKing by Morgan-Stanley.
the class PerspectiveTest method testDefaultsPuts.
@Test
public void testDefaultsPuts() throws ClientException, IOException {
Namespace ns = session.createNamespace(namespaceName, session.getDefaultNamespaceOptions().versionMode(NamespaceVersionMode.CLIENT_SPECIFIED).revisionMode(RevisionMode.UNRESTRICTED_REVISIONS).defaultPutOptions(session.getDefaultPutOptions().version(5)));
SynchronousNamespacePerspective<String, String> syncNsp = ns.openSyncPerspective(String.class, String.class);
PutOptions putOptions = syncNsp.getOptions().getDefaultPutOptions();
GetOptions getOptions = syncNsp.getOptions().getDefaultGetOptions();
syncNsp.put("k", "v1");
printKeyVals(syncNsp, "k", getOptions);
syncNsp.put("k", "v2", putOptions.version(1));
printKeyVals(syncNsp, "k", getOptions);
syncNsp.put("k", "v3");
printKeyVals(syncNsp, "k", getOptions);
// this guy is not working as expected
syncNsp.setDefaultVersion(4);
syncNsp.put("k", "v4");
printKeyVals(syncNsp, "k", getOptions);
// this guy is not working as expected
syncNsp.setDefaultVersionProvider(new ConstantVersionProvider(6));
syncNsp.put("k", "v5");
printKeyVals(syncNsp, "k", getOptions);
syncNsp.put("k", "v6", putOptions.version(8));
printKeyVals(syncNsp, "k", getOptions);
}
Aggregations