1 19 20 package complete; 21 22 import org.netbeans.jellytools.EditorOperator; 23 import org.netbeans.jellytools.NbDialogOperator; 24 import org.netbeans.jellytools.NewWizardOperator; 25 import org.netbeans.jellytools.TopComponentOperator; 26 import org.netbeans.jellytools.actions.OpenAction; 27 import org.netbeans.jellytools.modules.javacvs.output.AnnotateOutputOperator; 28 import org.netbeans.jellytools.modules.javacvs.output.LogOutputOperator; 29 import org.netbeans.jellytools.modules.javacvs.output.StatusOutputOperator; 30 import org.netbeans.jellytools.modules.vcscore.VCSCommandsOutputOperator; 31 import org.netbeans.jellytools.nodes.FilesystemNode; 32 import org.netbeans.jellytools.nodes.Node; 33 import org.netbeans.jellytools.util.StringFilter; 34 import org.netbeans.jemmy.operators.JTextFieldOperator; 35 import org.netbeans.test.oo.gui.jelly.javacvs.AddDialog; 36 import org.netbeans.test.oo.gui.jelly.javacvs.AnnotateDialog; 37 import org.netbeans.test.oo.gui.jelly.javacvs.CommitDialog; 38 import org.netbeans.test.oo.gui.jelly.javacvs.DiffDialog; 39 import org.netbeans.test.oo.gui.jelly.javacvs.LogDialog; 40 import org.netbeans.test.oo.gui.jelly.javacvs.RemoveDialog; 41 import org.netbeans.test.oo.gui.jelly.javacvs.StatusDialog; 42 import org.netbeans.test.oo.gui.jelly.javacvs.TagDialog; 43 import org.netbeans.test.oo.gui.jelly.vcscore.OutputOfVCSCommandsFrame; 44 45 public class BasicCommands extends JCVSStub { 46 47 public BasicCommands(String testName) { 48 super(testName); 49 } 50 51 public static junit.framework.Test suite() { 52 junit.framework.TestSuite suite = new org.netbeans.junit.NbTestSuite(); 54 suite.addTest(new BasicCommands("configure")); 55 suite.addTest(new BasicCommands("testAddDirectoryRecursive")); 56 suite.addTest(new BasicCommands("testAddNoKeywordSubstitution")); 57 suite.addTest(new BasicCommands("testAddKeywordSubstitution")); 58 suite.addTest(new BasicCommands("testTagInit")); 59 suite.addTest(new BasicCommands("testTagDirectory")); 60 suite.addTest(new BasicCommands("testTagAdd")); 61 suite.addTest(new BasicCommands("testTagModified")); 62 suite.addTest(new BasicCommands("testTagByRevision")); 63 suite.addTest(new BasicCommands("testTagForce")); 64 suite.addTest(new BasicCommands("testTagDelete")); 65 suite.addTest(new BasicCommands("testUnmount")); 66 return suite; 67 } 68 69 public static void main(java.lang.String [] args) { 70 junit.textui.TestRunner.run(suite()); 71 } 72 73 GenericNode pac1, subpac1; 74 GenericNode add1, add2, add3; 75 76 GenericNode pac2, subpac2, subpac22; 77 GenericNode tag1, tag2, tag3, tag4, tag51, tag52, tag6; 78 79 protected void createStructure() { 80 pac1 = new GenericNode (root, "pac1"); 81 subpac1 = new GenericNode (pac1, "subpac1"); 82 add1 = new GenericNode (subpac1, "add1"); 83 add2 = new GenericNode (pac1, "add2"); 84 add3 = new GenericNode (pac1, "add3"); 85 86 pac2 = new GenericNode (root, "pac2"); 87 subpac2 = new GenericNode (pac2, "subpac2"); 88 tag1 = new GenericNode (subpac2, "tag1", ".java"); 89 tag2 = new GenericNode (pac2, "tag2", ".java"); 90 tag3 = new GenericNode (pac2, "tag3", ".java"); 91 tag4 = new GenericNode (pac2, "tag4", ".java"); 92 93 subpac22 = new GenericNode (pac2, "subpa22"); 94 tag51 = new GenericNode (subpac22, "tag51"); 95 tag52 = new GenericNode (subpac22, "tag52"); 96 97 tag6 = new GenericNode (pac2, "tag6",".java"); 98 } 99 100 public void configure () { 101 super.configure (); 102 } 103 104 public void dumpStatus (GenericNode node, boolean directory) { 105 closeAllVCSWindows (); 106 node.jcvsNode ().jCVSStatus (); 107 StatusDialog stat = new StatusDialog (); 108 checkCheckBox (stat.cbIncludeTagInfo()); 109 stat.runCommand(); 110 stat.waitClosed (); 111 node.waitHistoryShort ("status -v"); 112 StatusOutputOperator soo = new StatusOutputOperator (directory); 113 if (directory) 114 soo.dumpAll(out, "/cvsroot/test/jcvs/" + roothistoryshort); 115 else 116 soo.dumpFile(out, "/cvsroot/test/jcvs/" + roothistoryshort); 117 } 118 119 public void testAddDirectoryRecursive () { 120 subpac1.mkdirs (); 121 add1.save ("Adding 1"); 122 refresh(root); 123 124 pac1.jcvsNode ().jCVSAdd (); 125 AddDialog add = new AddDialog (); 126 add.txtMessage().setText ("Adding Desc 1"); 127 checkCheckBox(add.cbRecursively()); 128 add.runCommand(); 129 add.waitClosed (); 130 pac1.waitHistoryShort("add -m \"Addin...\""); 131 132 add1.waitStatus ("LAdded; New", true); 133 dumpStatus (add1, false); 134 135 compareReferenceFiles (); 136 } 137 138 public void assertKeywordSubstitution (AddDialog add, String value, String switches) { 139 switches = "add " + ((switches != null) ? (switches + " ") : ""); 140 add.cboSubstitution().selectItem (value); 141 add.compareSwitches(switches); 142 JTextFieldOperator tfo = new JTextFieldOperator (add, switches); 143 assertEquals ("Keyword Substitution assertion failed", switches, tfo.getText ()); 144 } 145 146 public void testAddNoKeywordSubstitution () { 147 add2.save ("$Revision: 1.6 $\n"); 148 refresh (pac1); 149 150 add2.jcvsNode ().jCVSAdd (); 151 AddDialog add = new AddDialog (); 152 assertKeywordSubstitution (add, "Reuse Old Value (-ko)", "-ko"); 153 add.txtMessage().setText ("Adding Desc 2"); 154 add.runCommand(); 155 add.waitClosed (); 156 add2.waitHistoryShort("add -m \"Addin...\" -ko"); 157 add2.waitStatus ("LAdded; New", true); 158 159 commitFile (add2, null, null); 160 add2.waitStatus ("Up-to-date; 1.1", true); 161 out.println ("Corrected file:"); 162 out.println (loadFile(add2.file ())); 163 164 compareReferenceFiles (); 165 } 166 167 public void testAddKeywordSubstitution () { 168 add3.save ("$Revision: 1.6 $\n"); 169 refresh (pac1); 170 171 add3.jcvsNode ().jCVSAdd (); 172 AddDialog add = new AddDialog (); 173 assertKeywordSubstitution (add, "<NONE>", null); 174 assertKeywordSubstitution (add, "Binary (-kb)", "-kb"); 175 assertKeywordSubstitution (add, "Keyword and Value (-kkv)", "-kkv"); 176 assertKeywordSubstitution (add, "Keyword, Value, Locker (-kkvl)", "-kkvl"); 177 assertKeywordSubstitution (add, "Keyword Only (-kk)", "-kk"); 178 assertKeywordSubstitution (add, "Value Only (-kv)", "-kv"); 179 assertKeywordSubstitution (add, "Reuse Old Value (-ko)", "-ko"); 180 181 assertKeywordSubstitution (add, "Keyword and Value (-kkv)", "-kkv"); 182 add.txtMessage().setText ("Adding Desc 3"); 183 add.runCommand(); 184 add.waitClosed (); 185 add3.waitHistoryShort("add -m \"Addin...\" -kkv"); 186 add3.waitStatus ("LAdded; New", true); 187 188 commitFile (add3, null, null); 189 add3.waitStatus ("Up-to-date; 1.1", true); 190 out.println ("Corrected file:"); 191 out.println (loadFile(add3.file ())); 192 193 compareReferenceFiles (); 194 } 195 196 public void testTagInit () { 197 subpac2.mkdirs (); 198 refresh (root); 199 addDirectory (pac2); 200 refresh (pac2); 201 addDirectory (subpac2); 202 createAddCommitFile (tag1, "Java Classes|Empty"); 203 createAddCommitFile (tag2, "Java Classes|Empty"); 204 } 205 206 public void testTagDirectory () { 207 TagDialog tag; 208 209 pac2.jcvsNode ().jCVSTag (); 210 tag = new TagDialog (); 211 tag.txtTag().typeText ("DirectoryRecursiveTag"); 212 checkCheckBox (tag.cbBranch()); 213 tag.runCommand(); 214 tag.waitClosed (); 215 pac2.waitHistoryShort("tag -b DirectoryRecursiveTag"); 216 217 pac2.jcvsNode ().jCVSTag (); 218 tag = new TagDialog (); 219 tag.txtTag().typeText ("DirectoryTag"); 220 checkCheckBox (tag.cbNotRecursively()); 221 tag.runCommand(); 222 tag.waitClosed (); 223 pac2.waitHistoryShort("tag -l DirectoryTag"); 224 225 dumpStatus (pac2, true); 226 227 compareReferenceFiles (); 228 } 229 230 public void testTagAdd () { 231 createAddCommitFile(tag3, "Java Classes|Empty"); 232 TagDialog tag; 233 234 tag3.jcvsNode ().jCVSTag (); 235 tag = new TagDialog (); 236 tag.txtTag().typeText ("AddTagName"); 237 tag.runCommand (); 238 tag.waitClosed (); 239 tag3.waitHistoryShort ("tag AddTagName"); 240 241 tag3.jcvsNode ().jCVSTag (); 242 tag = new TagDialog (); 243 tag.txtTag().typeText ("AddBranchTagName"); 244 checkCheckBox (tag.cbBranch()); 245 tag.runCommand (); 246 tag.waitClosed (); 247 tag3.waitHistoryShort ("tag -b AddBranchTagName"); 248 249 dumpStatus (tag3, false); 250 251 compareReferenceFiles(); 252 } 253 254 public void testTagModified () { 255 createAddCommitFile(tag4, "Java Classes|Empty"); 256 tag4.save (""); 257 refresh (tag4.parent ()); 258 259 closeAllVCSWindows (); 260 tag4.jcvsNode ().jCVSTag (); 261 TagDialog tag = new TagDialog (); 262 tag.txtTag().typeText ("ModifiedAddTagName"); 263 checkCheckBox (tag.cbCheckModifiedFiles()); 264 tag.runCommand (); 265 tag.waitClosed (); 266 assertCVSErrorDialog (); 267 } 268 269 public void testTagByRevision () { 270 commitFile (tag4, null, "Desc 1.2"); 271 tag4.waitStatus ("Up-to-date; 1.2"); 272 273 closeAllVCSWindows (); 274 tag4.jcvsNode ().jCVSTag (); 275 TagDialog tag = new TagDialog (); 276 tag.txtTag().typeText ("AddTagToRevisionName"); 277 checkCheckBox (tag.cbByRevision()); 278 tag.txtByRevision().typeText ("1.1"); 279 tag.runCommand (); 280 tag.waitClosed (); 281 282 dumpStatus (tag4, false); 283 284 compareReferenceFiles(); 285 } 286 287 public void testTagForce () { 288 subpac22.mkdirs (); 289 refresh (subpac22.parent ()); 290 addDirectory(subpac22); 291 292 tag51.save ("Tag51"); 293 tag52.save ("Tag52"); 294 refresh (subpac22); 295 addFile(tag51, null); 296 commitFile(tag51, null, null); 297 tag51.waitStatus ("Up-to-date; 1.1"); 298 addTagFile(tag51, "NoForceTag", false); 299 tag51.save ("Tag51a"); 300 commitFile(tag51, null, null); 301 tag51.waitStatus ("Up-to-date; 1.2"); 302 addFile(tag52, null); 303 commitFile(tag52, null, null); 304 tag52.waitStatus ("Up-to-date; 1.1"); 305 addTagFile(tag52, "ForceTag", false); 306 tag52.save ("Tag52a"); 307 commitFile(tag52, null, null); 308 tag52.waitStatus ("Up-to-date; 1.2"); 309 310 dumpStatus(subpac22, true); 311 312 subpac22.jcvsNode ().jCVSTag(); 313 TagDialog tag = new TagDialog (); 314 tag.txtTag().typeText ("ForceTag"); 315 checkCheckBox (tag.cbForceReassignement()); 316 tag.runCommand(); 317 tag.waitClosed (); 318 subpac22.waitHistoryShort("tag -F ForceTag"); 319 320 dumpStatus(subpac22, true); 321 322 compareReferenceFiles (); 323 } 324 325 public void testTagDelete () { 326 createAddCommitFile(tag6, "Java Classes|Empty"); 327 addTagFile(tag6, "TagToDelete", false); 328 329 dumpStatus (tag6, false); 330 331 tag6.jcvsNode ().jCVSTag (); 332 TagDialog tag = new TagDialog (); 333 tag.txtTag().typeText ("TagToDelete"); 334 checkCheckBox(tag.cbDelete()); 335 tag.runCommand (); 336 tag.waitClosed (); 337 tag6.waitHistoryShort("tag -d TagToDelete"); 338 339 dumpStatus(tag6, false); 340 341 compareReferenceFiles (); 342 } 343 344 public void testUnmount() { 345 new FilesystemNode(exp.repositoryTab().tree(), root.node ()).unmount(); 346 new Node (exp.repositoryTab ().tree (), "").waitChildNotPresent(root.node ()); 347 } 348 349 } 350
| Popular Tags
|