mirror of
https://github.com/OpenHFT/Chronicle-Map.git
synced 2021-09-13 01:26:12 +00:00
removed getLater(0 putLater() and removeLater() because the stateless client is now mulithreaded
This commit is contained in:
@@ -36,7 +36,7 @@ public class CHMUseCasesTest {
|
||||
*/
|
||||
try (ChronicleMap<String, String> map = ChronicleMapBuilder
|
||||
.of(String.class, String.class)
|
||||
.checkSerializedValues() // for testng purposes only
|
||||
.checkSerializedValues() // for testing purposes only
|
||||
.create()) {
|
||||
map.put("Hello", "World");
|
||||
assertEquals("World", map.get("Hello"));
|
||||
@@ -65,10 +65,6 @@ public class CHMUseCasesTest {
|
||||
// TODO replace with the specific exception.
|
||||
}
|
||||
|
||||
assertEquals(null, map.putLater("Bye", "For now").get());
|
||||
assertEquals("For now", map.getLater("Bye").get());
|
||||
assertEquals("For now", map.removeLater("Bye").get());
|
||||
assertEquals(null, map.removeLater("Bye").get());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,7 +77,7 @@ public class CHMUseCasesTest {
|
||||
public void testCharSequenceCharSequenceMap() throws ExecutionException, InterruptedException {
|
||||
try (ChronicleMap<CharSequence, CharSequence> map = ChronicleMapBuilder
|
||||
.of(CharSequence.class, CharSequence.class)
|
||||
.checkSerializedValues() // for testng purposes only
|
||||
.checkSerializedValues() // for testing purposes only
|
||||
.create()) {
|
||||
map.put("Hello", "World");
|
||||
StringBuilder key = new StringBuilder();
|
||||
@@ -129,10 +125,6 @@ public class CHMUseCasesTest {
|
||||
}
|
||||
}));
|
||||
|
||||
assertEquals(null, map.putLater("Bye", "For now").get());
|
||||
assertEquals("For now", map.getLater("Bye").get().toString());
|
||||
assertEquals("For now", map.removeLater("Bye").get().toString());
|
||||
assertEquals(null, map.removeLater("Bye").get());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -144,7 +136,7 @@ public class CHMUseCasesTest {
|
||||
public void testStringValueStringValueMap() {
|
||||
try (ChronicleMap<StringValue, StringValue> map = ChronicleMapBuilder
|
||||
.of(StringValue.class, StringValue.class)
|
||||
.checkSerializedValues() // for testng purposes only
|
||||
.checkSerializedValues() // for testing purposes only
|
||||
.create()) {
|
||||
StringValue key1 = DataValueClasses.newDirectInstance(StringValue.class);
|
||||
StringValue key2 = DataValueClasses.newInstance(StringValue.class);
|
||||
@@ -283,10 +275,7 @@ public class CHMUseCasesTest {
|
||||
} catch (Exception todoMoreSpecificException) {
|
||||
}
|
||||
|
||||
assertEquals(null, map.putLater(3, 4).get());
|
||||
assertEquals((Integer) 4, map.getLater(3).get());
|
||||
assertEquals((Integer) 4, map.removeLater(3).get());
|
||||
assertEquals(null, map.removeLater(3).get());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -331,10 +320,7 @@ public class CHMUseCasesTest {
|
||||
} catch (Exception todoMoreSpecificException) {
|
||||
}
|
||||
|
||||
assertEquals(null, map.putLater(3L, 4L).get());
|
||||
assertEquals((Long) 4L, map.getLater(3L).get());
|
||||
assertEquals((Long) 4L, map.removeLater(3L).get());
|
||||
assertEquals(null, map.removeLater(3L).get());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -379,10 +365,7 @@ public class CHMUseCasesTest {
|
||||
} catch (Exception todoMoreSpecificException) {
|
||||
}
|
||||
|
||||
assertEquals(null, map.putLater(3.0, 4.0).get());
|
||||
assertEquals((Double) 4.0, map.getLater(3.0).get());
|
||||
assertEquals((Double) 4.0, map.removeLater(3.0).get());
|
||||
assertEquals(null, map.removeLater(3.0).get());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -430,10 +413,6 @@ public class CHMUseCasesTest {
|
||||
byte[] key3 = {3, 3, 3, 3};
|
||||
byte[] value3 = {4, 4, 4, 4};
|
||||
|
||||
assertEquals(null, map.putLater(key3, value3).get());
|
||||
assertTrue(Arrays.equals(value3, map.getLater(key3).get()));
|
||||
assertTrue(Arrays.equals(value3, map.removeLater(key3).get()));
|
||||
assertEquals(null, map.removeLater(key3).get());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -521,13 +500,7 @@ public class CHMUseCasesTest {
|
||||
assertBBEquals(bb1, valueA);
|
||||
}
|
||||
|
||||
ByteBuffer key3 = ByteBuffer.wrap(new byte[]{3, 3, 3, 3});
|
||||
ByteBuffer value3 = ByteBuffer.wrap(new byte[]{4, 4, 4, 4});
|
||||
|
||||
assertEquals(null, map.putLater(key3, value3).get());
|
||||
assertBBEquals(value3, map.getLater(key3).get());
|
||||
assertBBEquals(value3, map.removeLater(key3).get());
|
||||
assertEquals(null, map.removeLater(key3).get());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -579,15 +552,6 @@ public class CHMUseCasesTest {
|
||||
|
||||
assertBBEquals(ByteBuffer.wrap(new byte[]{12, 10, 11, 11}), map.get(key1));
|
||||
|
||||
ByteBuffer key3 = ByteBuffer.wrap(new byte[]{3, 3, 3, 3});
|
||||
ByteBuffer value3 = ByteBuffer.allocateDirect(4);
|
||||
value3.put(new byte[]{4, 4, 4, 4});
|
||||
value3.flip();
|
||||
|
||||
assertEquals(null, map.putLater(key3, value3).get());
|
||||
assertBBEquals(value3, map.getLater(key3).get());
|
||||
assertBBEquals(value3, map.removeLater(key3).get());
|
||||
assertEquals(null, map.removeLater(key3).get());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,6 @@ import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
/**
|
||||
* @author Rob Austin.
|
||||
@@ -228,21 +227,6 @@ public class ReplicationCheckingMap<K, V> implements ChronicleMap<K, V> {
|
||||
return map1.updateForKey(key, mutator);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Future<V> getLater(@NotNull K key) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Future<V> putLater(@NotNull K key, @NotNull V value) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Future<V> removeLater(@NotNull K key) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getAll(File toFile) {
|
||||
throw new UnsupportedOperationException();
|
||||
|
||||
@@ -453,60 +453,7 @@ public class StatelessClientTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test(timeout = 10000)
|
||||
public void testGetLater() throws IOException,
|
||||
InterruptedException, ExecutionException {
|
||||
|
||||
try (ChronicleMap<Integer, CharSequence> serverMap = ChronicleMapBuilder.of(Integer.class, CharSequence.class)
|
||||
.replication((byte) 2, TcpTransportAndNetworkConfig.of(8056)).create()) {
|
||||
try (ChronicleMap<Integer, CharSequence> statelessMap = ChronicleMapBuilder.of(Integer
|
||||
.class, CharSequence.class)
|
||||
.statelessClient(new InetSocketAddress("localhost", 8056)).create()) {
|
||||
statelessMap.put(1, "some value");
|
||||
|
||||
assertEquals("some value", statelessMap.getLater(1).get());
|
||||
assertEquals(1, statelessMap.size());
|
||||
|
||||
statelessMap.remove(1);
|
||||
|
||||
assertEquals(null, statelessMap.getLater(1).get());
|
||||
assertEquals(0, statelessMap.size());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPutLater() throws IOException,
|
||||
InterruptedException, ExecutionException {
|
||||
|
||||
try (ChronicleMap<Integer, CharSequence> serverMap = ChronicleMapBuilder.of(Integer.class, CharSequence.class)
|
||||
.replication((byte) 2, TcpTransportAndNetworkConfig.of(8056)).create()) {
|
||||
try (ChronicleMap<Integer, CharSequence> statelessMap = ChronicleMapBuilder.of(Integer
|
||||
.class, CharSequence.class)
|
||||
.statelessClient(new InetSocketAddress("localhost", 8056)).create()) {
|
||||
CharSequence oldValue = statelessMap.putLater(1, "some value").get();
|
||||
assertEquals("some value", statelessMap.get(1));
|
||||
assertEquals(1, statelessMap.size());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test(timeout = 10000)
|
||||
public void testRemoveLater() throws IOException,
|
||||
InterruptedException, ExecutionException {
|
||||
|
||||
try (ChronicleMap<Integer, CharSequence> serverMap = ChronicleMapBuilder.of(Integer.class, CharSequence.class)
|
||||
.replication((byte) 2, TcpTransportAndNetworkConfig.of(8056)).create()) {
|
||||
try (ChronicleMap<Integer, CharSequence> statelessMap = ChronicleMapBuilder.of(Integer
|
||||
.class, CharSequence.class)
|
||||
.statelessClient(new InetSocketAddress("localhost", 8056)).create()) {
|
||||
statelessMap.put(1, "some value");
|
||||
statelessMap.removeLater(1).get();
|
||||
assertEquals(null, statelessMap.get(1));
|
||||
assertEquals(0, statelessMap.size());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test(timeout = 10000)
|
||||
public void testGetAndEntryWeDontHave() throws IOException,
|
||||
|
||||
@@ -33,7 +33,6 @@ import java.io.IOException;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
@@ -180,21 +179,6 @@ public class StatelessChronicleMapTest extends JSR166TestCase {
|
||||
return d.updateForKey(key, mutator);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Future<V> getLater(@NotNull K key) {
|
||||
return d.getLater(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Future<V> putLater(@NotNull K key, @NotNull V value) {
|
||||
return d.putLater(key, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Future<V> removeLater(@NotNull K key) {
|
||||
return d.removeLater(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getAll(File toFile) throws IOException {
|
||||
d.getAll(toFile);
|
||||
|
||||
Reference in New Issue
Block a user