public ClientCacheRule withServerConnection(int... serverPorts) { withCacheSetup(cf -> { for (int serverPort : serverPorts) { cf.addPoolServer("localhost", serverPort); } }); return this; }
@Deprecated public static ClientCache createClientCache(String username, String password, int serverPort, Properties extraProperties) { Properties props = new Properties(); props.setProperty(UserPasswordAuthInit.USER_NAME, username); props.setProperty(UserPasswordAuthInit.PASSWORD, password); props.setProperty(SECURITY_CLIENT_AUTH_INIT, UserPasswordAuthInit.class.getName()); props.setProperty(LOCATORS, ""); props.setProperty(MCAST_PORT, "0"); props.putAll(extraProperties); if (Version.CURRENT.ordinal() >= 75) { props.setProperty(SERIALIZABLE_OBJECT_FILTER, "org.apache.geode.security.query.data.*"); } ClientCache cache = new ClientCacheFactory(props).setPoolSubscriptionEnabled(true) .addPoolServer("localhost", serverPort).create(); return cache; }
ccf.setPdxReadSerialized(true); if (serverPort != 0) { ccf.addPoolServer(serverHost, serverPort); } else { InetSocketAddress locatorAddress = getLocatorAddress(locatorStr);
@Override public void run2() throws CacheException { getSystem(properties); final ClientCacheFactory ccf = new ClientCacheFactory(properties); for (int i = 0; i < servers.length; i++) { ccf.addPoolServer(NetworkUtils.getServerHostName(servers[i].getHost()), ports[i]); } ccf.setPoolSubscriptionEnabled(true); ccf.setPoolSubscriptionRedundancy(redundancyLevel); ClientCache cache = (ClientCache) getClientCache(ccf); } });
@Test(expected = GemFireConfigException.class) public void clientIsPreventedFromConnectingToLocatorAsServer() { IgnoredException.addIgnoredException("Improperly configured client detected"); ClientCacheFactory clientCacheFactory = new ClientCacheFactory(); clientCacheFactory.addPoolServer("localhost", DistributedTestUtils.getDUnitLocatorPort()); clientCacheFactory.setPoolSubscriptionEnabled(true); getClientCache(clientCacheFactory); Region region = ((ClientCache) cache).createClientRegionFactory(ClientRegionShortcut.PROXY) .create(REGION_NAME1); region.registerInterest(k1); }
ccf.addPoolServer(server.getHostName(), server.getPort());
mockPoolFactory.addServer(invocation.getArgument(0), invocation.getArgument(1)); return clientCacheFactorySpy; }).when(clientCacheFactorySpy).addPoolServer(anyString(), anyInt());
clientCacheFactory.addPoolServer(server.getHostName(), server.getPort()); noServers.set(false); });
clientCacheFactory.addPoolServer(server.getHostName(), server.getPort()); noServers.set(false); });