use of com.hazelcast.nio.serialization.NamedPortable in project hazelcast by hazelcast.
the class ClientMapTest method testPredicateListenerWithPortableKey.
@Test
@SuppressWarnings("deprecation")
public void testPredicateListenerWithPortableKey() throws InterruptedException {
IMap<Portable, Integer> tradeMap = createMap();
final AtomicInteger atomicInteger = new AtomicInteger(0);
final CountDownLatch countDownLatch = new CountDownLatch(1);
EntryListener listener = new EntryAdapter() {
@Override
public void entryAdded(EntryEvent event) {
atomicInteger.incrementAndGet();
countDownLatch.countDown();
}
};
NamedPortable key = new NamedPortable("a", 1);
tradeMap.addEntryListener(listener, key, true);
NamedPortable key2 = new NamedPortable("b", 2);
tradeMap.put(key2, 1);
assertFalse(countDownLatch.await(5, TimeUnit.SECONDS));
assertEquals(0, atomicInteger.get());
}
use of com.hazelcast.nio.serialization.NamedPortable in project hazelcast by hazelcast.
the class ClientMapTest method setup.
@Before
public void setup() {
Config config = getConfig();
config.getMapConfig("flushMap").setMapStoreConfig(new MapStoreConfig().setWriteDelaySeconds(1000).setImplementation(flushMapStore));
config.getMapConfig("putTransientMap").setMapStoreConfig(new MapStoreConfig().setWriteDelaySeconds(1000).setImplementation(transientMapStore));
server = hazelcastFactory.newHazelcastInstance(config);
ClientConfig clientConfig = new ClientConfig();
clientConfig.getSerializationConfig().addPortableFactory(TestSerializationConstants.PORTABLE_FACTORY_ID, new PortableFactory() {
public Portable create(int classId) {
return new NamedPortable();
}
});
client = hazelcastFactory.newHazelcastClient(clientConfig);
}
Aggregations