ModClusterService implements ModClusterServiceMBean, ContainerEventHandler, LoadBalanceFactorProvider,
        MCMPConnectionListener, ContextFilter { @Override public void stop(Server server) { ModClusterLogger.LOGGER.stopServer(); if (this.established) { for (Engine engine : server.getEngines()) { for (Host host : engine.getHosts()) { for (Context context : host.getContexts()) { if (context.isStarted()) { this.stop(context); } this.remove(context); } } this.removeAll(engine); } } } ModClusterService(ModClusterConfiguration config, LoadBalanceFactorProvider loadBalanceFactorProvider);  ModClusterService(ModClusterConfig config, LoadBalanceFactorProvider loadBalanceFactorProvider);  ModClusterService(ModClusterConfig config, LoadBalanceFactorProviderFactory loadBalanceFactorProviderFactory); private  ModClusterService(NodeConfiguration nodeConfig, BalancerConfiguration balancerConfig, MCMPHandlerConfiguration mcmpConfig, AdvertiseConfiguration advertiseConfig,
                              LoadBalanceFactorProviderFactory loadBalanceFactorProviderFactory); private  ModClusterService(NodeConfiguration nodeConfig, BalancerConfiguration balancerConfig, MCMPHandlerConfiguration mcmpConfig, AdvertiseConfiguration advertiseConfig,
                              LoadBalanceFactorProviderFactory loadBalanceFactorProviderFactory, MCMPRequestFactory requestFactory); private  ModClusterService(NodeConfiguration nodeConfig, BalancerConfiguration balancerConfig, MCMPHandlerConfiguration mcmpConfig, AdvertiseConfiguration advertiseConfig,
                              LoadBalanceFactorProviderFactory loadBalanceFactorProviderFactory, MCMPRequestFactory requestFactory, MCMPResponseParser responseParser, ResetRequestSource resetRequestSource); protected  ModClusterService(NodeConfiguration nodeConfig, BalancerConfiguration balancerConfig, MCMPHandlerConfiguration mcmpConfig, AdvertiseConfiguration advertiseConfig,
                                LoadBalanceFactorProviderFactory loadBalanceFactorProviderFactory, MCMPRequestFactory requestFactory, MCMPResponseParser responseParser, ResetRequestSource resetRequestSource, MCMPHandler mcmpHandler, AdvertiseListenerFactory listenerFactory); @Override synchronized void init(Server server); @Override Set<String> getExcludedContexts(Host host); @Override boolean isAutoEnableContexts(); @Override synchronized void shutdown(); @Override void start(Server server); @Override void stop(Server server); @Override boolean isEstablished(); @Override void connectionEstablished(InetAddress localAddress); @Override void add(Context context); @Override void start(Context context); @Override void stop(Context context); @Override void remove(Context context); @Override void status(Engine engine); @Override int getLoadBalanceFactor(Engine engine); @Override void addProxy(String host, int port); @Override void removeProxy(String host, int port); @Override Map<InetSocketAddress, String> getProxyConfiguration(); @Override Map<InetSocketAddress, String> getProxyInfo(); @Override Map<InetSocketAddress, String> ping(); @Override Map<InetSocketAddress, String> ping(String jvmRoute); @Override Map<InetSocketAddress, String> ping(String scheme, String host, int port); @Override void reset(); @Override void refresh(); @Override boolean disable(); @Override boolean enable(); @Override boolean disableContext(String host, String path); @Override boolean enableContext(String host, String path); @Override boolean stop(long timeout, TimeUnit unit); @Override boolean stopContext(String host, String path, long timeout, TimeUnit unit); static final int DEFAULT_PORT; }
@Test public void stopSingleContext() { MCMPHandler mcmpHandler = mock(MCMPHandler.class); ModClusterService mod = createModClusterService(mcmpHandler); Context context = createContext(SOME_PATH); addInnerContexts(context, context); mod.stop(context); verify(mcmpHandler, times(2)).sendRequest(eq(null)); }
@Test public void stopMultipleContextWithSamePath() { MCMPHandler mcmpHandler = mock(MCMPHandler.class); ModClusterService mod = createModClusterService(mcmpHandler); Context context = createContext(SOME_PATH); Context context2 = createContext(SOME_PATH); addInnerContexts(context, context, context2); mod.stop(context); verify(mcmpHandler, never()).sendRequest(eq(null)); }