ModClusterService implements ModClusterServiceMBean, ContainerEventHandler, LoadBalanceFactorProvider,
        MCMPConnectionListener, ContextFilter { @Override public void remove(Context context) { ModClusterLogger.LOGGER.removeContext(context.getHost(), context); if (this.include(context) && !hasContextMultipleReferences(context)) { if (this.established) { ModClusterLogger.LOGGER.sendContextCommand(MCMPRequestType.REMOVE_APP, context.getHost(), context); this.mcmpHandler.sendRequest(this.requestFactory.createRemoveRequest(context)); } EnablableRequestListener listener = this.requestListeners.remove(context); if (listener != null) { context.removeRequestListener(listener); } } } 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 removeSingleContext() { MCMPHandler mcmpHandler = mock(MCMPHandler.class); ModClusterService mod = createModClusterService(mcmpHandler); Context context = createContext(SOME_PATH); addInnerContexts(context, context); mod.remove(context); verify(mcmpHandler, times(1)).sendRequest(eq(null)); }
@Test public void removeMultipleContext() { MCMPHandler mcmpHandler = mock(MCMPHandler.class); ModClusterService mod = createModClusterService(mcmpHandler); Context context = createContext(SOME_PATH); Context context2 = createContext(SOME_PATH); addInnerContexts(context, context, context2); mod.remove(context); verify(mcmpHandler, never()).sendRequest(eq(null)); }