@Test public void batchTest() throws IOException, InterruptedException { final Path init = ioService.get(URI.create("git://amend-repo-test/readme.txt")); ioService.write(init, "init!", new CommentedOption("User Tester", "message1")); ioService.startBatch(fs1); assertTrue(fs1Batch.isOnBatch()); ioService.endBatch(); assertFalse(fs1Batch.isOnBatch()); assertProperBatchCleanup(); }
@Test public void batchTest() throws IOException, InterruptedException { final Path init = ioService.get(URI.create("git://amend-repo-test/readme.txt")); ioService.write(init, "init!", new CommentedOption("User Tester", "message1")); ioService.startBatch(fs1); assertTrue(fs1Batch.isOnBatch()); ioService.endBatch(); assertFalse(fs1Batch.isOnBatch()); assertProperBatchCleanup(); }
@Test public void justOneFSOnBatchTest() throws IOException, InterruptedException { Path init = ioService.get(URI.create("git://amend-repo-test/readme.txt")); ioService.write(init, "init!", new CommentedOption("User Tester", "message1")); init = ioService.get(URI.create("git://check-amend-repo-test/readme.txt")); ioService.write(init, "init!", new CommentedOption("User Tester", "message1")); ioService.startBatch(fs1); assertTrue(fs1Batch.isOnBatch()); assertFalse(fs2Batch.isOnBatch()); ioService.endBatch(); assertProperBatchCleanup(); }
@Test public void testInnerBatch() throws IOException, InterruptedException { Path init = ioService.get(URI.create("git://amend-repo-test/readme.txt")); ioService.write(init, "init!", new CommentedOption("User Tester", "message1")); init = ioService.get(URI.create("git://check-amend-repo-test/readme.txt")); ioService.write(init, "init!", new CommentedOption("User Tester", "message1")); ioService.startBatch(fs1); assertTrue(fs1Batch.isOnBatch()); ioService.startBatch(fs1); assertTrue(fs1Batch.isOnBatch()); ioService.endBatch(); assertTrue(fs1Batch.isOnBatch()); ioService.endBatch(); assertProperBatchCleanup(); }
@Test public void testInnerBatch() throws IOException, InterruptedException { Path init = ioService.get(URI.create("git://amend-repo-test/readme.txt")); ioService.write(init, "init!", new CommentedOption("User Tester", "message1")); init = ioService.get(URI.create("git://check-amend-repo-test/readme.txt")); ioService.write(init, "init!", new CommentedOption("User Tester", "message1")); ioService.startBatch(fs1); assertTrue(fs1Batch.isOnBatch()); ioService.startBatch(fs1); assertTrue(fs1Batch.isOnBatch()); ioService.endBatch(); assertTrue(fs1Batch.isOnBatch()); ioService.endBatch(); assertProperBatchCleanup(); }
@Test public void justOneFSOnBatchTest() throws IOException, InterruptedException { Path init = ioService.get(URI.create("git://amend-repo-test/readme.txt")); ioService.write(init, "init!", new CommentedOption("User Tester", "message1")); init = ioService.get(URI.create("git://check-amend-repo-test/readme.txt")); ioService.write(init, "init!", new CommentedOption("User Tester", "message1")); ioService.startBatch(fs1); assertTrue(fs1Batch.isOnBatch()); assertFalse(fs2Batch.isOnBatch()); ioService.endBatch(); assertProperBatchCleanup(); }
@Test public void testTwoFsOnBatchByTheSameThread() throws IOException, InterruptedException { Path init = ioService.get(URI.create("git://amend-repo-test/readme.txt")); ioService.write(init, "init!", new CommentedOption("User Tester", "message1")); init = ioService.get(URI.create("git://check-amend-repo-test/readme.txt")); ioService.write(init, "init!", new CommentedOption("User Tester", "message1")); ioService.startBatch(fs1); assertTrue(fs1Batch.isOnBatch()); ioService.endBatch(); ioService.startBatch(fs2); assertTrue(fs2Batch.isOnBatch()); ioService.endBatch(); assertProperBatchCleanup(); }
@Test public void testTwoFsOnBatchByTheSameThread() throws IOException, InterruptedException { Path init = ioService.get(URI.create("git://amend-repo-test/readme.txt")); ioService.write(init, "init!", new CommentedOption("User Tester", "message1")); init = ioService.get(URI.create("git://check-amend-repo-test/readme.txt")); ioService.write(init, "init!", new CommentedOption("User Tester", "message1")); ioService.startBatch(fs1); assertTrue(fs1Batch.isOnBatch()); ioService.endBatch(); ioService.startBatch(fs2); assertTrue(fs2Batch.isOnBatch()); ioService.endBatch(); assertProperBatchCleanup(); }
@Test public void innerBatchShouldOnlyBeCalledOnTheSameFS() throws IOException, InterruptedException { Path repo1 = ioService.get(URI.create("git://amend-repo-test/readme.txt")); ioService.write(repo1, "init!", new CommentedOption("User Tester", "message1")); Path repo2 = ioService.get(URI.create("git://check-amend-repo-test/readme.txt")); ioService.write(repo2, "init!", new CommentedOption("User Tester", "message1")); ioService.startBatch(fs1); assertTrue(fs1Batch.isOnBatch()); try { ioService.startBatch(fs2); fail(); } catch (BatchLockControl.BatchRuntimeException e) { //We already have a batch process running on another FS : git://amend-repo-test } assertTrue(fs1Batch.isOnBatch()); ioService.endBatch(); assertProperBatchCleanup(); }
@Test public void innerBatchShouldOnlyBeCalledOnTheSameFS() throws IOException, InterruptedException { Path repo1 = ioService.get(URI.create("git://amend-repo-test/readme.txt")); ioService.write(repo1, "init!", new CommentedOption("User Tester", "message1")); Path repo2 = ioService.get(URI.create("git://check-amend-repo-test/readme.txt")); ioService.write(repo2, "init!", new CommentedOption("User Tester", "message1")); ioService.startBatch(fs1); assertTrue(fs1Batch.isOnBatch()); try { ioService.startBatch(fs2); fail(); } catch (BatchLockControl.BatchRuntimeException e) { //We already have a batch process running on another FS : git://amend-repo-test } assertTrue(fs1Batch.isOnBatch()); ioService.endBatch(); assertProperBatchCleanup(); }