Author: pferraro
Date: 2008-10-22 12:21:27 -0400 (Wed, 22 Oct 2008)
New Revision: 1983
Modified:
trunk/mod_cluster/src/main/java/org/jboss/modcluster/DefaultJBossWebEventHandler.java
trunk/mod_cluster/src/test/java/org/jboss/modcluster/DefaultJBossWebEventHandlerTestCase.java
Log:
Unit tests pass again
Modified:
trunk/mod_cluster/src/main/java/org/jboss/modcluster/DefaultJBossWebEventHandler.java
===================================================================
---
trunk/mod_cluster/src/main/java/org/jboss/modcluster/DefaultJBossWebEventHandler.java 2008-10-22
14:04:01 UTC (rev 1982)
+++
trunk/mod_cluster/src/main/java/org/jboss/modcluster/DefaultJBossWebEventHandler.java 2008-10-22
16:21:27 UTC (rev 1983)
@@ -146,19 +146,17 @@
{
this.checkInit();
- Service[] services = server.findServices();
- for (Service service: services)
+ for (Service service: server.findServices())
{
Engine engine = (Engine) service.getContainer();
this.config(engine);
- Container[] children = engine.findChildren();
- for (Container element: children)
+
+ for (Container host: engine.findChildren())
{
- Container[] children2 = element.findChildren();
- for (Container element2: children2)
+ for (Container context: host.findChildren())
{
- this.addContext((Context) element2);
+ this.addContext((Context) context);
}
}
}
@@ -172,20 +170,17 @@
{
this.checkInit();
- Service[] services = server.findServices();
- for (Service service : services)
+ for (Service service: server.findServices())
{
Engine engine = (Engine) service.getContainer();
this.removeAll(engine);
- Container[] children = engine.findChildren();
- for (Container element : children)
+ for (Container host: engine.findChildren())
{
- Container[] children2 = element.findChildren();
- for (Container element2 : children2)
+ for (Container context: host.findChildren())
{
- this.removeContext((Context) element2);
+ this.removeContext((Context) context);
}
}
}
Modified:
trunk/mod_cluster/src/test/java/org/jboss/modcluster/DefaultJBossWebEventHandlerTestCase.java
===================================================================
---
trunk/mod_cluster/src/test/java/org/jboss/modcluster/DefaultJBossWebEventHandlerTestCase.java 2008-10-22
14:04:01 UTC (rev 1982)
+++
trunk/mod_cluster/src/test/java/org/jboss/modcluster/DefaultJBossWebEventHandlerTestCase.java 2008-10-22
16:21:27 UTC (rev 1983)
@@ -28,8 +28,6 @@
import java.util.Map;
import java.util.Set;
-import junit.framework.TestCase;
-
import org.apache.catalina.Container;
import org.apache.catalina.Context;
import org.apache.catalina.Engine;
@@ -50,12 +48,16 @@
import org.jboss.modcluster.mcmp.MCMPRequest;
import org.jboss.modcluster.mcmp.MCMPRequestType;
import org.jboss.modcluster.mcmp.MCMPServerState;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
/**
* @author Paul Ferraro
*
*/
-public class DefaultJBossWebEventHandlerTestCase extends TestCase
+@SuppressWarnings("boxing")
+public class DefaultJBossWebEventHandlerTestCase
{
private final NodeConfiguration nodeConfig =
EasyMock.createStrictMock(NodeConfiguration.class);
private final BalancerConfiguration balancerConfig =
EasyMock.createStrictMock(BalancerConfiguration.class);
@@ -70,13 +72,14 @@
* @{inheritDoc}
* @see junit.framework.TestCase#setUp()
*/
- @Override
- protected void setUp() throws Exception
+ @Before
+ public void construct() throws Exception
{
this.handler = new DefaultJBossWebEventHandler(this.nodeConfig,
this.balancerConfig, this.mcmpConfig, this.mcmpHandler, this.provider,
this.listenerFactory);
}
- public void testInit() throws IOException
+ @Test
+ public void init() throws IOException
{
InetAddress localAddress = InetAddress.getLocalHost();
String localHostName = localAddress.getHostName();
@@ -153,7 +156,8 @@
EasyMock.reset(this.mcmpHandler, this.listenerFactory, this.mcmpConfig, listener);
}
- public void testShutdown() throws IOException
+ @Test
+ public void shutdown() throws IOException
{
// Test w/out advertise listener
this.mcmpHandler.shutdown();
@@ -203,79 +207,84 @@
EasyMock.reset(this.mcmpHandler, listener);
}
- public void testAddContext() throws IOException
+ @Test
+ public void addContext() throws IOException
{
Context context = EasyMock.createStrictMock(Context.class);
+ EasyMock.replay(context);
+
// Test not initialized
try
{
this.handler.addContext(context);
- fail();
+ Assert.fail();
}
catch (IllegalStateException e)
{
// Expected
}
- testInit();
+ EasyMock.verify(context);
+ EasyMock.reset(context);
+
+ init();
+ Host host = EasyMock.createStrictMock(Host.class);
+
// Test context not started
- Container container = EasyMock.createStrictMock(Container.class);
+ recordAddContext(context, host);
- recordAddContext(context, container);
+ EasyMock.replay(context, host);
- EasyMock.replay(context, container);
-
this.handler.addContext(context);
- EasyMock.verify(context, container);
- EasyMock.reset(context, container);
+ EasyMock.verify(context, host);
+ EasyMock.reset(context, host);
// Test context started
Engine engine = EasyMock.createStrictMock(Engine.class);
- Host host = EasyMock.createStrictMock(Host.class);
Capture<MCMPRequest> capturedRequest = new Capture<MCMPRequest>();
// Expect log message
EasyMock.expect(context.getPath()).andReturn("/context");
- EasyMock.expect(context.getParent()).andReturn(container);
- EasyMock.expect(container.getName()).andReturn("parent-container");
+ EasyMock.expect(context.getParent()).andReturn(host);
+ EasyMock.expect(host.getName()).andReturn("host");
EasyMock.expect(context.isStarted()).andReturn(true);
// Building request
- EasyMock.expect(context.getPath()).andReturn("/context");
EasyMock.expect(context.getParent()).andReturn(host);
+ EasyMock.expect(host.getParent()).andReturn(engine);
+ EasyMock.expect(engine.getJvmRoute()).andReturn("host1");
+ EasyMock.expect(context.getParent()).andReturn(host);
EasyMock.expect(host.getName()).andReturn("host");
EasyMock.expect(host.findAliases()).andReturn(new String[] { "alias1",
"alias2" });
- EasyMock.expect(context.getParent()).andReturn(container);
- EasyMock.expect(container.getParent()).andReturn(engine);
- EasyMock.expect(engine.getJvmRoute()).andReturn("host1");
+ EasyMock.expect(context.getPath()).andReturn("/context");
this.mcmpHandler.sendRequest(EasyMock.capture(capturedRequest));
- EasyMock.replay(this.mcmpHandler, context, container, engine, host);
+ EasyMock.replay(this.mcmpHandler, context, engine, host);
this.handler.addContext(context);
- EasyMock.verify(this.mcmpHandler, context, container, engine, host);
+ EasyMock.verify(this.mcmpHandler, context, engine, host);
MCMPRequest request = capturedRequest.getValue();
- assertSame(MCMPRequestType.ENABLE_APP, request.getRequestType());
- assertFalse(request.isWildcard());
- assertEquals("host1", request.getJvmRoute());
+ Assert.assertSame(MCMPRequestType.ENABLE_APP, request.getRequestType());
+ Assert.assertFalse(request.isWildcard());
+ Assert.assertEquals("host1", request.getJvmRoute());
Map<String, String> parameters = request.getParameters();
- assertEquals(2, parameters.size());
+ Assert.assertEquals(2, parameters.size());
- assertEquals("/context", parameters.get("Context"));
- assertEquals("host,alias1,alias2", parameters.get("Alias"));
+ Assert.assertEquals("/context", parameters.get("Context"));
+ Assert.assertEquals("host,alias1,alias2",
parameters.get("Alias"));
- EasyMock.reset(this.mcmpHandler, context, container, engine, host);
+ EasyMock.reset(this.mcmpHandler, context, engine, host);
}
private void recordAddContext(Context context, Container container)
@@ -283,211 +292,227 @@
// Expect log message
EasyMock.expect(context.getPath()).andReturn("/context");
EasyMock.expect(context.getParent()).andReturn(container);
- EasyMock.expect(container.getName()).andReturn("parent-container");
+ EasyMock.expect(container.getName()).andReturn("host");
EasyMock.expect(context.isStarted()).andReturn(false);
}
- public void testStartContext() throws IOException
+ @Test
+ public void startContext() throws IOException
{
Context context = EasyMock.createStrictMock(Context.class);
+ EasyMock.replay(context);
+
// Test not initialized
try
{
this.handler.startContext(context);
- fail();
+ Assert.fail();
}
catch (IllegalStateException e)
{
// Expected
}
- testInit();
+ EasyMock.verify(context);
+ EasyMock.reset(context);
+
+ init();
// Test initialized
- Container container = EasyMock.createStrictMock(Container.class);
Engine engine = EasyMock.createStrictMock(Engine.class);
Host host = EasyMock.createStrictMock(Host.class);
Capture<MCMPRequest> capturedRequest = new Capture<MCMPRequest>();
// Expect log message
EasyMock.expect(context.getPath()).andReturn("/context");
- EasyMock.expect(context.getParent()).andReturn(container);
- EasyMock.expect(container.getName()).andReturn("parent-container");
-
+ EasyMock.expect(context.getParent()).andReturn(host);
+ EasyMock.expect(host.getName()).andReturn("host");
+
// Building request
- EasyMock.expect(context.getPath()).andReturn("/context");
EasyMock.expect(context.getParent()).andReturn(host);
+ EasyMock.expect(host.getParent()).andReturn(engine);
+ EasyMock.expect(engine.getJvmRoute()).andReturn("host1");
+ EasyMock.expect(context.getParent()).andReturn(host);
EasyMock.expect(host.getName()).andReturn("host");
EasyMock.expect(host.findAliases()).andReturn(new String[] { "alias1",
"alias2" });
- EasyMock.expect(context.getParent()).andReturn(container);
- EasyMock.expect(container.getParent()).andReturn(engine);
- EasyMock.expect(engine.getJvmRoute()).andReturn("host1");
+ EasyMock.expect(context.getPath()).andReturn("/context");
this.mcmpHandler.sendRequest(EasyMock.capture(capturedRequest));
- EasyMock.replay(this.mcmpHandler, context, container, engine, host);
+ EasyMock.replay(this.mcmpHandler, context, engine, host);
this.handler.startContext(context);
- EasyMock.verify(this.mcmpHandler, context, container, engine, host);
+ EasyMock.verify(this.mcmpHandler, context, engine, host);
MCMPRequest request = capturedRequest.getValue();
- assertSame(MCMPRequestType.ENABLE_APP, request.getRequestType());
- assertFalse(request.isWildcard());
- assertEquals("host1", request.getJvmRoute());
+ Assert.assertSame(MCMPRequestType.ENABLE_APP, request.getRequestType());
+ Assert.assertFalse(request.isWildcard());
+ Assert.assertEquals("host1", request.getJvmRoute());
Map<String, String> parameters = request.getParameters();
- assertEquals(2, parameters.size());
+ Assert.assertEquals(2, parameters.size());
- assertEquals("/context", parameters.get("Context"));
- assertEquals("host,alias1,alias2", parameters.get("Alias"));
+ Assert.assertEquals("/context", parameters.get("Context"));
+ Assert.assertEquals("host,alias1,alias2",
parameters.get("Alias"));
- EasyMock.reset(this.mcmpHandler, context, container, engine, host);
+ EasyMock.reset(this.mcmpHandler, context, engine, host);
}
- public void testStopContext() throws IOException
+ @Test
+ public void stopContext() throws IOException
{
Context context = EasyMock.createStrictMock(Context.class);
+ EasyMock.replay(context);
+
// Test not initialized
try
{
this.handler.stopContext(context);
- fail();
+ Assert.fail();
}
catch (IllegalStateException e)
{
// Expected
}
-
- testInit();
+ EasyMock.verify(context);
+ EasyMock.reset(context);
+
+ init();
+
// Test initialized
- Container container = EasyMock.createStrictMock(Container.class);
Engine engine = EasyMock.createStrictMock(Engine.class);
Host host = EasyMock.createStrictMock(Host.class);
Capture<MCMPRequest> capturedRequest = new Capture<MCMPRequest>();
-
+
// Expect log message
EasyMock.expect(context.getPath()).andReturn("/context");
- EasyMock.expect(context.getParent()).andReturn(container);
- EasyMock.expect(container.getName()).andReturn("parent-container");
-
+ EasyMock.expect(context.getParent()).andReturn(host);
+ EasyMock.expect(host.getName()).andReturn("host");
+
// Building request
- EasyMock.expect(context.getPath()).andReturn("/context");
EasyMock.expect(context.getParent()).andReturn(host);
+ EasyMock.expect(host.getParent()).andReturn(engine);
+ EasyMock.expect(engine.getJvmRoute()).andReturn("host1");
+ EasyMock.expect(context.getParent()).andReturn(host);
EasyMock.expect(host.getName()).andReturn("host");
EasyMock.expect(host.findAliases()).andReturn(new String[] { "alias1",
"alias2" });
- EasyMock.expect(context.getParent()).andReturn(container);
- EasyMock.expect(container.getParent()).andReturn(engine);
- EasyMock.expect(engine.getJvmRoute()).andReturn("host1");
+ EasyMock.expect(context.getPath()).andReturn("/context");
this.mcmpHandler.sendRequest(EasyMock.capture(capturedRequest));
- EasyMock.replay(this.mcmpHandler, context, container, engine, host);
+ EasyMock.replay(this.mcmpHandler, context, engine, host);
this.handler.stopContext(context);
- EasyMock.verify(this.mcmpHandler, context, container, engine, host);
+ EasyMock.verify(this.mcmpHandler, context, engine, host);
MCMPRequest request = capturedRequest.getValue();
- assertSame(MCMPRequestType.STOP_APP, request.getRequestType());
- assertFalse(request.isWildcard());
- assertEquals("host1", request.getJvmRoute());
+ Assert.assertSame(MCMPRequestType.STOP_APP, request.getRequestType());
+ Assert.assertFalse(request.isWildcard());
+ Assert.assertEquals("host1", request.getJvmRoute());
Map<String, String> parameters = request.getParameters();
- assertEquals(2, parameters.size());
+ Assert.assertEquals(2, parameters.size());
- assertEquals("/context", parameters.get("Context"));
- assertEquals("host,alias1,alias2", parameters.get("Alias"));
+ Assert.assertEquals("/context", parameters.get("Context"));
+ Assert.assertEquals("host,alias1,alias2",
parameters.get("Alias"));
- EasyMock.reset(this.mcmpHandler, context, container, engine, host);
+ EasyMock.reset(this.mcmpHandler, context, engine, host);
}
- public void testRemoveContext() throws IOException
+ @Test
+ public void removeContext() throws IOException
{
Context context = EasyMock.createStrictMock(Context.class);
+ EasyMock.replay(context);
+
// Test not initialized
try
{
this.handler.removeContext(context);
- fail();
+ Assert.fail();
}
catch (IllegalStateException e)
{
// Expected
}
+
+ EasyMock.verify(context);
+ EasyMock.reset(context);
- testInit();
+ init();
// Test initialized - no jvm route
- Container container = EasyMock.createStrictMock(Container.class);
Engine engine = EasyMock.createStrictMock(Engine.class);
+ Host host = EasyMock.createStrictMock(Host.class);
- this.recordRemoveContext(context, container, engine);
+ this.recordRemoveContext(context, host, engine);
- EasyMock.replay(context, container, engine);
+ EasyMock.replay(context, host, engine);
this.handler.removeContext(context);
- EasyMock.verify(context, container, engine);
- EasyMock.reset(context, container, engine);
+ EasyMock.verify(context, host, engine);
+ EasyMock.reset(context, host, engine);
// Test initialized - jvm route exists
- Host host = EasyMock.createStrictMock(Host.class);
Capture<MCMPRequest> capturedRequest = new Capture<MCMPRequest>();
// Expect log message
EasyMock.expect(context.getPath()).andReturn("/context");
- EasyMock.expect(context.getParent()).andReturn(container);
- EasyMock.expect(container.getName()).andReturn("parent-container");
-
- EasyMock.expect(context.getParent()).andReturn(container);
- EasyMock.expect(container.getParent()).andReturn(engine);
+ EasyMock.expect(context.getParent()).andReturn(host);
+ EasyMock.expect(host.getName()).andReturn("host");
+
+ // jvm route null check
+ EasyMock.expect(context.getParent()).andReturn(host);
+ EasyMock.expect(host.getParent()).andReturn(engine);
EasyMock.expect(engine.getJvmRoute()).andReturn("host1");
-
+
// Building request
- EasyMock.expect(context.getPath()).andReturn("/context");
EasyMock.expect(context.getParent()).andReturn(host);
+ EasyMock.expect(host.getParent()).andReturn(engine);
+ EasyMock.expect(engine.getJvmRoute()).andReturn("host1");
+ EasyMock.expect(context.getParent()).andReturn(host);
EasyMock.expect(host.getName()).andReturn("host");
EasyMock.expect(host.findAliases()).andReturn(new String[] { "alias1",
"alias2" });
- EasyMock.expect(context.getParent()).andReturn(container);
- EasyMock.expect(container.getParent()).andReturn(engine);
- EasyMock.expect(engine.getJvmRoute()).andReturn("host1");
+ EasyMock.expect(context.getPath()).andReturn("/context");
this.mcmpHandler.sendRequest(EasyMock.capture(capturedRequest));
- EasyMock.replay(this.mcmpHandler, context, container, engine, host);
+ EasyMock.replay(this.mcmpHandler, context, engine, host);
this.handler.removeContext(context);
- EasyMock.verify(this.mcmpHandler, context, container, engine, host);
+ EasyMock.verify(this.mcmpHandler, context, engine, host);
MCMPRequest request = capturedRequest.getValue();
- assertSame(MCMPRequestType.REMOVE_APP, request.getRequestType());
- assertFalse(request.isWildcard());
- assertEquals("host1", request.getJvmRoute());
+ Assert.assertSame(MCMPRequestType.REMOVE_APP, request.getRequestType());
+ Assert.assertFalse(request.isWildcard());
+ Assert.assertEquals("host1", request.getJvmRoute());
Map<String, String> parameters = request.getParameters();
- assertEquals(2, parameters.size());
+ Assert.assertEquals(2, parameters.size());
- assertEquals("/context", parameters.get("Context"));
- assertEquals("host,alias1,alias2", parameters.get("Alias"));
+ Assert.assertEquals("/context", parameters.get("Context"));
+ Assert.assertEquals("host,alias1,alias2",
parameters.get("Alias"));
- EasyMock.reset(this.mcmpHandler, context, container, engine, host);
+ EasyMock.reset(this.mcmpHandler, context, engine, host);
}
private void recordRemoveContext(Context context, Container container, Engine engine)
@@ -502,23 +527,29 @@
EasyMock.expect(engine.getJvmRoute()).andReturn(null);
}
- public void testStatus() throws IOException
+ @Test
+ public void status() throws IOException
{
Engine engine = EasyMock.createStrictMock(Engine.class);
+
+ EasyMock.replay(engine);
// Test not initialized
try
{
this.handler.status(engine);
- fail();
+ Assert.fail();
}
catch (IllegalStateException e)
{
// Expected
}
+
+ EasyMock.verify(engine);
+ EasyMock.reset(engine);
- testInit();
+ init();
// Test initialized
Capture<MCMPRequest> capturedRequest = new Capture<MCMPRequest>();
@@ -541,46 +572,51 @@
MCMPRequest request = capturedRequest.getValue();
- assertSame(MCMPRequestType.STATUS, request.getRequestType());
- assertFalse(request.isWildcard());
- assertEquals("host1", request.getJvmRoute());
+ Assert.assertSame(MCMPRequestType.STATUS, request.getRequestType());
+ Assert.assertFalse(request.isWildcard());
+ Assert.assertEquals("host1", request.getJvmRoute());
Map<String, String> parameters = request.getParameters();
- assertEquals(1, parameters.size());
- assertEquals("10", parameters.get("Load"));
+ Assert.assertEquals(1, parameters.size());
+ Assert.assertEquals("10", parameters.get("Load"));
EasyMock.reset(this.mcmpHandler, this.provider, engine);
}
- public void testStartServer() throws Exception
+ @Test
+ public void startServer() throws Exception
{
Server server = EasyMock.createStrictMock(Server.class);
+ EasyMock.replay(server);
+
// Test not initialized
try
{
this.handler.startServer(server);
- fail();
+ Assert.fail();
}
catch (IllegalStateException e)
{
// Expected
}
- testInit();
+ EasyMock.verify(server);
+ EasyMock.reset(server);
+ init();
+
// Test initialized
Service service = EasyMock.createStrictMock(Service.class);
Engine engine = EasyMock.createStrictMock(Engine.class);
- Container container = EasyMock.createStrictMock(Container.class);
+ Host host = EasyMock.createStrictMock(Host.class);
Context context = EasyMock.createStrictMock(Context.class);
Capture<MCMPRequest> capturedRequest = new Capture<MCMPRequest>();
Connector connector = new Connector("AJP/1.3");
EasyMock.expect(server.findServices()).andReturn(new Service[] { service });
-
EasyMock.expect(service.getContainer()).andReturn(engine);
// Expect log message
@@ -592,9 +628,9 @@
Set<MCMPServerState> states = Collections.emptySet();
EasyMock.expect(this.mcmpHandler.getProxyStates()).andReturn(states);
+ EasyMock.expect(engine.getJvmRoute()).andReturn("host1");
EasyMock.expect(engine.getService()).andReturn(service);
EasyMock.expect(service.findConnectors()).andReturn(new Connector[] { connector
});
- EasyMock.expect(engine.getJvmRoute()).andReturn("host1");
EasyMock.expect(this.nodeConfig.getDomain()).andReturn("domain");
EasyMock.expect(this.nodeConfig.getFlushPackets()).andReturn(Boolean.TRUE);
@@ -613,46 +649,47 @@
this.mcmpHandler.sendRequest(EasyMock.capture(capturedRequest));
- EasyMock.expect(engine.findChildren()).andReturn(new Container[] { container });
- EasyMock.expect(container.findChildren()).andReturn(new Container[] { context });
- this.recordAddContext(context, container);
+ EasyMock.expect(engine.findChildren()).andReturn(new Container[] { host });
+ EasyMock.expect(host.findChildren()).andReturn(new Container[] { context });
+ this.recordAddContext(context, host);
- EasyMock.replay(this.mcmpHandler, this.nodeConfig, this.balancerConfig, server,
service, engine, container, context);
+ EasyMock.replay(this.mcmpHandler, this.nodeConfig, this.balancerConfig, server,
service, engine, host, context);
this.handler.startServer(server);
- EasyMock.verify(this.mcmpHandler, this.nodeConfig, this.balancerConfig, server,
service, engine, container, context);
+ EasyMock.verify(this.mcmpHandler, this.nodeConfig, this.balancerConfig, server,
service, engine, host, context);
MCMPRequest request = capturedRequest.getValue();
- assertSame(MCMPRequestType.CONFIG, request.getRequestType());
- assertFalse(request.isWildcard());
- assertEquals("host1", request.getJvmRoute());
+ Assert.assertSame(MCMPRequestType.CONFIG, request.getRequestType());
+ Assert.assertFalse(request.isWildcard());
+ Assert.assertEquals("host1", request.getJvmRoute());
Map<String, String> parameters = request.getParameters();
- assertEquals(16, parameters.size());
- assertEquals("127.0.0.1", parameters.get("Host"));
- assertEquals("0", parameters.get("Port"));
- assertEquals("ajp", parameters.get("Type"));
- assertEquals("domain", parameters.get("Domain"));
- assertEquals("On", parameters.get("flushpackets"));
- assertEquals("1", parameters.get("flushwait"));
- assertEquals("2", parameters.get("ping"));
- assertEquals("3", parameters.get("smax"));
- assertEquals("4", parameters.get("ttl"));
- assertEquals("5", parameters.get("Timeout"));
- assertEquals("S", parameters.get("Balancer"));
- assertEquals("No", parameters.get("StickySession"));
- assertEquals("Yes", parameters.get("StickySessionRemove"));
- assertEquals("No", parameters.get("StickySessionForce"));
- assertEquals("6", parameters.get("WaitWorker"));
- assertEquals("7", parameters.get("Maxattempts"));
+ 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"));
- EasyMock.reset(this.mcmpHandler, this.nodeConfig, this.balancerConfig, server,
service, engine, container, context);
+ EasyMock.reset(this.mcmpHandler, this.nodeConfig, this.balancerConfig, server,
service, engine, host, context);
}
- public void testStopServer() throws IOException
+ @Test
+ public void stopServer() throws IOException
{
Server server = EasyMock.createStrictMock(Server.class);
@@ -661,14 +698,14 @@
{
this.handler.stopServer(server);
- fail();
+ Assert.fail();
}
catch (IllegalStateException e)
{
// Expected
}
- testInit();
+ init();
// Test initialized
Service service = EasyMock.createStrictMock(Service.class);
@@ -699,10 +736,10 @@
MCMPRequest request = capturedRequest.getValue();
- assertSame(MCMPRequestType.REMOVE_APP, request.getRequestType());
- assertTrue(request.isWildcard());
- assertEquals("host1", request.getJvmRoute());
- assertTrue(request.getParameters().isEmpty());
+ Assert.assertSame(MCMPRequestType.REMOVE_APP, request.getRequestType());
+ Assert.assertTrue(request.isWildcard());
+ Assert.assertEquals("host1", request.getJvmRoute());
+ Assert.assertTrue(request.getParameters().isEmpty());
EasyMock.reset(this.mcmpHandler, this.nodeConfig, this.balancerConfig, server,
service, engine, container, context);
}