1 37 package net.sourceforge.cruisecontrol.webtest; 38 39 import net.sourceforge.jwebunit.WebTestCase; 40 import net.sourceforge.cruisecontrol.Configuration; 41 42 public class BootstrapperDetailsWebTest extends WebTestCase { 43 private static final String BASE = "/cruisecontrol/load-details.jspa?" 44 + "project=connectfour&pluginType=bootstrapper"; 45 46 private static final String CVS_URL = BASE + "&pluginName=cvsbootstrapper"; 47 48 private static final String SVN_URL = BASE + "&pluginName=svnbootstrapper"; 49 50 private Configuration configuration; 51 52 private String contents; 53 54 protected void setUp() throws Exception { 55 super.setUp(); 56 57 getTestContext().setBaseUrl("http://localhost:7854"); 58 59 configuration = new Configuration("localhost", 7856); 60 contents = configuration.getConfiguration(); 61 } 62 63 protected void tearDown() throws Exception { 64 super.tearDown(); 65 66 configuration.setConfiguration(contents); 67 } 68 69 public void testShouldBeAccessibleFromBootstrappersPage() { 70 String pluginsUrl = "/cruisecontrol/plugins.jspa?project=connectfour&pluginType=bootstrapper"; 71 72 beginAt(pluginsUrl); 73 assertLinkPresentWithText("cvsbootstrapper"); 74 } 75 76 public void testShouldLoadCVSBootstrapperConfiguration() { 77 beginAt(CVS_URL); 78 assertFormPresent("cvsbootstrapper-details"); 79 assertFormElementPresent("cvsroot"); 80 assertFormElementPresent("file"); 81 assertFormElementPresent("localWorkingCopy"); 82 assertFormElementPresent("overwriteChanges"); 83 assertFormElementPresent("resetStickyTags"); 84 } 85 86 public void testShouldLoadSVNBootstrapperConfiguration() { 87 beginAt(SVN_URL); 88 assertFormPresent("svnbootstrapper-details"); 89 assertFormElementPresent("file"); 90 assertFormElementPresent("localWorkingCopy"); 91 assertFormElementPresent("password"); 92 assertFormElementPresent("username"); 93 } 94 95 public void testShouldSaveCVSBootstrapperConfiguration() { 96 beginAt(CVS_URL); 97 setWorkingForm("cvsbootstrapper-details"); 98 setFormElement("localWorkingCopy", "projects/jakarta-commons/cli"); 99 submit(); 100 assertTextPresent("Updated configuration."); 101 assertFormPresent("cvsbootstrapper-details"); 102 assertFormElementPresent("localWorkingCopy"); 103 assertTextPresent("projects/jakarta-commons/cli"); 104 } 105 106 public void testShouldSaveSVNBootstrapperConfiguration() { 107 beginAt(SVN_URL); 108 setWorkingForm("svnbootstrapper-details"); 109 setFormElement("localWorkingCopy", "repos/trunk/foobar"); 110 submit(); 111 assertTextPresent("Updated configuration."); 112 assertFormPresent("svnbootstrapper-details"); 113 assertFormElementPresent("localWorkingCopy"); 114 assertTextPresent("repos/trunk/foobar"); 115 } 116 117 public void testShouldAllowUsersToClearCVSBootstrapperAttributes() { 118 String cvsroot = "/cvs/foo"; 119 120 beginAt(CVS_URL); 121 setWorkingForm("cvsbootstrapper-details"); 122 setFormElement("cvsroot", cvsroot); 123 submit(); 124 assertTextPresent("Updated configuration."); 125 assertTextPresent(cvsroot); 126 127 gotoPage(CVS_URL); 128 assertTextPresent(cvsroot); 129 setWorkingForm("cvsbootstrapper-details"); 130 setFormElement("cvsroot", ""); 131 submit(); 132 assertTextPresent("Updated configuration."); 133 assertTextNotPresent(cvsroot); 134 135 gotoPage(CVS_URL); 136 assertTextNotPresent(cvsroot); 137 } 138 139 public void testShouldAllowUsersToClearSVNBootstrapperAttributes() { 140 String localWorkingCopy = "/cvs/foo"; 141 142 beginAt(SVN_URL); 143 setWorkingForm("svnbootstrapper-details"); 144 setFormElement("localWorkingCopy", localWorkingCopy); 145 submit(); 146 assertTextPresent("Updated configuration."); 147 assertTextPresent(localWorkingCopy); 148 149 gotoPage(SVN_URL); 150 assertTextPresent(localWorkingCopy); 151 setWorkingForm("svnbootstrapper-details"); 152 setFormElement("localWorkingCopy", ""); 153 submit(); 154 assertTextPresent("Updated configuration."); 155 assertTextNotPresent(localWorkingCopy); 156 157 gotoPage(SVN_URL); 158 assertTextNotPresent(localWorkingCopy); 159 } 160 } 161 | Popular Tags |