1 19 package org.netbeans.modules.subversion.client.parser; 20 21 import junit.framework.*; 22 import java.io.BufferedReader ; 23 import java.io.File ; 24 import java.io.FileFilter ; 25 import java.io.FilenameFilter ; 26 import java.io.IOException ; 27 import java.io.InputStream ; 28 import java.io.Reader ; 29 import java.text.ParseException ; 30 import java.text.SimpleDateFormat ; 31 import java.util.Date ; 32 import java.util.Properties ; 33 import java.util.Set ; 34 import org.netbeans.api.diff.Difference; 35 import org.netbeans.spi.diff.DiffProvider; 36 import org.openide.util.Lookup; 37 import org.openide.xml.XMLUtil; 38 import org.tigris.subversion.svnclientadapter.ISVNStatus; 39 import org.tigris.subversion.svnclientadapter.SVNNodeKind; 40 import org.tigris.subversion.svnclientadapter.SVNStatusKind; 41 import org.w3c.dom.Document ; 42 import org.w3c.dom.Element ; 43 import org.w3c.dom.NodeList ; 44 import org.xml.sax.Attributes ; 45 import org.xml.sax.InputSource ; 46 import org.xml.sax.SAXException ; 47 import org.xml.sax.SAXParseException ; 48 import org.xml.sax.XMLReader ; 49 import org.xml.sax.helpers.DefaultHandler ; 50 51 55 public class SvnWcParserTest extends TestCase { 56 57 private String dataRootDir; 58 private SvnWcParser svnWcParser; 59 60 public SvnWcParserTest(String testName) { 61 super(testName); 62 } 63 64 protected void setUp() throws Exception { 65 svnWcParser = new SvnWcParser(); 66 67 dataRootDir = System.getProperty("data.root.dir"); 69 } 70 71 public static Test suite() { 72 TestSuite suite = new TestSuite(SvnWcParserTest.class); 73 74 return suite; 75 } 76 77 public void testGetSingleStatusNoChanges() throws Exception { 78 File myFile = new File (dataRootDir + "/SvnWcParser/no-changes/testapp/Main.java"); 79 ISVNStatus parsedStatus = svnWcParser.getSingleStatus(myFile); 80 assertFalse(parsedStatus.isCopied()); 81 assertNull(parsedStatus.getUrlCopiedFrom()); 82 assertEquals("svn://gonzo/testRepos/trunk/testApp/src/testapp/Main.java", parsedStatus.getUrl().toString()); 83 assertEquals(SVNStatusKind.NORMAL, parsedStatus.getTextStatus()); 84 assertEquals(2, parsedStatus.getRevision().getNumber()); 85 assertNull(parsedStatus.getConflictNew()); 86 assertNull(parsedStatus.getConflictOld()); 87 assertNull(parsedStatus.getConflictWorking()); 88 assertEquals(myFile, parsedStatus.getFile()); 89 Date expectedDate = SvnWcUtils.parseSvnDate("2006-04-12T10:43:46.371180Z"); 90 assertEquals(expectedDate, parsedStatus.getLastChangedDate()); 91 assertEquals(2, parsedStatus.getLastChangedRevision().getNumber()); 92 assertEquals("ed", parsedStatus.getLastCommitAuthor()); 93 assertEquals(SVNNodeKind.FILE, parsedStatus.getNodeKind()); 94 assertEquals(myFile.getPath(), parsedStatus.getPath()); 95 assertEquals(SVNStatusKind.NORMAL, parsedStatus.getPropStatus()); 96 assertNull(parsedStatus.getLockComment()); 97 assertNull(parsedStatus.getLockOwner()); 98 assertNull(parsedStatus.getLockCreationDate()); 99 } 100 101 public void testGetSingleStatusNoChangesNewFormat() throws Exception { 102 File myFile = new File (dataRootDir + "/SvnWcParser/new-format-no-changes/testapp/Main.java"); 103 ISVNStatus parsedStatus = svnWcParser.getSingleStatus(myFile); 104 assertFalse(parsedStatus.isCopied()); 105 assertNull(parsedStatus.getUrlCopiedFrom()); 106 assertEquals("svn://gonzo/testRepos/trunk/testApp/src/testapp/Main.java", parsedStatus.getUrl().toString()); 107 assertEquals(SVNStatusKind.NORMAL, parsedStatus.getTextStatus()); 108 assertEquals(16, parsedStatus.getRevision().getNumber()); 109 assertNull(parsedStatus.getConflictNew()); 110 assertNull(parsedStatus.getConflictOld()); 111 assertNull(parsedStatus.getConflictWorking()); 112 assertEquals(myFile, parsedStatus.getFile()); 113 Date expectedDate = SvnWcUtils.parseSvnDate("2006-08-05T03:42:58.306031Z"); 114 assertEquals(expectedDate, parsedStatus.getLastChangedDate()); 115 assertEquals(16, parsedStatus.getLastChangedRevision().getNumber()); 116 assertEquals("ed", parsedStatus.getLastCommitAuthor()); 117 assertEquals(SVNNodeKind.FILE, parsedStatus.getNodeKind()); 118 assertEquals(myFile.getPath(), parsedStatus.getPath()); 119 assertEquals(SVNStatusKind.NORMAL, parsedStatus.getPropStatus()); 120 assertNull(parsedStatus.getLockComment()); 121 assertNull(parsedStatus.getLockOwner()); 122 assertNull(parsedStatus.getLockCreationDate()); 123 } 124 125 public void testGetSingleStatusFileChanges() throws Exception { 126 File myFile = new File (dataRootDir + "/SvnWcParser/file-changes/testapp/Main.java"); 127 ISVNStatus parsedStatus = svnWcParser.getSingleStatus(myFile); 128 assertFalse(parsedStatus.isCopied()); 129 assertNull(parsedStatus.getUrlCopiedFrom()); 130 assertEquals("svn://gonzo/testRepos/trunk/testApp/src/testapp/Main.java", parsedStatus.getUrl().toString()); 131 assertEquals(SVNStatusKind.MODIFIED, parsedStatus.getTextStatus()); 132 assertEquals(2, parsedStatus.getRevision().getNumber()); 133 assertNull(parsedStatus.getConflictNew()); 134 assertNull(parsedStatus.getConflictOld()); 135 assertNull(parsedStatus.getConflictWorking()); 136 assertEquals(myFile, parsedStatus.getFile()); 137 Date expectedDate = SvnWcUtils.parseSvnDate("2006-04-12T10:43:46.371180Z"); 138 assertEquals(expectedDate, parsedStatus.getLastChangedDate()); 139 assertEquals(2, parsedStatus.getLastChangedRevision().getNumber()); 140 assertEquals("ed", parsedStatus.getLastCommitAuthor()); 141 assertEquals(SVNNodeKind.FILE, parsedStatus.getNodeKind()); 142 assertEquals(myFile.getPath(), parsedStatus.getPath()); 143 assertEquals(SVNStatusKind.NORMAL, parsedStatus.getPropStatus()); 144 assertNull(parsedStatus.getLockComment()); 145 assertNull(parsedStatus.getLockOwner()); 146 assertNull(parsedStatus.getLockCreationDate()); 147 } 148 149 public void testGetSingleStatusFileChangesNewFormat() throws Exception { 150 File myFile = new File (dataRootDir + "/SvnWcParser/new-format-file-changes/testapp/AnotherMain.java"); 151 ISVNStatus parsedStatus = svnWcParser.getSingleStatus(myFile); 152 assertFalse(parsedStatus.isCopied()); 153 assertNull(parsedStatus.getUrlCopiedFrom()); 154 assertEquals("svn://gonzo/testRepos/trunk/testApp/src/testapp/AnotherMain.java", parsedStatus.getUrl().toString()); 155 assertEquals(SVNStatusKind.MODIFIED, parsedStatus.getTextStatus()); 156 assertEquals(16, parsedStatus.getRevision().getNumber()); 157 assertNull(parsedStatus.getConflictNew()); 158 assertNull(parsedStatus.getConflictOld()); 159 assertNull(parsedStatus.getConflictWorking()); 160 assertEquals(myFile, parsedStatus.getFile()); 161 Date expectedDate = SvnWcUtils.parseSvnDate("2006-04-25T07:05:57.738276Z"); 162 assertEquals(expectedDate, parsedStatus.getLastChangedDate()); 163 assertEquals(10, parsedStatus.getLastChangedRevision().getNumber()); 164 assertEquals("ed", parsedStatus.getLastCommitAuthor()); 165 assertEquals(SVNNodeKind.FILE, parsedStatus.getNodeKind()); 166 assertEquals(myFile.getPath(), parsedStatus.getPath()); 167 assertEquals(SVNStatusKind.NORMAL, parsedStatus.getPropStatus()); 168 assertNull(parsedStatus.getLockComment()); 169 assertNull(parsedStatus.getLockOwner()); 170 assertNull(parsedStatus.getLockCreationDate()); 171 } 172 173 public void testGetSingleStatusFileUnknown() throws Exception { 174 File myFile = new File (dataRootDir + "/SvnWcParser/file-unknown/testapp/ReadMe.txt"); 175 ISVNStatus parsedStatus = svnWcParser.getSingleStatus(myFile); 176 assertFalse(parsedStatus.isCopied()); 177 assertNull(parsedStatus.getUrlCopiedFrom()); 178 assertEquals("svn://gonzo/testRepos/trunk/testApp/src/testapp/ReadMe.txt", parsedStatus.getUrl().toString()); 179 assertEquals(SVNStatusKind.UNVERSIONED, parsedStatus.getTextStatus()); 180 assertEquals(0, parsedStatus.getRevision().getNumber()); 181 assertNull(parsedStatus.getConflictNew()); 182 assertNull(parsedStatus.getConflictOld()); 183 assertNull(parsedStatus.getConflictWorking()); 184 assertEquals(myFile, parsedStatus.getFile()); 185 assertNull(parsedStatus.getLastChangedDate()); 186 assertEquals(0, parsedStatus.getLastChangedRevision().getNumber()); 187 assertNull(parsedStatus.getLastCommitAuthor()); 188 assertEquals(SVNNodeKind.UNKNOWN, parsedStatus.getNodeKind()); 189 assertEquals(myFile.getPath(), parsedStatus.getPath()); 190 assertEquals(SVNStatusKind.UNVERSIONED, parsedStatus.getPropStatus()); 191 assertNull(parsedStatus.getLockComment()); 192 assertNull(parsedStatus.getLockOwner()); 193 assertNull(parsedStatus.getLockCreationDate()); 194 } 195 196 public void testGetSingleStatusFileUnknownNewFormat() throws Exception { 197 File myFile = new File (dataRootDir + "/SvnWcParser/new-format-file-unknown/testapp/readme.txt"); 198 ISVNStatus parsedStatus = svnWcParser.getSingleStatus(myFile); 199 assertFalse(parsedStatus.isCopied()); 200 assertNull(parsedStatus.getUrlCopiedFrom()); 201 assertEquals("svn://gonzo/testRepos/trunk/testApp/src/testapp/readme.txt", parsedStatus.getUrl().toString()); 202 assertEquals(SVNStatusKind.UNVERSIONED, parsedStatus.getTextStatus()); 203 assertEquals(0, parsedStatus.getRevision().getNumber()); 204 assertNull(parsedStatus.getConflictNew()); 205 assertNull(parsedStatus.getConflictOld()); 206 assertNull(parsedStatus.getConflictWorking()); 207 assertEquals(myFile, parsedStatus.getFile()); 208 assertNull(parsedStatus.getLastChangedDate()); 209 assertEquals(0, parsedStatus.getLastChangedRevision().getNumber()); 210 assertNull(parsedStatus.getLastCommitAuthor()); 211 assertEquals(SVNNodeKind.UNKNOWN, parsedStatus.getNodeKind()); 212 assertEquals(myFile.getPath(), parsedStatus.getPath()); 213 assertEquals(SVNStatusKind.UNVERSIONED, parsedStatus.getPropStatus()); 214 assertNull(parsedStatus.getLockComment()); 215 assertNull(parsedStatus.getLockOwner()); 216 assertNull(parsedStatus.getLockCreationDate()); 217 } 218 219 223 public void testGetSingleStatusFileUnknownAnywhere() throws Exception { 224 File myFile = new File (dataRootDir + "/SvnWcParser/no-changes/testapp/ReadMe.txt"); 225 ISVNStatus parsedStatus = svnWcParser.getSingleStatus(myFile); 226 assertFalse(parsedStatus.isCopied()); 227 assertNull(parsedStatus.getUrlCopiedFrom()); 228 assertEquals("svn://gonzo/testRepos/trunk/testApp/src/testapp/ReadMe.txt", parsedStatus.getUrl().toString()); 229 assertEquals(SVNStatusKind.UNVERSIONED, parsedStatus.getTextStatus()); 230 assertEquals(0, parsedStatus.getRevision().getNumber()); 231 assertNull(parsedStatus.getConflictNew()); 232 assertNull(parsedStatus.getConflictOld()); 233 assertNull(parsedStatus.getConflictWorking()); 234 assertEquals(myFile, parsedStatus.getFile()); 235 assertNull(parsedStatus.getLastChangedDate()); 236 assertEquals(0, parsedStatus.getLastChangedRevision().getNumber()); 237 assertNull(parsedStatus.getLastCommitAuthor()); 238 assertEquals(SVNNodeKind.UNKNOWN, parsedStatus.getNodeKind()); 239 assertEquals(myFile.getPath(), parsedStatus.getPath()); 240 assertEquals(SVNStatusKind.UNVERSIONED, parsedStatus.getPropStatus()); 241 assertNull(parsedStatus.getLockComment()); 242 assertNull(parsedStatus.getLockOwner()); 243 assertNull(parsedStatus.getLockCreationDate()); 244 } 245 246 251 public void testGetSingleStatusFileUnknownAnywhereNewFormat() throws Exception { 252 File myFile = new File (dataRootDir + "/SvnWcParser/new-format-no-changes/testapp/readme.txt"); 253 ISVNStatus parsedStatus = svnWcParser.getSingleStatus(myFile); 254 assertFalse(parsedStatus.isCopied()); 255 assertNull(parsedStatus.getUrlCopiedFrom()); 256 assertEquals("svn://gonzo/testRepos/trunk/testApp/src/testapp/readme.txt", parsedStatus.getUrl().toString()); 257 assertEquals(SVNStatusKind.UNVERSIONED, parsedStatus.getTextStatus()); 258 assertEquals(0, parsedStatus.getRevision().getNumber()); 259 assertNull(parsedStatus.getConflictNew()); 260 assertNull(parsedStatus.getConflictOld()); 261 assertNull(parsedStatus.getConflictWorking()); 262 assertEquals(myFile, parsedStatus.getFile()); 263 assertNull(parsedStatus.getLastChangedDate()); 264 assertEquals(0, parsedStatus.getLastChangedRevision().getNumber()); 265 assertNull(parsedStatus.getLastCommitAuthor()); 266 assertEquals(SVNNodeKind.UNKNOWN, parsedStatus.getNodeKind()); 267 assertEquals(myFile.getPath(), parsedStatus.getPath()); 268 assertEquals(SVNStatusKind.UNVERSIONED, parsedStatus.getPropStatus()); 269 assertNull(parsedStatus.getLockComment()); 270 assertNull(parsedStatus.getLockOwner()); 271 assertNull(parsedStatus.getLockCreationDate()); 272 } 273 274 public void testGetSingleStatusFileAdded() throws Exception { 275 File myFile = new File (dataRootDir + "/SvnWcParser/file-added/testapp/ReadMe.txt"); 276 ISVNStatus parsedStatus = svnWcParser.getSingleStatus(myFile); 277 assertFalse(parsedStatus.isCopied()); 278 assertNull(parsedStatus.getUrlCopiedFrom()); 279 assertEquals("svn://gonzo/testRepos/trunk/testApp/src/testapp/ReadMe.txt", parsedStatus.getUrl().toString()); 280 assertEquals(SVNStatusKind.ADDED, parsedStatus.getTextStatus()); 281 assertEquals(0, parsedStatus.getRevision().getNumber()); 282 assertNull(parsedStatus.getConflictNew()); 283 assertNull(parsedStatus.getConflictOld()); 284 assertNull(parsedStatus.getConflictWorking()); 285 assertEquals(myFile, parsedStatus.getFile()); 286 assertNull(parsedStatus.getLastChangedDate()); 287 assertEquals(-1, parsedStatus.getLastChangedRevision().getNumber()); 288 assertNull(parsedStatus.getLastCommitAuthor()); 289 assertEquals(SVNNodeKind.FILE, parsedStatus.getNodeKind()); 290 assertEquals(myFile.getPath(), parsedStatus.getPath()); 291 assertEquals(SVNStatusKind.NONE, parsedStatus.getPropStatus()); 292 assertNull(parsedStatus.getLockComment()); 293 assertNull(parsedStatus.getLockOwner()); 294 assertNull(parsedStatus.getLockCreationDate()); 295 } 296 297 public void testGetSingleStatusFileAddedNewFormat() throws Exception { 298 File myFile = new File (dataRootDir + "/SvnWcParser/new-format-file-added/testapp/ReadMe.txt"); 299 ISVNStatus parsedStatus = svnWcParser.getSingleStatus(myFile); 300 assertFalse(parsedStatus.isCopied()); 301 assertNull(parsedStatus.getUrlCopiedFrom()); 302 assertEquals("svn://gonzo/testRepos/trunk/testApp/src/testapp/ReadMe.txt", parsedStatus.getUrl().toString()); 303 assertEquals(SVNStatusKind.ADDED, parsedStatus.getTextStatus()); 304 assertEquals(0, parsedStatus.getRevision().getNumber()); 305 assertNull(parsedStatus.getConflictNew()); 306 assertNull(parsedStatus.getConflictOld()); 307 assertNull(parsedStatus.getConflictWorking()); 308 assertEquals(myFile, parsedStatus.getFile()); 309 assertNull(parsedStatus.getLastChangedDate()); 310 assertEquals(-1, parsedStatus.getLastChangedRevision().getNumber()); 311 assertNull(parsedStatus.getLastCommitAuthor()); 312 assertEquals(SVNNodeKind.FILE, parsedStatus.getNodeKind()); 313 assertEquals(myFile.getPath(), parsedStatus.getPath()); 314 assertEquals(SVNStatusKind.NONE, parsedStatus.getPropStatus()); 315 assertNull(parsedStatus.getLockComment()); 316 assertNull(parsedStatus.getLockOwner()); 317 assertNull(parsedStatus.getLockCreationDate()); 318 } 319 320 public void testGetSingleStatusFileConflict() throws Exception { 321 File myFile = new File (dataRootDir + "/SvnWcParser/file-conflicts/testapp/ReadMe.txt"); 322 ISVNStatus parsedStatus = svnWcParser.getSingleStatus(myFile); 323 assertFalse(parsedStatus.isCopied()); 324 assertNull(parsedStatus.getUrlCopiedFrom()); 325 assertEquals("svn://gonzo/testRepos/trunk/testApp/src/testapp/ReadMe.txt", parsedStatus.getUrl().toString()); 326 assertEquals(SVNStatusKind.CONFLICTED, parsedStatus.getTextStatus()); 327 assertEquals(5, parsedStatus.getRevision().getNumber()); 328 assertEquals(5, parsedStatus.getLastChangedRevision().getNumber()); 329 assertNotNull(parsedStatus.getConflictNew()); 330 assertNotNull(parsedStatus.getConflictOld()); 331 assertNotNull(parsedStatus.getConflictWorking()); 332 assertEquals(myFile, parsedStatus.getFile()); 333 Date expectedDate = SvnWcUtils.parseSvnDate("2006-04-25T04:12:27.726955Z"); 334 assertEquals(expectedDate, parsedStatus.getLastChangedDate()); 335 assertEquals(5, parsedStatus.getLastChangedRevision().getNumber()); 336 assertEquals("ed", parsedStatus.getLastCommitAuthor()); 337 assertEquals(SVNNodeKind.FILE, parsedStatus.getNodeKind()); 338 assertEquals(myFile.getPath(), parsedStatus.getPath()); 339 assertEquals(SVNStatusKind.NORMAL, parsedStatus.getPropStatus()); 340 assertNull(parsedStatus.getLockComment()); 341 assertNull(parsedStatus.getLockOwner()); 342 assertNull(parsedStatus.getLockCreationDate()); 343 } 344 345 public void testGetSingleStatusFileConflictNewFormat() throws Exception { 346 File myFile = new File (dataRootDir + "/SvnWcParser/new-format-file-conflicts/testapp/ReadMe.txt"); 347 ISVNStatus parsedStatus = svnWcParser.getSingleStatus(myFile); 348 assertFalse(parsedStatus.isCopied()); 349 assertNull(parsedStatus.getUrlCopiedFrom()); 350 assertEquals("svn://gonzo/testRepos/trunk/testApp/src/testapp/ReadMe.txt", parsedStatus.getUrl().toString()); 351 assertEquals(SVNStatusKind.CONFLICTED, parsedStatus.getTextStatus()); 352 assertEquals(18, parsedStatus.getRevision().getNumber()); 353 assertEquals(18, parsedStatus.getLastChangedRevision().getNumber()); 354 assertNotNull(parsedStatus.getConflictNew()); 355 assertNotNull(parsedStatus.getConflictOld()); 356 assertNotNull(parsedStatus.getConflictWorking()); 357 assertEquals(myFile, parsedStatus.getFile()); 358 Date expectedDate = SvnWcUtils.parseSvnDate("2006-08-16T05:15:12.039161Z"); 359 assertEquals(expectedDate, parsedStatus.getLastChangedDate()); 360 assertEquals(18, parsedStatus.getLastChangedRevision().getNumber()); 361 assertEquals("ed", parsedStatus.getLastCommitAuthor()); 362 assertEquals(SVNNodeKind.FILE, parsedStatus.getNodeKind()); 363 assertEquals(myFile.getPath(), parsedStatus.getPath()); 364 assertEquals(SVNStatusKind.NORMAL, parsedStatus.getPropStatus()); 365 assertNull(parsedStatus.getLockComment()); 366 assertNull(parsedStatus.getLockOwner()); 367 assertNull(parsedStatus.getLockCreationDate()); 368 } 369 370 public void testGetSingleStatusFileRemoved() throws Exception { 371 File myFile = new File (dataRootDir + "/SvnWcParser/file-removed/testapp/ReadMe.txt"); 372 ISVNStatus parsedStatus = svnWcParser.getSingleStatus(myFile); 373 assertFalse(parsedStatus.isCopied()); 374 assertNull(parsedStatus.getUrlCopiedFrom()); 375 assertEquals("svn://gonzo/testRepos/trunk/testApp/src/testapp/ReadMe.txt", parsedStatus.getUrl().toString()); 376 assertEquals(SVNStatusKind.DELETED, parsedStatus.getTextStatus()); 377 assertEquals(6, parsedStatus.getRevision().getNumber()); 378 assertNull(parsedStatus.getConflictNew()); 379 assertNull(parsedStatus.getConflictOld()); 380 assertNull(parsedStatus.getConflictWorking()); 381 assertEquals(myFile, parsedStatus.getFile()); 382 Date expectedDate = SvnWcUtils.parseSvnDate("2006-04-25T04:22:27.194329Z"); 383 assertEquals(expectedDate, parsedStatus.getLastChangedDate()); 384 assertEquals(6, parsedStatus.getLastChangedRevision().getNumber()); 385 assertEquals("ed", parsedStatus.getLastCommitAuthor()); 386 assertEquals(SVNNodeKind.FILE, parsedStatus.getNodeKind()); 387 assertEquals(myFile.getPath(), parsedStatus.getPath()); 388 assertEquals(SVNStatusKind.NONE, parsedStatus.getPropStatus()); 389 assertNull(parsedStatus.getLockComment()); 390 assertNull(parsedStatus.getLockOwner()); 391 assertNull(parsedStatus.getLockCreationDate()); 392 } 393 394 public void testGetSingleStatusFileRemovedNewFormat() throws Exception { 395 File myFile = new File (dataRootDir + "/SvnWcParser/new-format-file-removed/testapp/ReadMe.txt"); 396 ISVNStatus parsedStatus = svnWcParser.getSingleStatus(myFile); 397 assertFalse(parsedStatus.isCopied()); 398 assertNull(parsedStatus.getUrlCopiedFrom()); 399 assertEquals("svn://gonzo/testRepos/trunk/testApp/src/testapp/ReadMe.txt", parsedStatus.getUrl().toString()); 400 assertEquals(SVNStatusKind.DELETED, parsedStatus.getTextStatus()); 401 assertEquals(18, parsedStatus.getRevision().getNumber()); 402 assertNull(parsedStatus.getConflictNew()); 403 assertNull(parsedStatus.getConflictOld()); 404 assertNull(parsedStatus.getConflictWorking()); 405 assertEquals(myFile, parsedStatus.getFile()); 406 Date expectedDate = SvnWcUtils.parseSvnDate("2006-08-16T05:15:12.039161Z"); 407 assertEquals(expectedDate, parsedStatus.getLastChangedDate()); 408 assertEquals(18, parsedStatus.getLastChangedRevision().getNumber()); 409 assertEquals("ed", parsedStatus.getLastCommitAuthor()); 410 assertEquals(SVNNodeKind.FILE, parsedStatus.getNodeKind()); 411 assertEquals(myFile.getPath(), parsedStatus.getPath()); 412 assertEquals(SVNStatusKind.NONE, parsedStatus.getPropStatus()); 413 assertNull(parsedStatus.getLockComment()); 414 assertNull(parsedStatus.getLockOwner()); 415 assertNull(parsedStatus.getLockCreationDate()); 416 } 417 418 public void testGetSingleStatusFileCopied1() throws Exception { 419 File myFile = new File (dataRootDir + "/SvnWcParser/file-copied1/testapp/AnotherMain.java"); 420 ISVNStatus parsedStatus = svnWcParser.getSingleStatus(myFile); 421 assertTrue(parsedStatus.isCopied()); 422 assertEquals("svn://gonzo/testRepos/trunk/testApp/src/testapp/Main.java", parsedStatus.getUrlCopiedFrom().toString()); 423 assertEquals("svn://gonzo/testRepos/trunk/testApp/src/testapp/AnotherMain.java", parsedStatus.getUrl().toString()); 424 assertEquals(SVNStatusKind.ADDED, parsedStatus.getTextStatus()); 425 assertEquals(5, parsedStatus.getRevision().getNumber()); 426 assertNull(parsedStatus.getConflictNew()); 427 assertNull(parsedStatus.getConflictOld()); 428 assertNull(parsedStatus.getConflictWorking()); 429 assertEquals(myFile, parsedStatus.getFile()); 430 assertNull(parsedStatus.getLastChangedDate()); 431 assertEquals(-1, parsedStatus.getLastChangedRevision().getNumber()); 432 assertNull(parsedStatus.getLastCommitAuthor()); 433 assertEquals(SVNNodeKind.FILE, parsedStatus.getNodeKind()); 434 assertEquals(myFile.getPath(), parsedStatus.getPath()); 435 assertEquals(SVNStatusKind.NONE, parsedStatus.getPropStatus()); 436 assertNull(parsedStatus.getLockComment()); 437 assertNull(parsedStatus.getLockOwner()); 438 assertNull(parsedStatus.getLockCreationDate()); 439 } 440 441 public void testGetSingleStatusFileCopied1NewFormat() throws Exception { 442 File myFile = new File (dataRootDir + "/SvnWcParser/new-format-file-copied1/testapp/AnotherAnotherMain.java"); 443 ISVNStatus parsedStatus = svnWcParser.getSingleStatus(myFile); 444 assertTrue(parsedStatus.isCopied()); 445 assertEquals("svn://gonzo/testRepos/trunk/testApp/src/testapp/Main.java", parsedStatus.getUrlCopiedFrom().toString()); 446 assertEquals("svn://gonzo/testRepos/trunk/testApp/src/testapp/AnotherAnotherMain.java", parsedStatus.getUrl().toString()); 447 assertEquals(SVNStatusKind.ADDED, parsedStatus.getTextStatus()); 448 assertEquals(18, parsedStatus.getRevision().getNumber()); 449 assertNull(parsedStatus.getConflictNew()); 450 assertNull(parsedStatus.getConflictOld()); 451 assertNull(parsedStatus.getConflictWorking()); 452 assertEquals(myFile, parsedStatus.getFile()); 453 assertNull(parsedStatus.getLastChangedDate()); 454 assertEquals(-1, parsedStatus.getLastChangedRevision().getNumber()); 455 assertNull(parsedStatus.getLastCommitAuthor()); 456 assertEquals(SVNNodeKind.FILE, parsedStatus.getNodeKind()); 457 assertEquals(myFile.getPath(), parsedStatus.getPath()); 458 assertEquals(SVNStatusKind.NONE, parsedStatus.getPropStatus()); 459 assertNull(parsedStatus.getLockComment()); 460 assertNull(parsedStatus.getLockOwner()); 461 assertNull(parsedStatus.getLockCreationDate()); 462 } 463 464 public void testGetSingleStatusFileCopied2() throws Exception { 465 File myFile = new File (dataRootDir + "/SvnWcParser/file-copied2/testapp/AnotherMain.java"); 466 ISVNStatus parsedStatus = svnWcParser.getSingleStatus(myFile); 467 assertTrue(parsedStatus.isCopied()); 468 assertEquals("svn://gonzo/testRepos/trunk/testApp/src/testapp/Main.java", parsedStatus.getUrlCopiedFrom().toString()); 469 assertEquals("svn://gonzo/testRepos/trunk/testApp/src/testapp/AnotherMain.java", parsedStatus.getUrl().toString()); 470 assertEquals(SVNStatusKind.ADDED, parsedStatus.getTextStatus()); 471 assertEquals(5, parsedStatus.getRevision().getNumber()); 472 assertNull(parsedStatus.getConflictNew()); 473 assertNull(parsedStatus.getConflictOld()); 474 assertNull(parsedStatus.getConflictWorking()); 475 assertEquals(myFile, parsedStatus.getFile()); 476 assertNull(parsedStatus.getLastChangedDate()); 477 assertEquals(-1, parsedStatus.getLastChangedRevision().getNumber()); 478 assertNull(parsedStatus.getLastCommitAuthor()); 479 assertEquals(SVNNodeKind.FILE, parsedStatus.getNodeKind()); 480 assertEquals(myFile.getPath(), parsedStatus.getPath()); 481 assertEquals(SVNStatusKind.NONE, parsedStatus.getPropStatus()); 482 assertNull(parsedStatus.getLockComment()); 483 assertNull(parsedStatus.getLockOwner()); 484 assertNull(parsedStatus.getLockCreationDate()); 485 } 486 487 public void testGetSingleStatusFileCopied2NewFormat() throws Exception { 488 File myFile = new File (dataRootDir + "/SvnWcParser/new-format-file-copied2/testapp/AnotherAnotherMain.java"); 489 ISVNStatus parsedStatus = svnWcParser.getSingleStatus(myFile); 490 assertTrue(parsedStatus.isCopied()); 491 assertEquals("svn://gonzo/testRepos/trunk/testApp/src/testapp/Main.java", parsedStatus.getUrlCopiedFrom().toString()); 492 assertEquals("svn://gonzo/testRepos/trunk/testApp/src/testapp/AnotherAnotherMain.java", parsedStatus.getUrl().toString()); 493 assertEquals(SVNStatusKind.ADDED, parsedStatus.getTextStatus()); 494 assertEquals(18, parsedStatus.getRevision().getNumber()); 495 assertNull(parsedStatus.getConflictNew()); 496 assertNull(parsedStatus.getConflictOld()); 497 assertNull(parsedStatus.getConflictWorking()); 498 assertEquals(myFile, parsedStatus.getFile()); 499 assertNull(parsedStatus.getLastChangedDate()); 500 assertEquals(-1, parsedStatus.getLastChangedRevision().getNumber()); 501 assertNull(parsedStatus.getLastCommitAuthor()); 502 assertEquals(SVNNodeKind.FILE, parsedStatus.getNodeKind()); 503 assertEquals(myFile.getPath(), parsedStatus.getPath()); 504 assertEquals(SVNStatusKind.NONE, parsedStatus.getPropStatus()); 505 assertNull(parsedStatus.getLockComment()); 506 assertNull(parsedStatus.getLockOwner()); 507 assertNull(parsedStatus.getLockCreationDate()); 508 } 509 510 public void testGetSingleStatusPropertyAdded() throws Exception { 511 File myFile = new File (dataRootDir + "/SvnWcParser/prop-added/testapp/AnotherMain.java"); 512 ISVNStatus parsedStatus = svnWcParser.getSingleStatus(myFile); 513 assertFalse(parsedStatus.isCopied()); 514 assertNull(parsedStatus.getUrlCopiedFrom()); 515 assertEquals("svn://gonzo/testRepos/trunk/testApp/src/testapp/AnotherMain.java", parsedStatus.getUrl().toString()); 516 assertEquals(SVNStatusKind.NORMAL, parsedStatus.getTextStatus()); 517 assertEquals(8, parsedStatus.getRevision().getNumber()); 518 assertNull(parsedStatus.getConflictNew()); 519 assertNull(parsedStatus.getConflictOld()); 520 assertNull(parsedStatus.getConflictWorking()); 521 assertEquals(myFile, parsedStatus.getFile()); 522 Date expectedDate = SvnWcUtils.parseSvnDate("2006-04-25T06:55:09.997277Z"); 523 assertEquals(expectedDate, parsedStatus.getLastChangedDate()); 524 assertEquals(8, parsedStatus.getLastChangedRevision().getNumber()); 525 assertEquals("ed", parsedStatus.getLastCommitAuthor()); 526 assertEquals(SVNNodeKind.FILE, parsedStatus.getNodeKind()); 527 assertEquals(myFile.getPath(), parsedStatus.getPath()); 528 assertEquals(SVNStatusKind.MODIFIED, parsedStatus.getPropStatus()); 529 assertNull(parsedStatus.getLockComment()); 530 assertNull(parsedStatus.getLockOwner()); 531 assertNull(parsedStatus.getLockCreationDate()); 532 } 533 534 public void testGetSingleStatusPropertyAddedNewFormat() throws Exception { 535 File myFile = new File (dataRootDir + "/SvnWcParser/new-format-prop-added/testapp/AnotherMain.java"); 536 ISVNStatus parsedStatus = svnWcParser.getSingleStatus(myFile); 537 assertFalse(parsedStatus.isCopied()); 538 assertNull(parsedStatus.getUrlCopiedFrom()); 539 assertEquals("svn://gonzo/testRepos/trunk/testApp/src/testapp/AnotherMain.java", parsedStatus.getUrl().toString()); 540 assertEquals(SVNStatusKind.NORMAL, parsedStatus.getTextStatus()); 541 assertEquals(19, parsedStatus.getRevision().getNumber()); 542 assertNull(parsedStatus.getConflictNew()); 543 assertNull(parsedStatus.getConflictOld()); 544 assertNull(parsedStatus.getConflictWorking()); 545 assertEquals(myFile, parsedStatus.getFile()); 546 Date expectedDate = SvnWcUtils.parseSvnDate("2006-04-25T07:05:57.738276Z"); 547 assertEquals(expectedDate, parsedStatus.getLastChangedDate()); 548 assertEquals(10, parsedStatus.getLastChangedRevision().getNumber()); 549 assertEquals("ed", parsedStatus.getLastCommitAuthor()); 550 assertEquals(SVNNodeKind.FILE, parsedStatus.getNodeKind()); 551 assertEquals(myFile.getPath(), parsedStatus.getPath()); 552 assertEquals(SVNStatusKind.MODIFIED, parsedStatus.getPropStatus()); 553 assertNull(parsedStatus.getLockComment()); 554 assertNull(parsedStatus.getLockOwner()); 555 assertNull(parsedStatus.getLockCreationDate()); 556 } 557 558 public void testGetSingleStatusPropertyModified() throws Exception { 559 File myFile = new File (dataRootDir + "/SvnWcParser/prop-modified/testapp/AnotherMain.java"); 560 ISVNStatus parsedStatus = svnWcParser.getSingleStatus(myFile); 561 assertFalse(parsedStatus.isCopied()); 562 assertNull(parsedStatus.getUrlCopiedFrom()); 563 assertEquals("svn://gonzo/testRepos/trunk/testApp/src/testapp/AnotherMain.java", parsedStatus.getUrl().toString()); 564 assertEquals(SVNStatusKind.NORMAL, parsedStatus.getTextStatus()); 565 assertEquals(9, parsedStatus.getRevision().getNumber()); 566 assertNull(parsedStatus.getConflictNew()); 567 assertNull(parsedStatus.getConflictOld()); 568 assertNull(parsedStatus.getConflictWorking()); 569 assertEquals(myFile, parsedStatus.getFile()); 570 Date expectedDate = SvnWcUtils.parseSvnDate("2006-04-25T07:01:25.704780Z"); 571 assertEquals(expectedDate, parsedStatus.getLastChangedDate()); 572 assertEquals(9, parsedStatus.getLastChangedRevision().getNumber()); 573 assertEquals("ed", parsedStatus.getLastCommitAuthor()); 574 assertEquals(SVNNodeKind.FILE, parsedStatus.getNodeKind()); 575 assertEquals(myFile.getPath(), parsedStatus.getPath()); 576 assertEquals(SVNStatusKind.MODIFIED, parsedStatus.getPropStatus()); 577 assertNull(parsedStatus.getLockComment()); 578 assertNull(parsedStatus.getLockOwner()); 579 assertNull(parsedStatus.getLockCreationDate()); 580 } 581 582 public void testGetSingleStatusPropertyModifiedNewFormat() throws Exception { 583 File myFile = new File (dataRootDir + "/SvnWcParser/new-format-prop-modified/testapp/AnotherMain.java"); 584 ISVNStatus parsedStatus = svnWcParser.getSingleStatus(myFile); 585 assertFalse(parsedStatus.isCopied()); 586 assertNull(parsedStatus.getUrlCopiedFrom()); 587 assertEquals("svn://gonzo/testRepos/trunk/testApp/src/testapp/AnotherMain.java", parsedStatus.getUrl().toString()); 588 assertEquals(SVNStatusKind.NORMAL, parsedStatus.getTextStatus()); 589 assertEquals(19, parsedStatus.getRevision().getNumber()); 590 assertNull(parsedStatus.getConflictNew()); 591 assertNull(parsedStatus.getConflictOld()); 592 assertNull(parsedStatus.getConflictWorking()); 593 assertEquals(myFile, parsedStatus.getFile()); 594 Date expectedDate = SvnWcUtils.parseSvnDate("2006-04-25T07:05:57.738276Z"); 595 assertEquals(expectedDate, parsedStatus.getLastChangedDate()); 596 assertEquals(10, parsedStatus.getLastChangedRevision().getNumber()); 597 assertEquals("ed", parsedStatus.getLastCommitAuthor()); 598 assertEquals(SVNNodeKind.FILE, parsedStatus.getNodeKind()); 599 assertEquals(myFile.getPath(), parsedStatus.getPath()); 600 assertEquals(SVNStatusKind.MODIFIED, parsedStatus.getPropStatus()); 601 assertNull(parsedStatus.getLockComment()); 602 assertNull(parsedStatus.getLockOwner()); 603 assertNull(parsedStatus.getLockCreationDate()); 604 } 605 606 public void testGetSingleStatusFileLocked() throws Exception { 607 File myFile = new File (dataRootDir + "/SvnWcParser/file-locked/testapp/Main.java"); 608 ISVNStatus parsedStatus = svnWcParser.getSingleStatus(myFile); 609 assertFalse(parsedStatus.isCopied()); 610 assertNull(parsedStatus.getUrlCopiedFrom()); 611 assertEquals("svn://gonzo/testRepos/trunk/testApp/src/testapp/Main.java", parsedStatus.getUrl().toString()); 612 assertEquals(SVNStatusKind.NORMAL, parsedStatus.getTextStatus()); 613 assertEquals(10, parsedStatus.getRevision().getNumber()); 614 assertNull(parsedStatus.getConflictNew()); 615 assertNull(parsedStatus.getConflictOld()); 616 assertNull(parsedStatus.getConflictWorking()); 617 assertEquals(myFile, parsedStatus.getFile()); 618 Date expectedDate = SvnWcUtils.parseSvnDate("2006-04-12T10:43:46.371180Z"); 619 assertEquals(expectedDate, parsedStatus.getLastChangedDate()); 620 assertEquals(2, parsedStatus.getLastChangedRevision().getNumber()); 621 assertEquals("ed", parsedStatus.getLastCommitAuthor()); 622 assertEquals(SVNNodeKind.FILE, parsedStatus.getNodeKind()); 623 assertEquals(myFile.getPath(), parsedStatus.getPath()); 624 assertEquals(SVNStatusKind.NORMAL, parsedStatus.getPropStatus()); 625 assertEquals("", parsedStatus.getLockComment()); 626 assertEquals("ed", parsedStatus.getLockOwner()); 627 expectedDate = SvnWcUtils.parseSvnDate("2006-05-27T04:15:00.168100Z"); 628 assertEquals(expectedDate, parsedStatus.getLockCreationDate()); 629 } 630 631 public void testGetSingleStatusFileLockedNewFormat() throws Exception { 632 File myFile = new File (dataRootDir + "/SvnWcParser/new-format-file-locked/testapp/AnotherMain.java"); 633 ISVNStatus parsedStatus = svnWcParser.getSingleStatus(myFile); 634 assertFalse(parsedStatus.isCopied()); 635 assertNull(parsedStatus.getUrlCopiedFrom()); 636 assertEquals("svn://gonzo/testRepos/trunk/testApp/src/testapp/AnotherMain.java", parsedStatus.getUrl().toString()); 637 assertEquals(SVNStatusKind.NORMAL, parsedStatus.getTextStatus()); 638 assertEquals(19, parsedStatus.getRevision().getNumber()); 639 assertNull(parsedStatus.getConflictNew()); 640 assertNull(parsedStatus.getConflictOld()); 641 assertNull(parsedStatus.getConflictWorking()); 642 assertEquals(myFile, parsedStatus.getFile()); 643 Date expectedDate = SvnWcUtils.parseSvnDate("2006-04-25T07:05:57.738276Z"); 644 assertEquals(expectedDate, parsedStatus.getLastChangedDate()); 645 assertEquals(10, parsedStatus.getLastChangedRevision().getNumber()); 646 assertEquals("ed", parsedStatus.getLastCommitAuthor()); 647 assertEquals(SVNNodeKind.FILE, parsedStatus.getNodeKind()); 648 assertEquals(myFile.getPath(), parsedStatus.getPath()); 649 assertEquals(SVNStatusKind.NORMAL, parsedStatus.getPropStatus()); 650 assertNull(parsedStatus.getLockComment()); 651 assertEquals("ed", parsedStatus.getLockOwner()); 652 expectedDate = SvnWcUtils.parseSvnDate("2006-08-29T10:28:18.570376Z"); 653 assertEquals(expectedDate, parsedStatus.getLockCreationDate()); 654 } 655 656 public void testGetSingleStatusFileLockedWithCommentNewFormat() throws Exception { 657 File myFile = new File (dataRootDir + "/SvnWcParser/new-format-file-locked-with-comment/testapp/AnotherMain.java"); 658 ISVNStatus parsedStatus = svnWcParser.getSingleStatus(myFile); 659 assertFalse(parsedStatus.isCopied()); 660 assertNull(parsedStatus.getUrlCopiedFrom()); 661 assertEquals("svn://gonzo/testRepos/trunk/testApp/src/testapp/AnotherMain.java", parsedStatus.getUrl().toString()); 662 assertEquals(SVNStatusKind.NORMAL, parsedStatus.getTextStatus()); 663 assertEquals(19, parsedStatus.getRevision().getNumber()); 664 assertNull(parsedStatus.getConflictNew()); 665 assertNull(parsedStatus.getConflictOld()); 666 assertNull(parsedStatus.getConflictWorking()); 667 assertEquals(myFile, parsedStatus.getFile()); 668 Date expectedDate = SvnWcUtils.parseSvnDate("2006-04-25T07:05:57.738276Z"); 669 assertEquals(expectedDate, parsedStatus.getLastChangedDate()); 670 assertEquals(10, parsedStatus.getLastChangedRevision().getNumber()); 671 assertEquals("ed", parsedStatus.getLastCommitAuthor()); 672 assertEquals(SVNNodeKind.FILE, parsedStatus.getNodeKind()); 673 assertEquals(myFile.getPath(), parsedStatus.getPath()); 674 assertEquals(SVNStatusKind.NORMAL, parsedStatus.getPropStatus()); 675 assertEquals("This is my comment", parsedStatus.getLockComment()); 676 assertEquals("ed", parsedStatus.getLockOwner()); 677 expectedDate = SvnWcUtils.parseSvnDate("2006-08-29T10:36:02.498983Z"); 678 assertEquals(expectedDate, parsedStatus.getLockCreationDate()); 679 } 680 681 public void testGetSingleStatusNoChangesKeywords() throws Exception { 682 File myFile = new File (dataRootDir + "/SvnWcParser/no-changes-keywords/testapp/Main.java"); 683 ISVNStatus parsedStatus = svnWcParser.getSingleStatus(myFile); 684 assertFalse(parsedStatus.isCopied()); 685 assertNull(parsedStatus.getUrlCopiedFrom()); 686 assertEquals("svn://gonzo/testRepos/trunk/testApp/src/testapp/Main.java", parsedStatus.getUrl().toString()); 687 assertEquals(SVNStatusKind.NORMAL, parsedStatus.getTextStatus()); 688 assertEquals(11, parsedStatus.getRevision().getNumber()); 689 assertNull(parsedStatus.getConflictNew()); 690 assertNull(parsedStatus.getConflictOld()); 691 assertNull(parsedStatus.getConflictWorking()); 692 assertEquals(myFile, parsedStatus.getFile()); 693 Date expectedDate = SvnWcUtils.parseSvnDate("2006-06-05T11:03:38.718355Z"); 694 assertEquals(expectedDate, parsedStatus.getLastChangedDate()); 695 assertEquals(11, parsedStatus.getLastChangedRevision().getNumber()); 696 assertEquals("ed", parsedStatus.getLastCommitAuthor()); 697 assertEquals(SVNNodeKind.FILE, parsedStatus.getNodeKind()); 698 assertEquals(myFile.getPath(), parsedStatus.getPath()); 699 assertEquals(SVNStatusKind.NORMAL, parsedStatus.getPropStatus()); 700 assertNull(parsedStatus.getLockComment()); 701 assertNull(parsedStatus.getLockOwner()); 702 assertNull(parsedStatus.getLockCreationDate()); 703 } 704 705 708 public void testGetSingleStatusSymbolicLink() throws Exception { 709 File myFile = new File (dataRootDir + "/SvnWcParser/file-symbolic-link/bin/myLink"); 710 ISVNStatus parsedStatus = svnWcParser.getSingleStatus(myFile); 711 assertEquals(SVNStatusKind.NORMAL, parsedStatus.getTextStatus()); 712 } 713 714 public void testGetSingleStatusSymbolicLinkNewFormat() throws Exception { 715 File myFile = new File (dataRootDir + "/SvnWcParser/new-format-file-symbolic-link/bin/myLink"); 716 ISVNStatus parsedStatus = svnWcParser.getSingleStatus(myFile); 717 assertEquals(SVNStatusKind.NORMAL, parsedStatus.getTextStatus()); 718 } 719 720 public void testGetSingleStatusBinaryConflict() throws Exception { 721 File myFile = new File (dataRootDir + "/SvnWcParser/file-binary-conflicts/bin/image.bmp"); 722 ISVNStatus parsedStatus = svnWcParser.getSingleStatus(myFile); 723 assertEquals(SVNStatusKind.CONFLICTED, parsedStatus.getTextStatus()); 724 } 725 726 public void testGetSingleStatusBinaryConflictNewFormat() throws Exception { 727 File myFile = new File (dataRootDir + "/SvnWcParser/new-format-file-binary-conflicts/bin/image.bmp"); 728 ISVNStatus parsedStatus = svnWcParser.getSingleStatus(myFile); 729 assertEquals(SVNStatusKind.CONFLICTED, parsedStatus.getTextStatus()); 730 } 731 732 } 733 | Popular Tags |