/** * Test client fails on start if server is unavailable */ @Test public void testClientFailsOnStart() { ClientConnectionException expEx = null; try (IgniteClient ignored = Ignition.startClient(getClientConfiguration())) { // No-op. } catch (ClientConnectionException connEx) { expEx = connEx; } catch (Exception ex) { fail(String.format( "%s expected but %s was received: %s", ClientConnectionException.class.getName(), ex.getClass().getName(), ex )); } assertNotNull( String.format("%s expected but no exception was received", ClientConnectionException.class.getName()), expEx ); }
IgniteClient client = Ignition.startClient(getClientConfiguration()) ) { ClientCache<Integer, Person> cache = client.cache(Config.DEFAULT_CACHE_NAME); IgniteClient client = Ignition.startClient(getClientConfiguration()) ) { ClientCache<Person, Integer> cache = client.createCache("testBatchPutGet");
public void testCacheManagement() throws Exception { try (LocalIgniteCluster ignored = LocalIgniteCluster.start(2); IgniteClient client = Ignition.startClient(getClientConfiguration()) ) { final String CACHE_NAME = "testCacheManagement";
public void testCacheConfiguration() throws Exception { try (Ignite ignored = Ignition.start(Config.getServerConfiguration()); IgniteClient client = Ignition.startClient(getClientConfiguration()) ) { final String CACHE_NAME = "testCacheConfiguration";
IgniteClient client = Ignition.startClient(getClientConfiguration()) ) { ClientCache<Integer, Person> cache = client.getOrCreateCache(Config.DEFAULT_CACHE_NAME); IgniteClient client = Ignition.startClient(getClientConfiguration()) ) { ClientCache<Person, Integer> cache = client.getOrCreateCache("testPutGet"); IgniteClient client = Ignition.startClient(getClientConfiguration()) ) { ClientCache<Person, Person> cache = client.getOrCreateCache("testPutGet");
public void testRemoveReplace() throws Exception { try (Ignite ignored = Ignition.start(Config.getServerConfiguration()); IgniteClient client = Ignition.startClient(getClientConfiguration()) ) { ClientCache<Integer, String> cache = client.createCache("testRemoveReplace");
/** * Tested API: * <ul> * <li>{@link ClientCache#getAndPut(Object, Object)}</li> * <li>{@link ClientCache#getAndRemove(Object)}</li> * <li>{@link ClientCache#getAndReplace(Object, Object)}</li> * <li>{@link ClientCache#putIfAbsent(Object, Object)}</li> * </ul> */ @Test public void testAtomicPutGet() throws Exception { try (Ignite ignored = Ignition.start(Config.getServerConfiguration()); IgniteClient client = Ignition.startClient(getClientConfiguration()) ) { ClientCache<Integer, String> cache = client.createCache("testRemoveReplace"); assertNull(cache.getAndPut(1, "1")); assertEquals("1", cache.getAndPut(1, "1.1")); assertEquals("1.1", cache.getAndRemove(1)); assertNull(cache.getAndRemove(1)); assertTrue(cache.putIfAbsent(1, "1")); assertFalse(cache.putIfAbsent(1, "1.1")); assertEquals("1", cache.getAndReplace(1, "1.1")); assertEquals("1.1", cache.getAndReplace(1, "1")); assertNull(cache.getAndReplace(2, "2")); } }