1 22 package org.jboss.test; 23 24 import org.jboss.jmx.adaptor.rmi.RMIAdaptor; 25 26 import junit.framework.Test; 27 import junit.framework.TestSuite; 28 29 37 public class JBossClusteredTestCase extends JBossTestCase 38 { 39 JBossTestClusteredServices clusterServices; 40 41 43 46 public static AbstractTestDelegate getDelegate(Class clazz) throws Exception 47 { 48 AbstractTestDelegate delegate = new JBossTestClusteredServices(clazz); 49 return delegate; 50 } 51 52 public JBossClusteredTestCase(String name) 53 { 54 super(name); 55 } 56 57 @Override 58 protected void setUp() throws Exception 59 { 60 super.setUp(); 61 clusterServices = (JBossTestClusteredServices) delegate; 62 } 63 64 66 67 68 public void testServerFound() throws Exception 69 { 70 if (deploymentException != null) 71 throw deploymentException; 72 assertTrue("Server was not found", getServers() != null); 73 } 74 75 76 public RMIAdaptor[] getAdaptors() throws Exception 77 { 78 return clusterServices.getAdaptors(); 79 } 80 81 public String [] getServers() throws Exception 82 { 83 return clusterServices.getServers(); 84 } 85 86 public String [] getNamingURLs() throws Exception 87 { 88 return clusterServices.getNamingURLs(); 89 } 90 public String [] getHANamingURLs() throws Exception 91 { 92 return clusterServices.getHANamingURLs(); 93 } 94 public String [] getHttpURLs() throws Exception 95 { 96 return clusterServices.getHttpURLs(); 97 } 98 99 protected void deploy(RMIAdaptor server, String name) throws Exception 100 { 101 clusterServices.deploy(server, name); 102 } 103 104 protected void redeploy(RMIAdaptor server, String name) throws Exception 105 { 106 clusterServices.redeploy(server, name); 107 } 108 109 protected void undeploy(RMIAdaptor server, String name) throws Exception 110 { 111 clusterServices.undeploy(server, name); 112 } 113 114 public static Test getDeploySetup(final Test test, final String jarName) 115 throws Exception 116 { 117 return new JBossTestClusteredSetup(test, jarName); 118 } 119 120 public static Test getDeploySetup(final Class clazz, final String jarName) 121 throws Exception 122 { 123 TestSuite suite = new TestSuite(); 124 suite.addTest(new TestSuite(clazz)); 125 return getDeploySetup(suite, jarName); 126 } 127 128 131 public void setServerNames(String [] snames) throws Exception 132 { 133 ((JBossTestClusteredServices) delegate).setServerNames(snames); 134 } 135 136 138 140 } 141 | Popular Tags |