return NormalizedNodeStreamVersion.MAGNESIUM;
} else if (version == DataStoreVersions.SODIUM_SR1_VERSION) {
return NormalizedNodeStreamVersion.SODIUM_SR1;
- } else if (version == DataStoreVersions.NEON_SR2_VERSION) {
- return NormalizedNodeStreamVersion.NEON_SR2;
} else {
- return NormalizedNodeStreamVersion.LITHIUM;
+ throw new IllegalStateException("Unsupported version " + version);
}
}
@Override
public final Object toSerializable() {
final short ver = getVersion();
- if (ver < DataStoreVersions.BORON_VERSION) {
+ if (ver < DataStoreVersions.SODIUM_SR1_VERSION) {
throw new UnsupportedOperationException("Version " + ver
- + " is older than the oldest version supported version " + DataStoreVersions.BORON_VERSION);
+ + " is older than the oldest version supported version " + DataStoreVersions.SODIUM_SR1_VERSION);
}
return this;
assertEquals("getTransactionID", tx2, clone.getTransactionId());
assertTrue("isReady", clone.isReady());
assertTrue("isDoCommitOnReady", clone.isDoCommitOnReady());
- assertTrue("participatingShardNames present", clone.getParticipatingShardNames().isPresent());
- assertEquals("participatingShardNames", shardNames, clone.getParticipatingShardNames().get());
+ assertEquals("participatingShardNames", Optional.of(shardNames), clone.getParticipatingShardNames());
assertEquals("getModifications size", 0, clone.getModifications().size());
// Test not ready.
assertEquals("getTransactionID", tx2, clone.getTransactionId());
assertFalse("isReady", clone.isReady());
assertEquals("getModifications size", 0, clone.getModifications().size());
-
- // Test pre-Flourine
-
- batched = new BatchedModifications(tx2, DataStoreVersions.BORON_VERSION);
- batched.addModification(new WriteModification(writePath, writeData));
- batched.setReady(Optional.of(ImmutableSortedSet.of("one", "two")));
-
- clone = (BatchedModifications) SerializationUtils.clone((Serializable) batched.toSerializable());
-
- assertEquals("getVersion", DataStoreVersions.BORON_VERSION, clone.getVersion());
- assertEquals("getTransactionID", tx2, clone.getTransactionId());
- assertTrue("isReady", clone.isReady());
- assertFalse("participatingShardNames present", clone.getParticipatingShardNames().isPresent());
- assertEquals("getModifications size", 1, clone.getModifications().size());
}
@Test