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