gdamour     2005/03/25 06:23:41

  Modified:    modules/core/src/test/org/openejb/server/httpd
                        HttpServerTest.java
  Log:

  ServicePool uses now a Thread pool under the cover. This pool is either
  created or provided.
  
  Use the default Geronimo Thread pool under the cover of StandardServiceStack.
  
  Revision  Changes    Path
  1.7       +28 -6     
openejb/modules/core/src/test/org/openejb/server/httpd/HttpServerTest.java
  
  Index: HttpServerTest.java
  ===================================================================
  RCS file: 
/home/projects/openejb/scm/openejb/modules/core/src/test/org/openejb/server/httpd/HttpServerTest.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- HttpServerTest.java       3 Jan 2005 22:34:07 -0000       1.6
  +++ HttpServerTest.java       25 Mar 2005 11:23:40 -0000      1.7
  @@ -47,9 +47,11 @@
   import java.net.HttpURLConnection;
   import java.net.InetAddress;
   import java.net.URL;
  +
   import javax.management.ObjectName;
   
   import junit.framework.TestCase;
  +
   import org.apache.geronimo.gbean.GBeanData;
   import org.apache.geronimo.gbean.GBeanInfo;
   import org.apache.geronimo.gbean.GBeanInfoBuilder;
  @@ -58,8 +60,12 @@
   import org.apache.geronimo.kernel.Kernel;
   import org.apache.geronimo.kernel.jmx.JMXUtil;
   import org.apache.geronimo.kernel.management.State;
  -import org.apache.log4j.BasicConfigurator;
  -import org.openejb.server.*;
  +import org.apache.geronimo.pool.ThreadPool;
  +import org.openejb.server.ServerService;
  +import org.openejb.server.ServiceDaemon;
  +import org.openejb.server.StandardServiceStack;
  +import org.openejb.server.StandardServiceStackGBean;
  +import org.openejb.server.SynchChannelServerDaemon;
   
   public class HttpServerTest extends TestCase {
   
  @@ -114,7 +120,10 @@
   
       public void testServiceStack() throws Exception {
           ServerService service = new HttpServer(new TestHttpListener());
  -        StandardServiceStack serviceStack = new StandardServiceStack("HTTP", 
0, InetAddress.getByName("localhost"), null, 1, 5, null, null, service);
  +
  +        ThreadPool threadPool = new ThreadPool(1, "Test", 1000, 
getClass().getClassLoader());
  +        
  +        StandardServiceStack serviceStack = new StandardServiceStack("HTTP", 
0, InetAddress.getByName("localhost"), null, null, null, threadPool, service);
           HttpURLConnection connection = null;
   
           try {
  @@ -141,7 +150,9 @@
           ObjectName server = HttpServerGBean.addGBean(kernel, "HTTP", 
listener);
           ServerService service = (ServerService) 
kernel.getProxyManager().createProxy(server, ServerService.class);
   
  -        StandardServiceStack serviceStack = new StandardServiceStack("HTTP", 
0, InetAddress.getByName("localhost"), null, 1, 5, null, null, service);
  +        ThreadPool threadPool = new ThreadPool(1, "Test", 1000, 
getClass().getClassLoader());
  +
  +        StandardServiceStack serviceStack = new StandardServiceStack("HTTP", 
0, InetAddress.getByName("localhost"), null, null, null, threadPool, service);
           HttpURLConnection connection = null;
   
           try {
  @@ -167,7 +178,18 @@
   
           ObjectName listener = TestHttpListener.addGBean(kernel, "HTTP");
           ObjectName server = HttpServerGBean.addGBean(kernel, "HTTP", 
listener);
  -        ObjectName stack = StandardServiceStackGBean.addGBean(kernel, 
"HTTP", 0, InetAddress.getByName("localhost"), null, 1, 5, null, null, server);
  +        
  +        ClassLoader cl = ThreadPool.class.getClassLoader();
  +        ObjectName executor = 
JMXUtil.getObjectName("openejb:name=ThreadPool");
  +        GBeanData gbean = new GBeanData(executor, ThreadPool.GBEAN_INFO);
  +        gbean.setAttribute("poolSize", new Integer(1));
  +        gbean.setAttribute("poolName", "Test");
  +        gbean.setAttribute("keepAliveTime", new Long(1000));
  +        gbean.setAttribute("classLoader", cl);
  +        kernel.loadGBean(gbean, cl);
  +        kernel.startGBean(executor);
  +
  +        ObjectName stack = StandardServiceStackGBean.addGBean(kernel, 
"HTTP", 0, InetAddress.getByName("localhost"), null, null, null, executor, 
server);
   
           assertRunning(kernel, listener);
           assertRunning(kernel, server);
  
  
  

Reply via email to