1 22 package org.jboss.ejb3.test.clusteredservice.unit; 23 24 import java.net.URL ; 25 26 import javax.management.Attribute ; 27 import javax.management.MBeanServerConnection ; 28 import javax.management.ObjectName ; 29 30 import junit.framework.Test; 31 32 import org.jboss.test.JBossTestCase; 33 34 38 public class ServiceTestCase extends JBossTestCase 39 { 40 private static String REALM = "JBossTest Servlets"; 41 private String node1URL = "http://jduke:theduke@localhost:8080/"; 42 private String node2URL = "http://jduke:theduke@localhost:8180/"; 43 44 private static final String USE_JBOSS = "UseJBossWebLoader"; 45 46 public ServiceTestCase(String name) 47 { 48 super(name); 49 } 50 51 public void testEJBServlet() throws Exception 52 { 53 MBeanServerConnection server = getServer(); 54 ObjectName tomcat = new ObjectName ("jboss.web:service=WebServer"); 55 56 try { 57 server.setAttribute(tomcat, new Attribute (USE_JBOSS, true)); 58 59 assertTrue((Boolean )server.getAttribute(tomcat, USE_JBOSS)); 60 61 try 62 { 63 URL url = new URL (node1URL+"clusteredservice/EJBServlet"); 64 HttpUtils.accessURL(url); 65 HttpUtils.accessURL(url); 66 } catch (Exception e) 67 { 68 } 69 70 try 71 { 72 URL url = new URL (node2URL+"clusteredservice/EJBServlet"); 73 HttpUtils.accessURL(url); 74 HttpUtils.accessURL(url); 75 } catch (Exception e) 76 { 77 } 78 } 79 finally 80 { 81 server.setAttribute(tomcat, new Attribute (USE_JBOSS, false)); 82 } 83 } 84 85 88 public static Test suite() throws Exception 89 { 90 return getDeploySetup(ServiceTestCase.class, ""); 91 } 92 93 94 } 95 | Popular Tags |