1 37 package net.sourceforge.cruisecontrol.webtest; 38 39 import java.io.IOException ; 40 41 import javax.management.AttributeNotFoundException ; 42 import javax.management.InstanceNotFoundException ; 43 import javax.management.MBeanException ; 44 import javax.management.ReflectionException ; 45 46 import org.jdom.JDOMException; 47 48 import junit.framework.TestCase; 49 import junit.framework.Assert; 50 import net.sourceforge.cruisecontrol.interceptor.PluginLocator; 51 import net.sourceforge.cruisecontrol.Configuration; 52 import net.sourceforge.cruisecontrol.PluginDetail; 53 import net.sourceforge.cruisecontrol.CruiseControlException; 54 import net.sourceforge.cruisecontrol.PluginType; 55 56 public class PluginLocatorTest extends TestCase { 57 private PluginLocator locator; 58 59 protected void setUp() throws Exception { 60 super.setUp(); 61 Configuration configuration = new Configuration("localhost", 7856); 62 locator = new PluginLocator(configuration); 63 } 64 65 public void testGetAvailableBootstrappers() throws AttributeNotFoundException , InstanceNotFoundException , 66 MBeanException , ReflectionException , IOException { 67 PluginDetail[] bootstrappers = locator.getAvailablePlugins("bootstrappers"); 68 assertNotNull(bootstrappers); 69 assertTrue(0 < bootstrappers.length); 70 } 71 72 public void testGetAvailablePublishers() throws AttributeNotFoundException , InstanceNotFoundException , 73 MBeanException , ReflectionException , IOException { 74 PluginDetail[] publishers = locator.getAvailablePlugins("publishers"); 75 assertNotNull(publishers); 76 assertTrue(0 < publishers.length); 77 } 78 79 public void testGetAvailableSourceControls() throws AttributeNotFoundException , InstanceNotFoundException , 80 MBeanException , ReflectionException , IOException { 81 PluginDetail[] sourceControls = locator.getAvailablePlugins("modificationset"); 82 assertNotNull(sourceControls); 83 assertTrue(0 < sourceControls.length); 84 } 85 86 public void testGetConfiguredListeners() throws AttributeNotFoundException , InstanceNotFoundException , 87 MBeanException , ReflectionException , IOException , CruiseControlException, JDOMException { 88 PluginDetail[] listeners = locator.getConfiguredPlugins("connectfour", "listener"); 89 assertNotNull(listeners); 90 assertTrue(1 == listeners.length); 91 } 92 93 public void testGetConfiguredBootstrappers() throws AttributeNotFoundException , InstanceNotFoundException , 94 MBeanException , ReflectionException , IOException , CruiseControlException, JDOMException { 95 PluginDetail[] bootstrappers = locator.getConfiguredPlugins("connectfour", "bootstrapper"); 96 assertNotNull(bootstrappers); 97 assertTrue(1 == bootstrappers.length); 98 } 99 100 public void testGetConfiguredSourceControls() throws AttributeNotFoundException , InstanceNotFoundException , 101 MBeanException , ReflectionException , IOException , CruiseControlException, JDOMException { 102 PluginDetail[] sourceControls = locator.getConfiguredPlugins("connectfour", "sourcecontrol"); 103 assertNotNull(sourceControls); 104 assertTrue(1 == sourceControls.length); 105 } 106 107 public void testGetCVSDetail() throws AttributeNotFoundException , InstanceNotFoundException , MBeanException , 108 ReflectionException , IOException { 109 PluginDetail cvsDetail = locator.getPluginDetail("cvs", "sourcecontrol"); 110 assertEquals("cvs", cvsDetail.getName()); 111 assertEquals("sourcecontrol", cvsDetail.getType().getName()); 112 Assert.assertEquals(PluginType.SOURCE_CONTROL, cvsDetail.getType()); 113 assertEquals(6, cvsDetail.getRequiredAttributes().length); 114 } 115 116 public void testGetSVNDetail() throws AttributeNotFoundException , InstanceNotFoundException , MBeanException , 117 ReflectionException , IOException { 118 PluginDetail svnDetail = locator.getPluginDetail("svn", "sourcecontrol"); 119 assertEquals("svn", svnDetail.getName()); 120 assertEquals("sourcecontrol", svnDetail.getType().getName()); 121 assertEquals(PluginType.SOURCE_CONTROL, svnDetail.getType()); 122 assertEquals(6, svnDetail.getRequiredAttributes().length); 123 } 124 } 125 | Popular Tags |