/** * Is the CQ service in a cache server environment * @return true if cache server, false otherwise */ public boolean isServer() { if (this.cache.getCacheServers().isEmpty()) { return false; } return true; }
/** * Determines whether the specified Cache has any CacheServers. * * @param cache the Cache to check for existing CacheServers. * @return a boolean value indicating if any CacheServers were added to the Cache. */ protected boolean isServing(final Cache cache) { return !cache.getCacheServers().isEmpty(); }
/** * Determines whether the specified Cache has any CacheServers. * * @param cache the Cache to check for existing CacheServers. * @return a boolean value indicating if any CacheServers were added to the Cache. */ protected boolean isServing(final Cache cache) { return !cache.getCacheServers().isEmpty(); }
private static BridgeServerImpl getBridgeServer() { BridgeServerImpl bridgeServer = (BridgeServerImpl)cache.getCacheServers() .iterator().next(); assertNotNull(bridgeServer); return bridgeServer; } /*
public void run2() throws CacheException { Cache cache = getCache(); assertEquals(0, cache.getCacheServers().size()); } });
private static BridgeServerImpl getBridgeServer() { BridgeServerImpl bridgeServer = (BridgeServerImpl)cache.getCacheServers() .iterator().next(); assertNotNull(bridgeServer); return bridgeServer; } /*
/** * Determines whether a default server (a cache server) should be created on startup as determined by the absence * of specifying the --disable-default-server command-line option (switch). In addition, a default cache server * is started only if no cache servers have been added to the Cache by way of cache.xml. * * @param cache the reference to the Cache to check for any existing cache servers. * @return a boolean indicating whether a default server should be added to the Cache. * @see #isDisableDefaultServer() */ protected boolean isDefaultServerEnabled(final Cache cache) { return (cache.getCacheServers().isEmpty() && !isDisableDefaultServer()); }
/** * Determines whether a default server (a cache server) should be created on startup as determined by the absence * of specifying the --disable-default-server command-line option (switch). In addition, a default cache server * is started only if no cache servers have been added to the Cache by way of cache.xml. * * @param cache the reference to the Cache to check for any existing cache servers. * @return a boolean indicating whether a default server should be added to the Cache. * @see #isDisableDefaultServer() */ protected boolean isDefaultServerEnabled(final Cache cache) { return (cache.getCacheServers().isEmpty() && !isDisableDefaultServer()); }
public static void stopServer() { for (CacheServer cacheServer : cache.getCacheServers()) { cacheServer.stop(); } }
public void run2() throws CacheException { Cache cache2 = getCache(); cache2.addCacheServer(); assertEquals(2, cache2.getCacheServers().size()); } });
void stopBridgeServers(Cache cache) { CacheServer bridge = null; for (Iterator bsI = cache.getCacheServers().iterator();bsI.hasNext(); ) { bridge = (CacheServer) bsI.next(); bridge.stop(); assertFalse(bridge.isRunning()); } }
private void restartBridgeServers(Cache cache) throws IOException { CacheServer bridge = null; for (Iterator bsI = cache.getCacheServers().iterator();bsI.hasNext(); ) { bridge = (CacheServer) bsI.next(); bridge.start(); assertTrue(bridge.isRunning()); } }
/** * Stops the bridge server that serves up the given cache. * * @since 4.0 */ void stopBridgeServer(Cache cache) { CacheServer bridge = cache.getCacheServers().iterator().next(); bridge.stop(); assertFalse(bridge.isRunning()); }
/** * Stops the bridge server that serves up the given cache. */ protected void stopBridgeServer(Cache cache) { CacheServer server = (CacheServer) cache.getCacheServers().iterator().next(); server.stop(); assertFalse(server.isRunning()); }
private boolean noActiveServer(){ for (CacheServer server: this.getCache().getCacheServers()){ if (server.isRunning()){ return false; } } return true; }
private boolean noActiveServer(){ for (CacheServer server: this.getCache().getCacheServers()){ if (server.isRunning()){ return false; } } return true; }
public static void verifyDeltaSent(Integer deltas) { CacheClientNotifier ccn = ((BridgeServerImpl)cache .getCacheServers().toArray()[0]).getAcceptor() .getCacheClientNotifier(); int numOfDeltasSent = ((CacheClientProxy)ccn.getClientProxies().toArray()[0]) .getStatistics().getDeltaMessagesSent(); assertTrue("Expected " + deltas + " deltas to be sent but " + numOfDeltasSent + " were sent.", numOfDeltasSent == deltas); }
public void testBridgeLoadProbe() { CacheCreation cache = new CacheCreation(); CacheServer server = cache.addCacheServer(); server.setPort(AvailablePortHelper.getRandomAvailableTCPPort()); server.setLoadProbe(new MyLoadProbe()); testXml(cache); Cache c= getCache(); server = c.getCacheServers().get(0); Assert.assertEquals(MyLoadProbe.class,server.getLoadProbe().getClass()); }
public void testLoadPollInterval() { CacheCreation cache = new CacheCreation(); CacheServer server = cache.addCacheServer(); server.setPort(AvailablePortHelper.getRandomAvailableTCPPort()); server.setLoadPollInterval(12345); testXml(cache); Cache c = getCache(); server = c.getCacheServers().get(0); Assert.assertEquals(12345, server.getLoadPollInterval()); }
@Test public void testIsServingWhenNoCacheServersExist() { final Cache mockCache = mockContext.mock(Cache.class, "Cache"); mockContext.checking(new Expectations() {{ oneOf(mockCache).getCacheServers(); will(returnValue(Collections.emptyList())); }}); final ServerLauncher serverLauncher = new Builder().setMemberName("serverOne").build(); assertNotNull(serverLauncher); assertEquals("serverOne", serverLauncher.getMemberName()); assertFalse(serverLauncher.isServing(mockCache)); }