Author: pferraro
Date: 2008-10-31 16:18:49 -0400 (Fri, 31 Oct 2008)
New Revision: 2040
Modified:
trunk/mod_cluster/src/test/java/org/jboss/modcluster/ClusterListenerTestCase.java
Log:
Cluster listener no longer implements ResetRequestSource.
Modified:
trunk/mod_cluster/src/test/java/org/jboss/modcluster/ClusterListenerTestCase.java
===================================================================
---
trunk/mod_cluster/src/test/java/org/jboss/modcluster/ClusterListenerTestCase.java 2008-10-31
20:17:03 UTC (rev 2039)
+++
trunk/mod_cluster/src/test/java/org/jboss/modcluster/ClusterListenerTestCase.java 2008-10-31
20:18:49 UTC (rev 2040)
@@ -21,33 +21,25 @@
*/
package org.jboss.modcluster;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-
import javax.management.MalformedObjectNameException;
import javax.management.ObjectName;
import org.apache.catalina.Container;
import org.apache.catalina.ContainerEvent;
import org.apache.catalina.ContainerListener;
-import org.apache.catalina.Context;
import org.apache.catalina.Engine;
-import org.apache.catalina.Host;
import org.apache.catalina.Lifecycle;
import org.apache.catalina.LifecycleEvent;
import org.apache.catalina.LifecycleListener;
import org.apache.catalina.Server;
import org.apache.catalina.ServerFactory;
import org.apache.catalina.Service;
-import org.apache.catalina.connector.Connector;
import org.apache.tomcat.util.modeler.Registry;
import org.easymock.Capture;
import org.easymock.EasyMock;
import org.jboss.modcluster.mcmp.MCMPHandler;
import org.jboss.modcluster.mcmp.MCMPRequest;
import org.jboss.modcluster.mcmp.MCMPRequestType;
-import org.jboss.modcluster.mcmp.ResetRequestSource;
import org.junit.Assert;
import org.junit.Test;
@@ -68,92 +60,6 @@
private final ContainerListener containerListener =
EasyMock.createStrictMock(ContainerListener.class);
private final ClusterListener listener = new ClusterListener(this.mcmpHandler,
this.lifecycleListener, this.containerListener);
-
- @Test
- public void getResetRequests() throws Exception
- {
- Service service = EasyMock.createStrictMock(Service.class);
- Engine engine = EasyMock.createStrictMock(Engine.class);
- Container container = EasyMock.createStrictMock(Container.class);
- Context context = EasyMock.createStrictMock(Context.class);
- Host host = EasyMock.createStrictMock(Host.class);
- Connector connector = new Connector("AJP/1.3");
-
- this.listener.setDomain("domain");
- this.listener.setFlushPackets(true);
- this.listener.setFlushWait(1);
- this.listener.setPing(2);
- this.listener.setSmax(3);
- this.listener.setTtl(4);
- this.listener.setNodeTimeout(5);
- this.listener.setBalancer("S");
- this.listener.setStickySession(false);
- this.listener.setStickySessionRemove(true);
- this.listener.setStickySessionForce(false);
- this.listener.setWorkerTimeout(6);
- this.listener.setMaxAttempts(7);
-
- EasyMock.expect(server.findServices()).andReturn(new Service[] { service });
- EasyMock.expect(service.getContainer()).andReturn(engine);
- EasyMock.expect(engine.getJvmRoute()).andReturn("host1");
- EasyMock.expect(service.findConnectors()).andReturn(new Connector[] { connector
});
-
- EasyMock.expect(engine.findChildren()).andReturn(new Container[] { container });
- EasyMock.expect(container.findChildren()).andReturn(new Container[] { context });
- EasyMock.expect(context.getPath()).andReturn("/context");
- EasyMock.expect(context.isStarted()).andReturn(true);
- EasyMock.expect(context.getParent()).andReturn(host);
- EasyMock.expect(host.getName()).andReturn("host");
- EasyMock.expect(host.findAliases()).andReturn(new String[] { "alias1",
"alias2" });
-
- EasyMock.replay(server, service, engine, container, context, host);
-
- Map<String, ResetRequestSource.EngineStatus> emptyResponseMap =
Collections.emptyMap();
- List<MCMPRequest> requests =
this.listener.getResetRequests(emptyResponseMap);
-
- EasyMock.verify(server, service, engine, container, context, host);
-
- Assert.assertEquals(2, requests.size());
-
- MCMPRequest request = requests.get(0);
- Map<String, String> parameters = request.getParameters();
-
- request = requests.get(0);
- parameters = request.getParameters();
-
- Assert.assertSame(MCMPRequestType.CONFIG, request.getRequestType());
- Assert.assertFalse(request.isWildcard());
- Assert.assertEquals("host1", request.getJvmRoute());
- Assert.assertEquals(16, parameters.size());
- Assert.assertEquals("127.0.0.1", parameters.get("Host"));
- Assert.assertEquals("0", parameters.get("Port"));
- Assert.assertEquals("ajp", parameters.get("Type"));
- Assert.assertEquals("domain", parameters.get("Domain"));
- Assert.assertEquals("On", parameters.get("flushpackets"));
- Assert.assertEquals("1", parameters.get("flushwait"));
- Assert.assertEquals("2", parameters.get("ping"));
- Assert.assertEquals("3", parameters.get("smax"));
- Assert.assertEquals("4", parameters.get("ttl"));
- Assert.assertEquals("5", parameters.get("Timeout"));
- Assert.assertEquals("S", parameters.get("Balancer"));
- Assert.assertEquals("No", parameters.get("StickySession"));
- Assert.assertEquals("Yes",
parameters.get("StickySessionRemove"));
- Assert.assertEquals("No",
parameters.get("StickySessionForce"));
- Assert.assertEquals("6", parameters.get("WaitWorker"));
- Assert.assertEquals("7", parameters.get("Maxattempts"));
-
- request = requests.get(1);
- parameters = request.getParameters();
-
- Assert.assertSame(MCMPRequestType.ENABLE_APP, request.getRequestType());
- Assert.assertFalse(request.isWildcard());
- Assert.assertEquals("host1", request.getJvmRoute());
- Assert.assertEquals(2, parameters.size());
- Assert.assertEquals("/context", parameters.get("Context"));
- Assert.assertEquals("host,alias1,alias2",
parameters.get("Alias"));
-
- EasyMock.reset(server, service, engine, container, context, host);
- }
@Test
public void getProxyConfiguration()