From f60954ba88fb4b106af2fd6056f69c93a54110b6 Mon Sep 17 00:00:00 2001 From: Andrey Loskutov Date: Sat, 29 Oct 2016 11:53:42 +0200 Subject: Bug 506732 - cleanup trailing spaces in test plugins Change-Id: I55e43b2389d1a9baffdfecea701b37105e4548ae Signed-off-by: Andrey Loskutov --- .../org/eclipse/compare/tests/AsyncExecTests.java | 6 +- .../eclipse/compare/tests/CompareTestPlugin.java | 6 +- .../src/org/eclipse/compare/tests/DiffTest.java | 60 +++++------ .../compare/tests/DocLineComparatorTest.java | 56 +++++----- .../eclipse/compare/tests/FileDiffResultTest.java | 14 +-- .../src/org/eclipse/compare/tests/FilterTest.java | 14 +-- .../src/org/eclipse/compare/tests/PatchTest.java | 118 ++++++++++----------- .../src/org/eclipse/compare/tests/PatchUITest.java | 2 +- .../tests/RangeDifferencerThreeWayDiffTest.java | 32 +++--- .../eclipse/compare/tests/TextMergeViewerTest.java | 56 +++++----- .../org/eclipse/compare/tests/WorkspaceTest.java | 26 ++--- .../tests/performance/RangeDifferencerTest.java | 16 +-- .../src/org/eclipse/core/tests/net/Activator.java | 2 +- .../org/eclipse/core/tests/net/AllNetTests.java | 2 +- .../src/org/eclipse/core/tests/net/NetTest.java | 82 +++++++------- .../eclipse/core/tests/net/SystemProxyTest.java | 8 +- .../team/tests/core/RepositoryProviderBic.java | 12 +-- .../team/tests/core/RepositoryProviderNaish.java | 6 +- .../tests/core/RepositoryProviderOtherSport.java | 2 +- .../team/tests/core/RepositoryProviderTests.java | 84 +++++++-------- .../tests/core/RepositoryProviderWithLinking.java | 10 +- .../team/tests/core/StorageMergerTests.java | 8 +- .../org/eclipse/team/tests/core/StreamTests.java | 2 +- .../eclipse/team/tests/core/TestStorageMerger.java | 2 +- .../tests/core/mapping/ScopeBuildingTests.java | 26 ++--- .../tests/core/mapping/ScopeTestSubscriber.java | 2 +- .../team/tests/core/mapping/ScopeTests.java | 10 +- .../team/tests/core/regression/Bug_217673.java | 2 +- .../tests/core/regression/DoNotRemoveTest.java | 2 +- .../regression/PessimisticRepositoryProvider.java | 12 +-- .../tests/ui/SaveableCompareEditorInputTest.java | 4 +- .../tests/ui/synchronize/ResourceContentTests.java | 24 ++--- 32 files changed, 354 insertions(+), 354 deletions(-) (limited to 'tests') diff --git a/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/AsyncExecTests.java b/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/AsyncExecTests.java index c814dd244..023a200c0 100644 --- a/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/AsyncExecTests.java +++ b/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/AsyncExecTests.java @@ -32,7 +32,7 @@ public class AsyncExecTests extends TestCase { public AsyncExecTests(String name) { super(name); } - + public void testQueueAdd() { WorkQueue q = new WorkQueue(); assertTrue(q.isEmpty()); @@ -80,7 +80,7 @@ public class AsyncExecTests extends TestCase { assertEquals(r, q.remove()); assertTrue(q.isEmpty()); } - + public void testWorker() { final Worker w = new Worker(""); final List worked = new ArrayList<>(); @@ -142,7 +142,7 @@ public class AsyncExecTests extends TestCase { assertEquals(r, worked.get(1)); assertEquals(r2, worked.get(0)); } - + public void testCancelOnRequeue() { final Worker w = new Worker(""); final List worked = new ArrayList<>(); diff --git a/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/CompareTestPlugin.java b/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/CompareTestPlugin.java index fb86dbec2..31c17e008 100644 --- a/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/CompareTestPlugin.java +++ b/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/CompareTestPlugin.java @@ -14,13 +14,13 @@ import org.eclipse.core.runtime.Plugin; /** * The main plug-in class to be used in the desktop. - * + * * @since 3.1 */ public class CompareTestPlugin extends Plugin { - + private static CompareTestPlugin fgPlugin; - + public CompareTestPlugin() { fgPlugin= this; } diff --git a/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/DiffTest.java b/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/DiffTest.java index 33ebb49b5..fabbbb85d 100644 --- a/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/DiffTest.java +++ b/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/DiffTest.java @@ -30,9 +30,9 @@ public class DiffTest extends TestCase { private static final String XYZ= "xyz"; //$NON-NLS-1$ private static final String _123= "123"; //$NON-NLS-1$ //private static final String _456= "456"; //$NON-NLS-1$ - + static final String SEPARATOR= System.getProperty("line.separator"); //$NON-NLS-1$ - + public DiffTest() { super(); } @@ -40,11 +40,11 @@ public class DiffTest extends TestCase { public DiffTest(String name) { super(name); } - + protected void tearDown() throws Exception { super.tearDown(); } - + public void testLineAddition() { String s1= ABC + SEPARATOR + DEF + SEPARATOR + XYZ; String s2= ABC + SEPARATOR + DEF + SEPARATOR + _123 + SEPARATOR + XYZ; @@ -65,7 +65,7 @@ public class DiffTest extends TestCase { assertTrue(result[0][2].lineNumber() == 2); assertTrue(result[1][2].lineNumber() == 3); } - + public void testLineDeletion() { String s1= ABC + SEPARATOR + DEF + SEPARATOR + _123 + SEPARATOR + XYZ; String s2= ABC + SEPARATOR + DEF + SEPARATOR + XYZ; @@ -85,7 +85,7 @@ public class DiffTest extends TestCase { assertTrue(result[1][1].lineNumber() == 1); assertTrue(result[1][2].lineNumber() == 2); } - + public void testLineAppendEnd() { String s1= ABC + SEPARATOR + DEF; String s2= ABC + SEPARATOR + DEF + SEPARATOR + _123; @@ -104,7 +104,7 @@ public class DiffTest extends TestCase { assertTrue(result[0][1].lineNumber() == 1); assertTrue(result[1][1].lineNumber() == 1); } - + public void testLineDeleteEnd() { String s1= ABC + SEPARATOR + DEF + SEPARATOR + _123; String s2= ABC + SEPARATOR + DEF; @@ -123,7 +123,7 @@ public class DiffTest extends TestCase { assertTrue(result[0][1].lineNumber() == 1); assertTrue(result[1][1].lineNumber() == 1); } - + public void testLineAppendStart() { String s1= ABC + SEPARATOR + DEF; String s2= _123 + SEPARATOR + ABC + SEPARATOR + DEF; @@ -142,7 +142,7 @@ public class DiffTest extends TestCase { assertTrue(result[0][1].lineNumber() == 1); assertTrue(result[1][1].lineNumber() == 2); } - + public void testLineDeleteStart() { String s1= _123 + SEPARATOR + ABC + SEPARATOR + DEF; String s2= ABC + SEPARATOR + DEF; @@ -161,13 +161,13 @@ public class DiffTest extends TestCase { assertTrue(result[1][0].lineNumber() == 0); assertTrue(result[1][1].lineNumber() == 1); } - + private IRangeComparator toRangeComparator(String s) { IDocument doc1= new Document(); doc1.set(s); return new DocLineComparator(doc1, null, true); } - + private RangeDifference[] getDifferences(String s1, String s2) { IRangeComparator comp1= toRangeComparator(s1); IRangeComparator comp2= toRangeComparator(s2); @@ -176,82 +176,82 @@ public class DiffTest extends TestCase { assertTrue(differences.length == oldDifferences.length); for (int i = 0; i < oldDifferences.length; i++) { assertEquals(oldDifferences[i], differences[i]); - + } return differences; } - + public void testDocAddition() { String s1= ABC + SEPARATOR + DEF + SEPARATOR + XYZ; String s2= ABC + SEPARATOR + DEF + SEPARATOR + _123 + SEPARATOR + XYZ; - + RangeDifference[] result = getDifferences(s1, s2); - + assertTrue(result.length == 1); assertTrue(result[0].leftStart() == 2); assertTrue(result[0].leftLength() == 0); assertTrue(result[0].rightStart() == 2); assertTrue(result[0].rightLength() == 1); } - + public void testDocDeletion() { String s1= ABC + SEPARATOR + DEF + SEPARATOR + _123 + SEPARATOR + XYZ; String s2= ABC + SEPARATOR + DEF + SEPARATOR + XYZ; - + RangeDifference[] result = getDifferences(s1, s2); - + assertTrue(result.length == 1); assertTrue(result[0].leftStart() == 2); assertTrue(result[0].leftLength() == 1); assertTrue(result[0].rightStart() == 2); assertTrue(result[0].rightLength() == 0); } - + public void testDocAppendStart() { String s1= ABC + SEPARATOR + DEF; String s2= _123 + SEPARATOR + ABC + SEPARATOR + DEF; - + RangeDifference[] result = getDifferences(s1, s2); - + assertTrue(result.length == 1); assertTrue(result[0].leftStart() == 0); assertTrue(result[0].leftLength() == 0); assertTrue(result[0].rightStart() == 0); assertTrue(result[0].rightLength() == 1); } - + public void testDocDeleteStart() { String s1= _123 + SEPARATOR + ABC + SEPARATOR + DEF; String s2= ABC + SEPARATOR + DEF; - + RangeDifference[] result = getDifferences(s1, s2); - + assertTrue(result.length == 1); assertTrue(result[0].leftStart() == 0); assertTrue(result[0].leftLength() == 1); assertTrue(result[0].rightStart() == 0); assertTrue(result[0].rightLength() == 0); } - + public void testDocAppendEnd() { String s1= ABC + SEPARATOR + DEF; String s2= ABC + SEPARATOR + DEF + SEPARATOR + _123; - + RangeDifference[] result = getDifferences(s1, s2); - + assertTrue(result.length == 1); assertTrue(result[0].leftStart() == 2); assertTrue(result[0].leftLength() == 0); assertTrue(result[0].rightStart() == 2); assertTrue(result[0].rightLength() == 1); } - + public void testDocDeleteEnd() { String s1= ABC + SEPARATOR + DEF + SEPARATOR + _123; String s2= ABC + SEPARATOR + DEF; - + RangeDifference[] result = getDifferences(s1, s2); - + assertTrue(result.length == 1); assertTrue(result[0].leftStart() == 2); assertTrue(result[0].leftLength() == 1); diff --git a/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/DocLineComparatorTest.java b/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/DocLineComparatorTest.java index 5c8b7c6f7..1f08dd467 100644 --- a/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/DocLineComparatorTest.java +++ b/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/DocLineComparatorTest.java @@ -24,7 +24,7 @@ import org.eclipse.jface.text.IRegion; import org.eclipse.jface.text.Region; public class DocLineComparatorTest extends TestCase { - + public DocLineComparatorTest(String name) { super(name); } @@ -40,10 +40,10 @@ public class DocLineComparatorTest extends TestCase { public void testRangesEqual() { IDocument doc1= new Document(); doc1.set("if (s.strip))"); //$NON-NLS-1$ - + IDocument doc2= new Document(); doc2.set("if (s.strip)"); //$NON-NLS-1$ - + IRangeComparator comp1= new DocLineComparator(doc1, null, true); IRangeComparator comp2= new DocLineComparator(doc2, null, true); @@ -53,10 +53,10 @@ public class DocLineComparatorTest extends TestCase { public void testWhitespaceAtEnd() { IDocument doc1= new Document(); doc1.set("if (s.strip))"); //$NON-NLS-1$ - + IDocument doc2= new Document(); doc2.set("if (s.strip)) "); //$NON-NLS-1$ - + IRangeComparator comp1= new DocLineComparator(doc1, null, true); IRangeComparator comp2= new DocLineComparator(doc2, null, true); @@ -192,7 +192,7 @@ public class DocLineComparatorTest extends TestCase { new ICompareFilter[] { filter2, filter3 }, 'R'); Assert.assertFalse(comp3.rangesEqual(0, comp4, 0)); } - + public void testWhitespace() { IDocument[] docs = new IDocument[6]; docs[0] = new Document(); @@ -201,14 +201,14 @@ public class DocLineComparatorTest extends TestCase { docs[3] = new Document(); docs[4] = new Document(); docs[5] = new Document(); - + docs[0].set("if (s.strip))\r\n");//$NON-NLS-1$ docs[1].set("if (s.strip))\n"); //$NON-NLS-1$ docs[2].set("if (s .strip))\n"); //$NON-NLS-1$ docs[3].set("if (s.str ip))\r"); //$NON-NLS-1$ docs[4].set("if (s.strip))"); //$NON-NLS-1$ docs[5].set("if (s.stri p))"); //$NON-NLS-1$ - + ICompareFilter[][] filters = new ICompareFilter[3][]; filters[0] = null; filters[1] = new ICompareFilter[]{ @@ -218,21 +218,21 @@ public class DocLineComparatorTest extends TestCase { Object right) { // EMPTY } - + public IRegion[] getFilteredRegions(HashMap lineComparison) { return new IRegion[] { new Region(0, 2) }; } - + public boolean isEnabledInitially() { return false; } - + public boolean canCacheFilteredRegions() { return true; // cache-able } } }; - + filters[2] = new ICompareFilter[]{ new ICompareFilter() { @@ -240,15 +240,15 @@ public class DocLineComparatorTest extends TestCase { Object right) { // EMPTY } - + public IRegion[] getFilteredRegions(HashMap lineComparison) { return new IRegion[] { new Region(0, 2) }; } - + public boolean isEnabledInitially() { return false; } - + public boolean canCacheFilteredRegions() { return false; // not cache-able } @@ -262,7 +262,7 @@ public class DocLineComparatorTest extends TestCase { l = new DocLineComparator(docs[i], null, false, filters[k], 'L'); r = new DocLineComparator(docs[j], null, false, filters[k], 'R'); Assert.assertFalse(l.rangesEqual(0, r, 0)); - + l = new DocLineComparator(docs[i], null, true, filters[k], 'L'); r = new DocLineComparator(docs[j], null, true, filters[k], 'R'); Assert.assertTrue(l.rangesEqual(0, r, 0)); @@ -272,10 +272,10 @@ public class DocLineComparatorTest extends TestCase { public void testEmpty() { IDocument doc1= new Document(); doc1.set(""); //$NON-NLS-1$ - + IDocument doc2= new Document(); doc2.set(" "); //$NON-NLS-1$ - + IRangeComparator comp1= new DocLineComparator(doc1, null, true); IRangeComparator comp2= new DocLineComparator(doc2, null, true); @@ -284,7 +284,7 @@ public class DocLineComparatorTest extends TestCase { public void testNoContent() { IDocument doc= new Document(); - + IRangeComparator comp1= new DocLineComparator(doc, null, true); IRangeComparator comp2= new DocLineComparator(doc, new Region(0, doc.getLength()), true); @@ -292,43 +292,43 @@ public class DocLineComparatorTest extends TestCase { Assert.assertEquals(comp1.getRangeCount(), comp2.getRangeCount()); Assert.assertEquals(1, comp2.getRangeCount()); } - + public void testOneLine() { IDocument doc = new Document(); doc.set("line1"); //$NON-NLS-1$ - + IRangeComparator comp1= new DocLineComparator(doc, null, true); IRangeComparator comp2= new DocLineComparator(doc, new Region(0, doc.getLength()), true); Assert.assertEquals(comp1.getRangeCount(), comp2.getRangeCount()); Assert.assertEquals(1, comp2.getRangeCount()); } - + public void testTwoLines() { IDocument doc = new Document(); doc.set("line1\nline2"); //$NON-NLS-1$ - + IRangeComparator comp1= new DocLineComparator(doc, null, true); IRangeComparator comp2= new DocLineComparator(doc, new Region(0, doc.getLength()), true); Assert.assertEquals(comp1.getRangeCount(), comp2.getRangeCount()); Assert.assertEquals(2, comp2.getRangeCount()); - + IRangeComparator comp3= new DocLineComparator(doc, new Region(0, "line1".length()), true); Assert.assertEquals(1, comp3.getRangeCount()); - + comp3= new DocLineComparator(doc, new Region(0, "line1".length()+1), true); Assert.assertEquals(2, comp3.getRangeCount()); // two lines } - + public void testBug259422() { IDocument doc = new Document(); doc.set(""); //$NON-NLS-1$ - + IRangeComparator comp1= new DocLineComparator(doc, null, true); IRangeComparator comp2= new DocLineComparator(doc, new Region(0, doc.getLength()), true); Assert.assertEquals(comp1.getRangeCount(), comp2.getRangeCount()); } - + } diff --git a/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/FileDiffResultTest.java b/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/FileDiffResultTest.java index e0d2db849..401bbd306 100644 --- a/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/FileDiffResultTest.java +++ b/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/FileDiffResultTest.java @@ -59,7 +59,7 @@ public class FileDiffResultTest extends WorkspaceTest { /** * Tests applying a patch which creates a new file in a project. The file * doesn't exist in the project. - * + * * @throws CoreException */ public void testPatchAddsNewFile() throws CoreException { @@ -96,7 +96,7 @@ public class FileDiffResultTest extends WorkspaceTest { /** * Tests applying a patch which creates a new file in a project. The file * already exists in the project. - * + * * @throws CoreException */ public void testPatchAddsExistingFileWithSameContents() @@ -141,7 +141,7 @@ public class FileDiffResultTest extends WorkspaceTest { /** * Tests applying a patch which creates a new file in a project. The file * already exists in the project, but has different contents. - * + * * @throws CoreException */ public void testPatchAddsExistingFileWithDifferentContents() @@ -199,7 +199,7 @@ public class FileDiffResultTest extends WorkspaceTest { fail(); } } - + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=187365 public void testExcludePartOfNonWorkspacePatch() { Patcher patcher = new Patcher(); @@ -262,7 +262,7 @@ public class FileDiffResultTest extends WorkspaceTest { /** * Return string read from an input stream. - * + * * @param in * Input stream. * @return String read from the stream. @@ -275,7 +275,7 @@ public class FileDiffResultTest extends WorkspaceTest { /** * Returns content of a file. - * + * * @param file * A file. * @return Content of the file. @@ -290,7 +290,7 @@ public class FileDiffResultTest extends WorkspaceTest { /** * Check if two input streams are equal. They can't be null, all bytes need * to be the same, and they need to have same length. - * + * * @param inputStream1 * First stream to check. * @param inputStream2 diff --git a/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/FilterTest.java b/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/FilterTest.java index 29016b197..540729682 100644 --- a/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/FilterTest.java +++ b/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/FilterTest.java @@ -16,34 +16,34 @@ import junit.framework.*; import junit.framework.TestCase; public class FilterTest extends TestCase { - + CompareResourceFilter fFilter; - + public FilterTest(String name) { super(name); } - + public void testFilterFile() { CompareResourceFilter f= new CompareResourceFilter(); f.setFilters("*.class"); //$NON-NLS-1$ Assert.assertTrue("file foo.class should be filtered", f.filter("foo.class", false, false)); //$NON-NLS-1$ //$NON-NLS-2$ Assert.assertFalse("file foo.java shouldn't be filtered", f.filter("foo.java", false, false)); //$NON-NLS-1$ //$NON-NLS-2$ } - + public void testFilterDotFile() { CompareResourceFilter f= new CompareResourceFilter(); f.setFilters(".cvsignore"); //$NON-NLS-1$ Assert.assertTrue("file .cvsignore should be filtered", f.filter(".cvsignore", false, false)); //$NON-NLS-1$ //$NON-NLS-2$ Assert.assertFalse("file foo.cvsignore shouldn't be filtered", f.filter("foo.cvsignore", false, false)); //$NON-NLS-1$ //$NON-NLS-2$ } - + public void testFilterFolder() { CompareResourceFilter f= new CompareResourceFilter(); f.setFilters("bin/"); //$NON-NLS-1$ Assert.assertTrue("folder bin should be filtered", f.filter("bin", true, false)); //$NON-NLS-1$ //$NON-NLS-2$ Assert.assertFalse("file bin shouldn't be filtered", f.filter("bin", false, false)); //$NON-NLS-1$ //$NON-NLS-2$ } - + public void testMultiFilter() { CompareResourceFilter f= new CompareResourceFilter(); f.setFilters("*.class, .cvsignore, bin/, src/"); //$NON-NLS-1$ @@ -56,7 +56,7 @@ public class FilterTest extends TestCase { Assert.assertTrue("folder src should be filtered", f.filter("src", true, false)); //$NON-NLS-1$ //$NON-NLS-2$ Assert.assertFalse("file src shouldn't be filtered", f.filter("src", false, false)); //$NON-NLS-1$ //$NON-NLS-2$ } - + public void testVerify() { //Assert.assertNull("filters don't verify", Filter.validateResourceFilters("*.class, .cvsignore, bin/")); //Assert.assertNotNull("filters shouldn't verify", Filter.validateResourceFilters("bin//")); diff --git a/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/PatchTest.java b/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/PatchTest.java index 615df7752..c1355d829 100644 --- a/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/PatchTest.java +++ b/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/PatchTest.java @@ -62,9 +62,9 @@ import org.eclipse.core.runtime.Status; public class PatchTest extends TestCase { private static final String PATCH_CONFIGURATION = "patchConfiguration.properties"; - + Properties defaultPatchProperties; - + public PatchTest(String name) { super(name); defaultPatchProperties = new Properties(); @@ -81,11 +81,11 @@ public class PatchTest extends TestCase { protected void tearDown() throws Exception { super.tearDown(); } - + public void testCreatePatch() throws CoreException, IOException { patch("addition.txt", "patch_addition.txt", "exp_addition.txt"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } - + public void testUnterminatedCreatePatch() throws CoreException, IOException { patch("addition.txt", "patch_addition2.txt", "exp_addition2.txt"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } @@ -145,82 +145,82 @@ public class PatchTest extends TestCase { expected.add("UID: 42\n"); assertEquals(LineReader.createString(false, expected), LineReader.createString(false, lines)); } - + public void testDateUnknown() throws CoreException { IStorage patchStorage = new StringStorage("patch_dateunknown.txt"); IFilePatch[] patches = ApplyPatchOperation.parsePatch(patchStorage); assertEquals(IFilePatch.DATE_UNKNOWN, patches[0].getBeforeDate()); assertEquals(IFilePatch.DATE_UNKNOWN, patches[0].getAfterDate()); } - + public void testDateError() throws CoreException { IStorage patchStorage = new StringStorage("patch_dateerror.txt"); IFilePatch[] patches = ApplyPatchOperation.parsePatch(patchStorage); assertEquals(IFilePatch.DATE_UNKNOWN, patches[0].getBeforeDate()); assertEquals(IFilePatch.DATE_UNKNOWN, patches[0].getAfterDate()); } - + public void testDateKnown() throws CoreException { IStorage patchStorage = new StringStorage("patch_datevalid.txt"); IFilePatch[] patches = ApplyPatchOperation.parsePatch(patchStorage); assertFalse(IFilePatch.DATE_UNKNOWN == patches[0].getBeforeDate()); assertFalse(IFilePatch.DATE_UNKNOWN == patches[0].getAfterDate()); } - - //Test creation of new workspace patch + + //Test creation of new workspace patch public void testWorkspacePatch_Create(){ - //Note the order that exists in the array of expected results is based purely on the order of the files in the patch + //Note the order that exists in the array of expected results is based purely on the order of the files in the patch patchWorkspace(new String[]{"addition.txt", "addition.txt"}, "patch_workspacePatchAddition.txt", new String[] { "exp_workspacePatchAddition2.txt","exp_workspacePatchAddition.txt"}, false, 0); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ } - - //Test applying the reverse of workspace creation patch + + //Test applying the reverse of workspace creation patch public void testWorkspacePatch_Create_Reverse(){ - //Note the order that exists in the array of expected results is based purely on the order of the files in the patch + //Note the order that exists in the array of expected results is based purely on the order of the files in the patch patchWorkspace(new String[]{"exp_workspacePatchAddition2.txt","exp_workspacePatchAddition.txt"}, "patch_workspacePatchAddition.txt", new String[] {"addition.txt", "addition.txt"}, true, 0); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ } - + //Test the patching of an already existing file, the creation of a new one and the deletion of elements in a file public void testWorkspacePatch_Modify(){ - //Note the order that exists in the array of expected results is based purely on the order of the files in the patch + //Note the order that exists in the array of expected results is based purely on the order of the files in the patch patchWorkspace(new String[]{"exp_workspacePatchAddition2.txt","exp_workspacePatchAddition.txt", "addition.txt"}, "patch_workspacePatchMod.txt", new String[] { "exp_workspacePatchMod1.txt","exp_workspacePatchMod2.txt", "exp_workspacePatchMod3.txt"}, false, 0 ); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ } - + //Test applying the reverse of a workspace modify patch public void testWorkspacePatch_Modify_Reverse(){ - //Note the order that exists in the array of expected results is based purely on the order of the files in the patch + //Note the order that exists in the array of expected results is based purely on the order of the files in the patch patchWorkspace(new String[]{ "exp_workspacePatchMod1.txt","exp_workspacePatchMod2.txt", "exp_workspacePatchMod3.txt"}, "patch_workspacePatchMod.txt", new String[] {"exp_workspacePatchAddition2.txt","exp_workspacePatchAddition.txt", "addition.txt"}, true, 0 ); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ } - + //Tests the deletion of an already existing file, and the modification of another file public void testWorkspacePatch_Delete(){ - //Note the order that exists in the array of expected results is based purely on the order of the files in the patch + //Note the order that exists in the array of expected results is based purely on the order of the files in the patch patchWorkspace(new String[]{"exp_workspacePatchMod2.txt","addition.txt", "exp_workspacePatchMod1.txt","addition.txt"}, "patch_workspacePatchDelete.txt", new String[] { "addition.txt","exp_workspacePatchDelete2.txt", "addition.txt", "exp_workspacePatchDelete1.txt"}, false, 0 ); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ } - + //Test applying the reverse of a workspace deletion patch public void testWorkspacePatch_Delete_Reverse(){ - //Note the order that exists in the array of expected results is based purely on the order of the files in the patch + //Note the order that exists in the array of expected results is based purely on the order of the files in the patch patchWorkspace(new String[]{"addition.txt","exp_workspacePatchDelete2.txt", "addition.txt", "exp_workspacePatchDelete1.txt" }, "patch_workspacePatchDelete.txt", new String[] {"exp_workspacePatchMod2.txt","addition.txt", "exp_workspacePatchMod1.txt","addition.txt"}, true, 0 ); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ } - + // Keeps track of the failures private List failures = new ArrayList(); - + public void testPatchdataSubfolders() throws IOException, CoreException { URL patchdataUrl = new URL(PatchUtils.getBundle().getEntry("/"), new Path(PatchUtils.PATCHDATA).toString()); patchdataUrl = FileLocator.resolve(patchdataUrl); - + Map map = null; if (patchdataUrl.getProtocol().equals("file")) { map = extractNamesForFileProtocol(patchdataUrl); } else if (patchdataUrl.getProtocol().equals("jar")) { - map = extractNamesForJarProtocol(patchdataUrl); + map = extractNamesForJarProtocol(patchdataUrl); } else { fail("Unknown protocol"); } assertNotNull(map); - + for (Iterator iterator = map.keySet().iterator(); iterator.hasNext();) { String sf = (String) iterator.next(); // subfolder PatchTestConfiguration ptc = (PatchTestConfiguration) map.get(sf); @@ -229,11 +229,11 @@ public class PatchTest extends TestCase { String[] expectedFiles = ptc.expectedFileNames; String[] actualFiles = ptc.actualFileNames; PatchConfiguration pc = ptc.pc; - + // create a message to distinguish tests from different subfolders String msg = "Test for subfolder [" + PatchUtils.PATCHDATA + "/" + sf + "] failed."; - + try { // test with expected result patchWorkspace(msg, originalFiles, patch, expectedFiles, pc); @@ -254,7 +254,7 @@ public class PatchTest extends TestCase { + PatchUtils.PATCHDATA + "/" + sf + "].")); } } - + if (failures.isEmpty()) return; @@ -270,17 +270,17 @@ public class PatchTest extends TestCase { } throw new AssertionFailedError(sb.toString()); } - + // both copy-pasted from CoreTest - + private void log(String pluginID, IStatus status) { Platform.getLog(Platform.getBundle(pluginID)).log(status); } - + private void log(String pluginID, Throwable e) { log(pluginID, new Status(IStatus.ERROR, pluginID, IStatus.ERROR, "Error", e)); //$NON-NLS-1$ } - + /** * @param patchdataUrl * @return A map with subfolder name as a key and an array of objects as a @@ -295,7 +295,7 @@ public class PatchTest extends TestCase { private Map extractNamesForJarProtocol(URL patchdataUrl) throws IOException, CoreException { JarFile jarFile = ((JarURLConnection) patchdataUrl.openConnection()).getJarFile(); - + // look for the patchdata folder entry String patchdataName = null; Enumeration entries = jarFile.entries(); @@ -310,7 +310,7 @@ public class PatchTest extends TestCase { // patchdata folder not found if (patchdataName == null) return null; - + Map result = new HashMap(); entries = jarFile.entries(); while (entries.hasMoreElements()) { @@ -333,11 +333,11 @@ public class PatchTest extends TestCase { processProperties(result, defaultPatchProperties, entryName); } } - } + } } return result; } - + private Map extractNamesForFileProtocol(URL patchdataUrl) throws CoreException { @@ -356,7 +356,7 @@ public class PatchTest extends TestCase { File subfolder = listOfSubfolders[i]; Path pcPath = new Path(subfolder.getPath() + "/" + PATCH_CONFIGURATION); File pcFile = pcPath.toFile(); - + if (subfolder.getName().equals("CVS")) continue; if (pcFile.exists()) { @@ -387,7 +387,7 @@ public class PatchTest extends TestCase { String arfp = p.getProperty("actualResultFile", null); if (arfp != null) arf = arfp.split(","); - int fuzzFactor = Integer.parseInt(p.getProperty("fuzzFactor", "0")); + int fuzzFactor = Integer.parseInt(p.getProperty("fuzzFactor", "0")); boolean ignoreWhitespace = Boolean.valueOf(p.getProperty("ignoreWhitespace", "false")).booleanValue(); int prefixSegmentStrip = Integer.parseInt(p.getProperty("prefixSegmentStrip", "0")); boolean reversed = Boolean.valueOf(p.getProperty("reversed", "false")).booleanValue(); @@ -432,7 +432,7 @@ public class PatchTest extends TestCase { LineReader lr= new LineReader(PatchUtils.getReader(expt)); List inLines= lr.readLines(); String expected = LineReader.createString(false, inLines); - + IStorage oldStorage = new StringStorage(old); IStorage patchStorage = new StringStorage(patch); IFilePatch[] patches = ApplyPatchOperation.parsePatch(patchStorage); @@ -455,25 +455,25 @@ public class PatchTest extends TestCase { } catch (IOException e) { e.printStackTrace(); } - + FilePatch2[] diffs= patcher.getDiffs(); Assert.assertEquals(diffs.length, 1); - + FileDiffResult diffResult = patcher.getDiffResult(diffs[0]); diffResult.patch(inLines, null); - + LineReader expectedContents= new LineReader(PatchUtils.getReader(expt)); List expectedLines= expectedContents.readLines(); - + Object[] expected= expectedLines.toArray(); Object[] result= inLines.toArray(); - + Assert.assertEquals(expected.length, result.length); - + for (int i= 0; i < expected.length; i++) Assert.assertEquals(expected[i], result[i]); } - + private void patchWorkspace(String[] originalFiles, String patch, String[] expectedOutcomeFiles, boolean reverse, int fuzzFactor) { @@ -485,7 +485,7 @@ public class PatchTest extends TestCase { /** * Parses a workspace patch and applies the diffs to the appropriate files - * + * * @param msg * @param originalFiles * @param patch @@ -496,10 +496,10 @@ public class PatchTest extends TestCase { * should be calculated automatically. */ private void patchWorkspace(String msg, String[] originalFiles, String patch, String[] expectedOutcomeFiles, PatchConfiguration patchConfiguration) { - + //ensure that we have the same number of input files as we have expected files Assert.assertEquals(originalFiles.length, expectedOutcomeFiles.length); - + // Parse the passed in patch and extract all the Diffs WorkspacePatcher patcher = new WorkspacePatcher(); try { @@ -511,22 +511,22 @@ public class PatchTest extends TestCase { } catch (IOException e) { e.printStackTrace(); } - - //Sort the diffs by project + + //Sort the diffs by project FilePatch2[] diffs= patcher.getDiffs(); - + //Iterate through all of the original files, apply the diffs that belong to the file and compare //with the corresponding outcome file - for (int i = 0; i < originalFiles.length; i++) { + for (int i = 0; i < originalFiles.length; i++) { LineReader lr= new LineReader(PatchUtils.getReader(originalFiles[i])); List inLines= lr.readLines(); - + FileDiffResult diffResult = patcher.getDiffResult(diffs[i]); diffResult.patch(inLines, null); - + LineReader expectedContents= new LineReader(PatchUtils.getReader(expectedOutcomeFiles[i])); List expectedLines= expectedContents.readLines(); - + Object[] expected= expectedLines.toArray(); String resultString = LineReader.createString(patcher.isPreserveLineDelimeters(), inLines); @@ -534,10 +534,10 @@ public class PatchTest extends TestCase { Object[] result = resultReader.readLines().toArray(); Assert.assertEquals(msg, expected.length, result.length); - + for (int j= 0; j < expected.length; j++) Assert.assertEquals(msg, expected[j], result[j]); } } - + } diff --git a/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/PatchUITest.java b/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/PatchUITest.java index 669a3350e..7f6625ed1 100644 --- a/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/PatchUITest.java +++ b/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/PatchUITest.java @@ -199,7 +199,7 @@ public class PatchUITest extends TestCase { private void openPatchWizard() { ImageDescriptor patchWizardImage = CompareUIPlugin.getImageDescriptor("wizban/applypatch_wizban.png"); String patchWizardTitle = PatchMessages.PatchWizard_title; - + IStorage patch = null; IResource target = null; CompareConfiguration configuration = new CompareConfiguration(); diff --git a/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/RangeDifferencerThreeWayDiffTest.java b/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/RangeDifferencerThreeWayDiffTest.java index c2fe41d7a..98d6f260b 100644 --- a/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/RangeDifferencerThreeWayDiffTest.java +++ b/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/RangeDifferencerThreeWayDiffTest.java @@ -21,18 +21,18 @@ import org.eclipse.jface.text.Document; public class RangeDifferencerThreeWayDiffTest extends TestCase { - + static final String S= System.getProperty("line.separator"); //$NON-NLS-1$ public RangeDifferencerThreeWayDiffTest(String name) { super(name); } - + public void testInsertConflict() { String a = "A" + S + "B" + S + "C" + S + "D"; //$NON-NLS-1$ String l = "A" + S + "B" + S + "x" + S + "C" + S + "D"; //$NON-NLS-1$ String r = "A" + S + "B" + S + "y" + S + "C" + S + "D"; //$NON-NLS-1$ - + RangeDifference[] diffs= findRange(a, l, r); assertEquals(3, diffs.length); @@ -45,7 +45,7 @@ public class RangeDifferencerThreeWayDiffTest extends TestCase { String a = "A" + S + "B" + S + "C" + S + "D"; //$NON-NLS-1$ String l = "A" + S + "b1" + S + "C" + S + "D"; //$NON-NLS-1$ String r = "A" + S + "b2" + S + "C" + S + "D"; //$NON-NLS-1$ - + RangeDifference[] diffs= findRange(a, l, r); assertEquals(3, diffs.length); @@ -53,38 +53,38 @@ public class RangeDifferencerThreeWayDiffTest extends TestCase { assertEquals(RangeDifference.CONFLICT, diffs[1].kind()); assertEquals(RangeDifference.NOCHANGE, diffs[2].kind()); } - + public void testDeleteAndChangeConflict() { String a = "A" + S + "B" + S + "C"; //$NON-NLS-1$ String l = "A" + S + "C"; //$NON-NLS-1$ String r = "A" + S + "b1" + S + "C"; //$NON-NLS-1$ - + RangeDifference[] diffs= findRange(a, l, r); - + assertEquals(3, diffs.length); assertEquals(RangeDifference.NOCHANGE, diffs[0].kind()); assertEquals(RangeDifference.CONFLICT, diffs[1].kind()); assertEquals(RangeDifference.NOCHANGE, diffs[2].kind()); } - + public void testInsertWithinMultilineChangeConflict() { String a = "A" + S + "B" + S + "C" + S + "D"; //$NON-NLS-1$ String l = "A" + S + "B" + S + "x" + S + "C" + S + "D"; //$NON-NLS-1$ String r = "A" + S + "x" + S + "y" + S + "D"; //$NON-NLS-1$ RangeDifference[] diffs= findRange(a, l, r); - + assertEquals(3, diffs.length); assertEquals(RangeDifference.NOCHANGE, diffs[0].kind()); assertEquals(RangeDifference.CONFLICT, diffs[1].kind()); assertEquals(RangeDifference.NOCHANGE, diffs[2].kind()); } - + public void testAdjoiningChangesNoConflict() { String a = "A" + S + "B" + S + "C" + S + "D"; //$NON-NLS-1$ String l = "A" + S + "b1" + S + "C" + S + "D"; //$NON-NLS-1$ String r = "A" + S + "B" + S + "c1" + S + "D"; //$NON-NLS-1$ - + RangeDifference[] diffs= findRange(a, l, r); assertEquals(4, diffs.length); @@ -98,9 +98,9 @@ public class RangeDifferencerThreeWayDiffTest extends TestCase { String a = "A" + S + "B" + S + "C" + S + "D"; //$NON-NLS-1$ String l = "A" + S + "B" + S + "x" + S + "C" + S + "D"; //$NON-NLS-1$ String r = "A" + S + "B" + S + "c1" + S + "D"; //$NON-NLS-1$ - + RangeDifference[] diffs= findRange(a, l, r); - + assertEquals(4, diffs.length); assertEquals(RangeDifference.NOCHANGE, diffs[0].kind()); assertEquals(RangeDifference.LEFT, diffs[1].kind()); @@ -108,14 +108,14 @@ public class RangeDifferencerThreeWayDiffTest extends TestCase { assertEquals(RangeDifference.NOCHANGE, diffs[3].kind()); } - + public void testAdjoiningMultilineChangeNoConflict() { String a = "A" + S + "B" + S + "C" + S + "D"; //$NON-NLS-1$ String l = "A" + S + "x" + S + "y" + S + "D"; //$NON-NLS-1$ String r = "A" + S + "B" + S + "C" + S + "d1"; //$NON-NLS-1$ RangeDifference[] diffs= findRange(a, l, r); - + assertEquals(3, diffs.length); assertEquals(RangeDifference.NOCHANGE, diffs[0].kind()); assertEquals(RangeDifference.LEFT, diffs[1].kind()); @@ -128,5 +128,5 @@ public class RangeDifferencerThreeWayDiffTest extends TestCase { ITokenComparator right= new DocLineComparator(new Document(r), null, false); return RangeDifferencer.findRanges(new NullProgressMonitor(), ancestor, left, right); } - + } \ No newline at end of file diff --git a/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/TextMergeViewerTest.java b/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/TextMergeViewerTest.java index 4369193bf..7097ae60c 100644 --- a/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/TextMergeViewerTest.java +++ b/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/TextMergeViewerTest.java @@ -83,7 +83,7 @@ public class TextMergeViewerTest extends TestCase { } } } - + public static class TestElement implements ITypedElement { public Image getImage() { return null; @@ -95,7 +95,7 @@ public class TextMergeViewerTest extends TestCase { return UNKNOWN_TYPE; } } - + /** * A parent test element is an {@link IEditableContent} but is not directly editable. * The purpose of the parent is to be able to copy a child into the destination element. @@ -116,10 +116,10 @@ public class TextMergeViewerTest extends TestCase { // Return null as the new child return null; } - + if (other instanceof IStreamContentAccessor && child instanceof IEditableContent) { IEditableContent dst= (IEditableContent) child; - + try { InputStream is= ((IStreamContentAccessor)other).getContents(); byte[] bytes= Utilities.readBytes(is); @@ -135,7 +135,7 @@ public class TextMergeViewerTest extends TestCase { // Node is not directly editable } } - + public static class EditableTestElement extends TestElement implements IStreamContentAccessor, IEditableContent { byte[] contents = new byte[0]; public EditableTestElement(byte[] contents) { @@ -169,9 +169,9 @@ public class TextMergeViewerTest extends TestCase { } public Object getContentsAsString() { return new String(contents); - } + } } - + public static class TestMergeViewer extends TextMergeViewer { public TestMergeViewer(Composite parent) { super(parent, new CompareConfiguration()); @@ -185,7 +185,7 @@ public class TextMergeViewerTest extends TestCase { super.copy(leftToRight); } } - + public static class WrappedException extends RuntimeException { private static final long serialVersionUID = 1L; Exception exception; @@ -197,9 +197,9 @@ public class TextMergeViewerTest extends TestCase { throw exception; } } - + TestMergeViewer viewer; - + public TextMergeViewerTest() { super(); } @@ -207,7 +207,7 @@ public class TextMergeViewerTest extends TestCase { public TextMergeViewerTest(String name) { super(name); } - + private void runInDialog(Object input, Runnable runnable) throws Exception { runInDialog(input, runnable, new CompareConfiguration()); } @@ -233,7 +233,7 @@ public class TextMergeViewerTest extends TestCase { dialog.close(); viewer = null; } - + protected void saveViewerContents() { try { viewer.save(new NullProgressMonitor()); @@ -241,7 +241,7 @@ public class TextMergeViewerTest extends TestCase { throw new WrappedException(e); } } - + protected IDocument getDocument(boolean left) { char leg = left ? MergeViewerContentProvider.LEFT_CONTRIBUTOR : MergeViewerContentProvider.RIGHT_CONTRIBUTOR; IDocument document = Utilities.getDocument(leg, viewer.getInput(), true, true); @@ -250,7 +250,7 @@ public class TextMergeViewerTest extends TestCase { } return document; } - + public void testCopyRightToLeft() throws Exception { DiffNode parentNode = new DiffNode(new ParentTestElement(), new ParentTestElement()); String copiedText = "hi there"; @@ -263,7 +263,7 @@ public class TextMergeViewerTest extends TestCase { }); assertEquals(copiedText, ((EditableTestElement)testNode.getLeft()).getContentsAsString()); } - + public void testCopyLeftToRight() throws Exception { DiffNode parentNode = new DiffNode(new ParentTestElement(), new ParentTestElement()); String copiedText = "hi there"; @@ -276,7 +276,7 @@ public class TextMergeViewerTest extends TestCase { }); assertEquals(copiedText, ((EditableTestElement)testNode.getRight()).getContentsAsString()); } - + public void testCopyRightToEmptyLeft() throws Exception { DiffNode parentNode = new DiffNode(new ParentTestElement(), new ParentTestElement()); DiffNode testNode = new DiffNode(parentNode, Differencer.ADDITION, null, null, new EditableTestElement("hi there".getBytes())); @@ -288,7 +288,7 @@ public class TextMergeViewerTest extends TestCase { }); assertEquals(testNode.getRight(), testNode.getLeft()); } - + public void testCopyLeftToEmptyRight() throws Exception { DiffNode parentNode = new DiffNode(new ParentTestElement(), new ParentTestElement()); DiffNode testNode = new DiffNode(parentNode, Differencer.DELETION, null, new EditableTestElement("hi there".getBytes()), null); @@ -300,7 +300,7 @@ public class TextMergeViewerTest extends TestCase { }); assertEquals(testNode.getRight(), testNode.getLeft()); } - + public void testCopyEmptyLeftToRight() throws Exception { DiffNode parentNode = new DiffNode(new ParentTestElement(), new ParentTestElement()); DiffNode testNode = new DiffNode(parentNode, Differencer.ADDITION, null, null, new EditableTestElement("hi there".getBytes())); @@ -313,7 +313,7 @@ public class TextMergeViewerTest extends TestCase { assertNull(testNode.getLeft()); assertNull(testNode.getRight()); } - + public void testCopyEmptyRightToLeft() throws Exception { DiffNode parentNode = new DiffNode(new ParentTestElement(), new ParentTestElement()); DiffNode testNode = new DiffNode(parentNode, Differencer.DELETION, null, new EditableTestElement("hi there".getBytes()), null); @@ -326,7 +326,7 @@ public class TextMergeViewerTest extends TestCase { assertNull(testNode.getLeft()); assertNull(testNode.getRight()); } - + public void testModifyLeft() throws Exception { DiffNode testNode = new DiffNode(new EditableTestElement("hi there".getBytes()), null); final String newText = "New text"; @@ -339,7 +339,7 @@ public class TextMergeViewerTest extends TestCase { }); assertEquals(newText, ((EditableTestElement)testNode.getLeft()).getContentsAsString()); } - + public void testModifyRight() throws Exception { DiffNode testNode = new DiffNode(null, new EditableTestElement("hi there".getBytes())); final String newText = "New text"; @@ -352,7 +352,7 @@ public class TextMergeViewerTest extends TestCase { }); assertEquals(newText, ((EditableTestElement)testNode.getRight()).getContentsAsString()); } - + public void testCopyEmptyRightToLeftAndModify() throws Exception { DiffNode parentNode = new DiffNode(new ParentTestElement(), new ParentTestElement()); DiffNode testNode = new DiffNode(parentNode, Differencer.ADDITION, null, null, new EditableTestElement("hi there".getBytes())); @@ -367,7 +367,7 @@ public class TextMergeViewerTest extends TestCase { }); assertEquals(newText, ((EditableTestElement)testNode.getLeft()).getContentsAsString()); } - + public void testCopyEmptyLeftToRightAndModify() throws Exception { DiffNode parentNode = new DiffNode(new ParentTestElement(), new ParentTestElement()); DiffNode testNode = new DiffNode(parentNode, Differencer.DELETION, null, new EditableTestElement("hi there".getBytes()), null); @@ -382,7 +382,7 @@ public class TextMergeViewerTest extends TestCase { }); assertEquals(newText, ((EditableTestElement)testNode.getRight()).getContentsAsString()); } - + public void testCompareFilter() throws Exception { DiffNode parentNode = new DiffNode(new ParentTestElement(), new ParentTestElement()); @@ -465,8 +465,8 @@ public class TextMergeViewerTest extends TestCase { } }, cc); } - - + + public void testDocumentAsTypedElement() throws Exception { class DocumentAsTypedElement extends Document implements ITypedElement { @@ -516,7 +516,7 @@ public class TextMergeViewerTest extends TestCase { dialog.close(); viewer = null; } - + //This viewer is used to provide a dummy partitioner public static class TestMergeViewerWithPartitioner extends TestMergeViewer { public class DummyPartitioner implements IDocumentPartitioner { @@ -551,7 +551,7 @@ public class TextMergeViewerTest extends TestCase { public ITypedRegion getPartition(int offset) { return null; } - + } public TestMergeViewerWithPartitioner(Composite parent) { super(parent, new CompareConfiguration()); diff --git a/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/WorkspaceTest.java b/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/WorkspaceTest.java index 4aec38e7d..5e8217b66 100644 --- a/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/WorkspaceTest.java +++ b/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/WorkspaceTest.java @@ -67,12 +67,12 @@ public class WorkspaceTest extends ResourceTest { assertExistsInFileSystem(target); return target; } - + protected IProject getUniqueTestProject(String prefix) throws CoreException { // manage and share with the default stream create by this class return getNamedTestProject(prefix + "-" + Long.toString(System.currentTimeMillis())); } - + /* * This method creates a project with the given resources */ @@ -81,14 +81,14 @@ public class WorkspaceTest extends ResourceTest { buildResources(project, resources, true); return project; } - + /* * Create a test project using the currently running test case as the project name prefix */ protected IProject createProject(String[] resources) throws CoreException { return createProject(getName(), resources); } - + protected IStatus getTeamTestStatus(int severity) { return new Status(severity, "org.eclipse.team.tests.core", 0, "team status", null); } @@ -166,7 +166,7 @@ public class WorkspaceTest extends ResourceTest { } } - + public void sleep(int ms) { try { Thread.sleep(ms); @@ -208,16 +208,16 @@ public class WorkspaceTest extends ResourceTest { } return resources; } - + // Assert that the two containers have equal contents protected void assertEquals(IContainer container1, IContainer container2) throws CoreException { assertEquals(container1.getName(), container2.getName()); List members1 = new ArrayList(); members1.addAll(Arrays.asList(container1.members())); - + List members2 = new ArrayList(); members2.addAll(Arrays.asList(container2.members())); - + assertTrue(members1.size() == members2.size()); for (int i=0;i -1); diff --git a/tests/org.eclipse.core.tests.net/src/org/eclipse/core/tests/net/SystemProxyTest.java b/tests/org.eclipse.core.tests.net/src/org/eclipse/core/tests/net/SystemProxyTest.java index fed53d922..cc659671d 100644 --- a/tests/org.eclipse.core.tests.net/src/org/eclipse/core/tests/net/SystemProxyTest.java +++ b/tests/org.eclipse.core.tests.net/src/org/eclipse/core/tests/net/SystemProxyTest.java @@ -197,7 +197,7 @@ public class SystemProxyTest extends TestCase { * {@link #initializeTestProxyData()} for values. Additionally set * "eclipse.*;nonexisting.com;*.eclipse.org;www.*.com;*.test.*" * as proxy bypass in the IE settings. - * + * * @throws URISyntaxException */ public void testNonProxiedHosts_WindowsIEManualSettings() @@ -213,15 +213,15 @@ public class SystemProxyTest extends TestCase { proxiesData = getProxyManager().select( new URI("http://nonexisting.com")); assertEquals(0, proxiesData.length); - + proxiesData = getProxyManager().select( new URI("http://www.eclipse.org")); assertEquals(0, proxiesData.length); - + proxiesData = getProxyManager().select( new URI("http://www.myDomain.com")); assertEquals(0, proxiesData.length); - + proxiesData = getProxyManager().select( new URI("http://www.test.edu")); assertEquals(0, proxiesData.length); diff --git a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/RepositoryProviderBic.java b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/RepositoryProviderBic.java index eefcb1cb1..52e235699 100644 --- a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/RepositoryProviderBic.java +++ b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/RepositoryProviderBic.java @@ -16,12 +16,12 @@ import org.eclipse.core.runtime.CoreException; import org.eclipse.team.core.RepositoryProvider; public class RepositoryProviderBic extends RepositoryProvider { - + final public static String NATURE_ID = "org.eclipse.team.tests.core.bic-provider"; - + private IMoveDeleteHook mdh; private IFileModificationValidator mv; - + /* * @see RepositoryProvider#configureProject() */ @@ -39,7 +39,7 @@ public class RepositoryProviderBic extends RepositoryProvider { */ public void deconfigure() throws CoreException { } - + /* * @see RepositoryProvider#getFileModificationValidator() */ @@ -53,11 +53,11 @@ public class RepositoryProviderBic extends RepositoryProvider { public IMoveDeleteHook getMoveDeleteHook() { return mdh; } - + public void setModificationValidator(IFileModificationValidator mv) { this.mv = mv; } - + public void setMoveDeleteHook(IMoveDeleteHook mdh) { this.mdh = mdh; } diff --git a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/RepositoryProviderNaish.java b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/RepositoryProviderNaish.java index 768d63c6d..342908a10 100644 --- a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/RepositoryProviderNaish.java +++ b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/RepositoryProviderNaish.java @@ -16,7 +16,7 @@ import org.eclipse.core.runtime.CoreException; import org.eclipse.team.core.RepositoryProvider; public class RepositoryProviderNaish extends RepositoryProvider { - + final public static String NATURE_ID = "org.eclipse.team.tests.core.naish-provider"; private IMoveDeleteHook mdh; private IFileModificationValidator mv; @@ -37,11 +37,11 @@ public class RepositoryProviderNaish extends RepositoryProvider { */ public void deconfigure() throws CoreException { } - + public void setModificationValidator(IFileModificationValidator mv) { this.mv = mv; } - + public void setMoveDeleteHook(IMoveDeleteHook mdh) { this.mdh = mdh; } diff --git a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/RepositoryProviderOtherSport.java b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/RepositoryProviderOtherSport.java index 19ff71428..1e5860da7 100644 --- a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/RepositoryProviderOtherSport.java +++ b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/RepositoryProviderOtherSport.java @@ -14,7 +14,7 @@ import org.eclipse.core.runtime.CoreException; import org.eclipse.team.core.RepositoryProvider; public class RepositoryProviderOtherSport extends RepositoryProvider { - + final public static String NATURE_ID = "org.eclipse.team.tests.core.other"; /* diff --git a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/RepositoryProviderTests.java b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/RepositoryProviderTests.java index da06920b2..9d0491ac7 100644 --- a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/RepositoryProviderTests.java +++ b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/RepositoryProviderTests.java @@ -44,28 +44,28 @@ public class RepositoryProviderTests extends TeamTest { public RepositoryProviderTests() { super(); } - + public RepositoryProviderTests(String name) { super(name); } - + public static Test suite() { TestSuite suite = new TestSuite(RepositoryProviderTests.class); return new TestSetup(suite); //return new testSetup(new RepositoryProviderTests("test")); } - + public void testProvidersRegistered() throws CoreException, TeamException { List repoProviderIds = new ArrayList(Arrays.asList(RepositoryProvider.getAllProviderTypeIds())); assertEquals(true, repoProviderIds.contains(RepositoryProviderBic.NATURE_ID)); assertEquals(true, repoProviderIds.contains(RepositoryProviderNaish.NATURE_ID)); assertEquals(false, repoProviderIds.contains(RepositoryProviderOtherSport.NATURE_ID)); } - + public void testGetProviderGeneric() throws CoreException, TeamException { IProject project = getUniqueTestProject("testGetProviderGeneric1"); IProject project2 = getUniqueTestProject("testGetProviderGeneric2"); - + // test that adding a non registered provider doesn't work boolean good = false; try { @@ -74,7 +74,7 @@ public class RepositoryProviderTests extends TeamTest { good = true; } Assert.assertTrue(good); - + // adding a valid team provider should be fine RepositoryProvider.map(project, RepositoryProviderNaish.NATURE_ID); RepositoryProvider.map(project2, RepositoryProviderNaish.NATURE_ID); @@ -83,58 +83,58 @@ public class RepositoryProviderTests extends TeamTest { Assert.assertTrue(provider1 != null && provider1.getID().equals(RepositoryProviderNaish.NATURE_ID)); Assert.assertTrue(provider2 != null && provider2.getID().equals(RepositoryProviderNaish.NATURE_ID)); Assert.assertTrue(provider1.getProject().equals(project) && provider2.getProject().equals(project2)); - + // remapping a provider is allowed - RepositoryProvider.map(project, RepositoryProviderBic.NATURE_ID); + RepositoryProvider.map(project, RepositoryProviderBic.NATURE_ID); provider1 = RepositoryProvider.getProvider(project); Assert.assertTrue(provider1 != null && provider1.getID().equals(RepositoryProviderBic.NATURE_ID)); - + // closed or non-existant projects cannot be associated with a provider IProject closedProject = getUniqueTestProject("testGetProviderGenericClosed"); IProject nonExistantProject = ResourcesPlugin.getWorkspace().getRoot().getProject("nonExistant"); closedProject.close(null); Assert.assertTrue(RepositoryProvider.getProvider(closedProject) == null); Assert.assertTrue(RepositoryProvider.getProvider(nonExistantProject) == null); - + // removing the nature removes the provider association RepositoryProvider.unmap(project); RepositoryProvider.unmap(project2); Assert.assertTrue(RepositoryProvider.getProvider(project) == null); Assert.assertTrue(RepositoryProvider.getProvider(project2) == null); } - + public void testGetProviderById() throws CoreException, TeamException { IProject project1 = getUniqueTestProject("testGetProviderById_1"); IProject project2 = getUniqueTestProject("testGetProviderById_2"); - + // adding a valid team provider should be fine RepositoryProvider.map(project1, RepositoryProviderBic.NATURE_ID); RepositoryProvider.map(project2, RepositoryProviderNaish.NATURE_ID); Assert.assertTrue(RepositoryProvider.getProvider(project1, RepositoryProviderBic.NATURE_ID) != null); Assert.assertTrue(RepositoryProvider.getProvider(project2, RepositoryProviderNaish.NATURE_ID) != null); - + // closed or non-existant projects cannot be associated with a provider IProject closedProject = getUniqueTestProject("testGetProviderGenericClosed"); IProject nonExistantProject = ResourcesPlugin.getWorkspace().getRoot().getProject("nonExistant"); closedProject.close(null); Assert.assertTrue(RepositoryProvider.getProvider(closedProject, "id") == null); Assert.assertTrue(RepositoryProvider.getProvider(nonExistantProject, "id") == null); - + // removing the nature removes the provider association RepositoryProvider.unmap(project1); RepositoryProvider.unmap(project2); Assert.assertTrue(RepositoryProvider.getProvider(project1, RepositoryProviderBic.NATURE_ID) == null); Assert.assertTrue(RepositoryProvider.getProvider(project2, RepositoryProviderNaish.NATURE_ID) == null); } - + public void testFileModificationValidator() throws CoreException, TeamException { IProject project = getUniqueTestProject("testFileModificationValidator"); - + // adding a valid team provider should be fine RepositoryProvider.map(project, RepositoryProviderBic.NATURE_ID); RepositoryProviderBic bicProvider = (RepositoryProviderBic)RepositoryProvider.getProvider(project, RepositoryProviderBic.NATURE_ID); Assert.assertTrue(bicProvider != null); - + // test that validator gets called by team core dispatching final boolean[] called = new boolean[] {false}; bicProvider.setModificationValidator(new FileModificationValidator() { @@ -151,7 +151,7 @@ public class RepositoryProviderTests extends TeamTest { file.create(new ByteArrayInputStream("test".getBytes()), true, null); file.setContents(new ByteArrayInputStream("test2".getBytes()), true, false, null); Assert.assertTrue(called[0] == true); - + // test that validator can veto a setContents called[0] = false; bicProvider.setModificationValidator(new FileModificationValidator() { @@ -170,20 +170,20 @@ public class RepositoryProviderTests extends TeamTest { } catch(CoreException e) { Assert.assertTrue(called[0] == true); } - + // test that default validator allows the modification bicProvider.setModificationValidator(null); - file.setContents(new ByteArrayInputStream("test4".getBytes()), true, false, null); + file.setContents(new ByteArrayInputStream("test4".getBytes()), true, false, null); } - + public void testMoveDeleteHook() throws CoreException, TeamException { final IProject project = getUniqueTestProject("testMoveDeleteHook"); - + // adding a valid team provider should be fine RepositoryProvider.map(project, RepositoryProviderBic.NATURE_ID); RepositoryProviderBic bicProvider = (RepositoryProviderBic)RepositoryProvider.getProvider(project, RepositoryProviderBic.NATURE_ID); Assert.assertTrue(bicProvider != null); - + // only testing that dispatching works, resources plugin is testing the rest of the API final boolean[] called = new boolean[] {false, false, false, false, false, false}; IMoveDeleteHook hook = new IMoveDeleteHook() { @@ -213,7 +213,7 @@ public class RepositoryProviderTests extends TeamTest { } }; bicProvider.setMoveDeleteHook(hook); - + IResource[] resources = buildResources(project, new String[] {"deleteFile.txt", "moveFile.txt", "deletedFolder/", "moveFolder/"}); ensureExistsInWorkspace(resources, true); resources[0].delete(false, null); @@ -232,19 +232,19 @@ public class RepositoryProviderTests extends TeamTest { Assert.assertTrue(called[i]); } } - + public void testMoveDeleteHookBetweenProjects() throws CoreException, TeamException { final IProject projectA = getUniqueTestProject("testMoveDeleteHookBetweenProjects_A"); final IProject projectB = getUniqueTestProject("testMoveDeleteHookBetweenProjects_B"); final IProject projectC = getUniqueTestProject("testMoveDeleteHookBetweenProjects_C"); - + // adding a valid team provider should be fine RepositoryProvider.map(projectA, RepositoryProviderBic.NATURE_ID); final RepositoryProviderBic bicProvider = (RepositoryProviderBic)RepositoryProvider.getProvider(projectA, RepositoryProviderBic.NATURE_ID); RepositoryProvider.map(projectB, RepositoryProviderNaish.NATURE_ID); final RepositoryProviderNaish naishProvider = (RepositoryProviderNaish)RepositoryProvider.getProvider(projectB, RepositoryProviderNaish.NATURE_ID); Assert.assertTrue(bicProvider != null && naishProvider != null); - + // only testing that dispatching works, resources plugin is testing the rest of the API final boolean[] calledProjectA = new boolean[] {false, false}; bicProvider.setMoveDeleteHook(new IMoveDeleteHook() { @@ -254,7 +254,7 @@ public class RepositoryProviderTests extends TeamTest { public boolean deleteFolder(IResourceTree tree, IFolder folder, int updateFlags, IProgressMonitor monitor) { return false; } - public boolean deleteProject(IResourceTree tree, IProject project, int updateFlags, IProgressMonitor monitor) { + public boolean deleteProject(IResourceTree tree, IProject project, int updateFlags, IProgressMonitor monitor) { return false; } public boolean moveFile(IResourceTree tree, IFile source, IFile destination, int updateFlags, IProgressMonitor monitor) { @@ -271,7 +271,7 @@ public class RepositoryProviderTests extends TeamTest { return false; } }); - + final boolean[] calledProjectB = new boolean[] {false, false}; naishProvider.setMoveDeleteHook(new IMoveDeleteHook() { public boolean deleteFile(IResourceTree tree, IFile file, int updateFlags, IProgressMonitor monitor) { @@ -280,7 +280,7 @@ public class RepositoryProviderTests extends TeamTest { public boolean deleteFolder(IResourceTree tree, IFolder folder, int updateFlags, IProgressMonitor monitor) { return false; } - public boolean deleteProject(IResourceTree tree, IProject project, int updateFlags, IProgressMonitor monitor) { + public boolean deleteProject(IResourceTree tree, IProject project, int updateFlags, IProgressMonitor monitor) { return false; } public boolean moveFile(IResourceTree tree, IFile source, IFile destination, int updateFlags, IProgressMonitor monitor) { @@ -297,7 +297,7 @@ public class RepositoryProviderTests extends TeamTest { return false; } }); - + // test that moving files/folders between two projects with providers calls the destination IResource[] resources = buildResources(projectA, new String[] {"moveFile.txt", "moveFolder/"}); ensureExistsInWorkspace(resources, true); @@ -306,7 +306,7 @@ public class RepositoryProviderTests extends TeamTest { for (int i = 0; i < calledProjectA.length; i++) { Assert.assertTrue(calledProjectA[i] && calledProjectB[i] == false); } - + // test that moving files/folders from a project with a provider to a project without a provider calls the // hooks for the source calledProjectA[0] = false; calledProjectA[1] = false; @@ -319,18 +319,18 @@ public class RepositoryProviderTests extends TeamTest { Assert.assertTrue(calledProjectA[i] && calledProjectB[i] == false); } } - + public void testMapSuccess() throws CoreException, TeamException { IProject project = getUniqueTestProject("testLinkSuccess"); buildResources(project, new String[] { "changed.txt", "deleted.txt", "folder1/", "folder1/a.txt" }, true); - + // Test shallow link when URI not allowed IFolder folder = project.getFolder("link"); folder.createLink(getRandomLocation(), IResource.ALLOW_MISSING_LOCAL, null); RepositoryProviderWithLinking.setCanHandleLinking(true); RepositoryProviderWithLinking.setCanHandleLinkedURI(false); RepositoryProvider.map(project, RepositoryProviderWithLinking.TYPE_ID); - + // Test shallow link when URI is allowed RepositoryProvider.unmap(project); folder.delete(false, null); @@ -339,7 +339,7 @@ public class RepositoryProviderTests extends TeamTest { RepositoryProviderWithLinking.setCanHandleLinking(true); RepositoryProviderWithLinking.setCanHandleLinkedURI(true); RepositoryProvider.map(project, RepositoryProviderWithLinking.TYPE_ID); - + // Test deep link when URI is allowed RepositoryProvider.unmap(project); folder.delete(false, null); @@ -349,7 +349,7 @@ public class RepositoryProviderTests extends TeamTest { RepositoryProviderWithLinking.setCanHandleLinkedURI(true); RepositoryProvider.map(project, RepositoryProviderWithLinking.TYPE_ID); } - + public void testLinkSuccess() throws CoreException, TeamException { IProject project = getUniqueTestProject("testLinkSuccess"); buildResources(project, new String[] { "changed.txt", "deleted.txt", "folder1/", "folder1/a.txt" }, true); @@ -404,7 +404,7 @@ public class RepositoryProviderTests extends TeamTest { } if (fail) fail("Link should be disallowed"); - + // Test deep failure when shallow is allowed folder.delete(false, null); RepositoryProviderWithLinking.setCanHandleLinking(true); @@ -422,7 +422,7 @@ public class RepositoryProviderTests extends TeamTest { if (fail) fail("Link should be disallowed"); } - + public void testLinkFailure() throws CoreException, TeamException { IProject project = getUniqueTestProject("testLinkFailure"); @@ -456,7 +456,7 @@ public class RepositoryProviderTests extends TeamTest { } if (fail) fail("Link should be disallowed"); - + // Test deep link when shallow allowed RepositoryProviderWithLinking.setCanHandleLinking(true); folder = project.getFolder("folder1/folder2"); @@ -472,7 +472,7 @@ public class RepositoryProviderTests extends TeamTest { if (fail) fail("Link should be disallowed"); } - + public void testIsShared() throws CoreException, TeamException { IProject project1 = getUniqueTestProject("testGetProviderById_1"); RepositoryProvider.map(project1, RepositoryProviderBic.NATURE_ID); @@ -484,5 +484,5 @@ public class RepositoryProviderTests extends TeamTest { RepositoryProvider.unmap(project1); Assert.assertTrue(!RepositoryProvider.isShared(project1)); } - + } diff --git a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/RepositoryProviderWithLinking.java b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/RepositoryProviderWithLinking.java index 8038d5b7b..0cf9e00b2 100644 --- a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/RepositoryProviderWithLinking.java +++ b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/RepositoryProviderWithLinking.java @@ -17,13 +17,13 @@ import org.eclipse.team.core.RepositoryProvider; * This class is used to text resource linking */ public class RepositoryProviderWithLinking extends RepositoryProvider { - + final public static String TYPE_ID = "org.eclipse.team.tests.core.linking"; - + private static boolean canHandleLinking = false; private static boolean canHandleLinkedURI; - + /** * @see org.eclipse.team.core.RepositoryProvider#configureProject() */ @@ -51,11 +51,11 @@ public class RepositoryProviderWithLinking extends RepositoryProvider { public boolean canHandleLinkedResources() { return canHandleLinking; } - + public static void setCanHandleLinkedURI(boolean canHandleLinkedURI) { RepositoryProviderWithLinking.canHandleLinkedURI = canHandleLinkedURI; } - + /* (non-Javadoc) * @see org.eclipse.team.core.RepositoryProvider#canHandleLinkedResourceURI() */ diff --git a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/StorageMergerTests.java b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/StorageMergerTests.java index a45bbf41c..26ed691d6 100644 --- a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/StorageMergerTests.java +++ b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/StorageMergerTests.java @@ -21,20 +21,20 @@ public class StorageMergerTests extends TeamTest { public StorageMergerTests() { super(); } - + public StorageMergerTests(String name) { super(name); } - + public static Test suite() { return suite(StorageMergerTests.class); } - + public void testGetByExtension() { IStorageMerger merger = new Team().createStorageMerger("blah"); assertNotNull("Merger for extension is missing", merger); } - + public void testGetByContentType() { IStorageMerger merger = new Team().createStorageMerger(Platform.getContentTypeManager().getContentType("org.eclipse.team.tests.core.content-type1")); assertNotNull("Merger for extension is missing", merger); diff --git a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/StreamTests.java b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/StreamTests.java index 3dbe2b749..1a7d42b65 100644 --- a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/StreamTests.java +++ b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/StreamTests.java @@ -60,7 +60,7 @@ public class StreamTests extends TestCase { testLFtoCRLFTranslation("The \r\n quick brown \n fox \r\n\n\r\r\n jumped \n\n over \r\n the \n lazy dog.\r\n", "The \r\r\n quick brown \r\n fox \r\r\n\r\n\r\r\r\n jumped \r\n\r\n over \r\r\n the \r\n lazy dog.\r\r\n"); } - + private void testLFtoCRLFTranslation(String pre, String post) throws IOException { ByteArrayInputStream bin = new ByteArrayInputStream(pre.getBytes()); InputStream in = new LFtoCRLFInputStream(bin); diff --git a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/TestStorageMerger.java b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/TestStorageMerger.java index 6a1a1cd91..4ea59fa5f 100644 --- a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/TestStorageMerger.java +++ b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/TestStorageMerger.java @@ -17,7 +17,7 @@ import org.eclipse.core.runtime.*; import org.eclipse.team.core.mapping.IStorageMerger; public class TestStorageMerger implements IStorageMerger { - + public static final String MERGE_FAILURE = "merge failed"; public boolean canMergeWithoutAncestor() { diff --git a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/mapping/ScopeBuildingTests.java b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/mapping/ScopeBuildingTests.java index c4ad7f68f..a880c04fd 100644 --- a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/mapping/ScopeBuildingTests.java +++ b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/mapping/ScopeBuildingTests.java @@ -32,7 +32,7 @@ public class ScopeBuildingTests extends TeamTest { private class TestResourceMappingOperation extends ModelOperation { protected TestResourceMappingOperation(ResourceMapping[] selectedMappings, final ResourceMapping[] additionalMappings) { - super(null, new SynchronizationScopeManager("", selectedMappings, ResourceMappingContext.LOCAL_CONTEXT, false) { + super(null, new SynchronizationScopeManager("", selectedMappings, ResourceMappingContext.LOCAL_CONTEXT, false) { public void initialize( IProgressMonitor monitor) throws CoreException { super.initialize(monitor); @@ -57,11 +57,11 @@ public class ScopeBuildingTests extends TeamTest { // Do nothing since we're just testing the scope build } } - + public static Test suite() { return suite(ScopeBuildingTests.class); } - + public ScopeBuildingTests() { super(); } @@ -69,7 +69,7 @@ public class ScopeBuildingTests extends TeamTest { public ScopeBuildingTests(String name) { super(name); } - + private void expectPrompt(TestResourceMappingOperation op) { try { op.run(new NullProgressMonitor()); @@ -84,39 +84,39 @@ public class ScopeBuildingTests extends TeamTest { } fail("Expected prompt did not occur"); } - + private ResourceMapping getMapping(final IProject project, final IResource[] resources, final int depth) { return new ResourceMapping() { - + public ResourceTraversal[] getTraversals(ResourceMappingContext context, IProgressMonitor monitor) throws CoreException { return new ResourceTraversal[] { new ResourceTraversal(resources, depth, IResource.NONE)}; } - + public IProject[] getProjects() { return new IProject[] { project }; } - + public Object getModelObject() { return new Object(); } - + public String getModelProviderId() { return TEST_MODEL_PROVIDER_ID; } public boolean contains(ResourceMapping mapping) { return false; } - + }; } - + public void testAdditionalResources() throws CoreException { IProject project = createProject(new String[]{"file.txt", "folder1/file2.txt", "folder1/folder2/file3.txt", "folder3/"}); - ResourceMapping[] mappings = new ResourceMapping[] { + ResourceMapping[] mappings = new ResourceMapping[] { getMapping(project, new IResource[] { project.getFolder("folder1") }, IResource.DEPTH_INFINITE) }; - ResourceMapping[] additionalMappings = new ResourceMapping[] { + ResourceMapping[] additionalMappings = new ResourceMapping[] { getMapping(project, new IResource[] { project.getFile("file.txt")}, IResource.DEPTH_INFINITE) }; TestResourceMappingOperation op = new TestResourceMappingOperation(mappings, additionalMappings); diff --git a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/mapping/ScopeTestSubscriber.java b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/mapping/ScopeTestSubscriber.java index 04fd888e7..294778460 100644 --- a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/mapping/ScopeTestSubscriber.java +++ b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/mapping/ScopeTestSubscriber.java @@ -36,7 +36,7 @@ public class ScopeTestSubscriber extends Subscriber { public boolean compare(IResource local, IResourceVariant remote) { return false; } - + }; } diff --git a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/mapping/ScopeTests.java b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/mapping/ScopeTests.java index 9e53219ea..f5d642b32 100644 --- a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/mapping/ScopeTests.java +++ b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/mapping/ScopeTests.java @@ -30,7 +30,7 @@ public class ScopeTests extends TeamTest { private IProject project1, project2, project3; private IWorkingSet workingSet; private SubscriberScopeManager manager; - + public ScopeTests() { super(); } @@ -38,7 +38,7 @@ public class ScopeTests extends TeamTest { public ScopeTests(String name) { super(name); } - + protected void setUp() throws Exception { super.setUp(); project1 = createProject("p1", new String[]{"file.txt"}); @@ -48,7 +48,7 @@ public class ScopeTests extends TeamTest { workingSet = manager.createWorkingSet("TestWS", new IProject[] { project1 }); manager.addWorkingSet(workingSet); } - + protected void tearDown() throws Exception { super.tearDown(); this.manager.dispose(); @@ -57,7 +57,7 @@ public class ScopeTests extends TeamTest { IWorkingSetManager manager = PlatformUI.getWorkbench().getWorkingSetManager(); manager.removeWorkingSet(workingSet); } - + private void assertProperContainment(ISynchronizationScopeManager sm) throws OperationCanceledException, InterruptedException { waitForManager(sm); testProjectContainment(sm, project1); @@ -97,7 +97,7 @@ public class ScopeTests extends TeamTest { waitForManager(manager); return manager; } - + public void testScopeExpansion() throws CoreException, OperationCanceledException, InterruptedException { ISynchronizationScopeManager sm = createScopeManager(); assertProperContainment(sm); diff --git a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/regression/Bug_217673.java b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/regression/Bug_217673.java index 82a66e173..0a5fdc88f 100644 --- a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/regression/Bug_217673.java +++ b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/regression/Bug_217673.java @@ -4,7 +4,7 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ diff --git a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/regression/DoNotRemoveTest.java b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/regression/DoNotRemoveTest.java index 58b61a2c1..8d0cc763a 100644 --- a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/regression/DoNotRemoveTest.java +++ b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/regression/DoNotRemoveTest.java @@ -4,7 +4,7 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ diff --git a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/regression/PessimisticRepositoryProvider.java b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/regression/PessimisticRepositoryProvider.java index e65f5dab1..85e1dd770 100644 --- a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/regression/PessimisticRepositoryProvider.java +++ b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/regression/PessimisticRepositoryProvider.java @@ -27,16 +27,16 @@ import org.eclipse.team.core.RepositoryProvider; */ public class PessimisticRepositoryProvider extends RepositoryProvider implements IFileModificationValidator { private static PessimisticRepositoryProvider soleInstance; - + public static final String NATURE_ID = "org.eclipse.team.tests.core.regression.pessimistic-provider"; - + public static boolean markWritableOnEdit; public static boolean markWritableOnSave; public PessimisticRepositoryProvider() { soleInstance = this; } - + public void configureProject() { } @@ -55,7 +55,7 @@ public class PessimisticRepositoryProvider extends RepositoryProvider implements public IFileModificationValidator getFileModificationValidator() { return soleInstance; } - + public IStatus validateEdit(final IFile[] files, Object context) { if (markWritableOnEdit) { try { @@ -76,7 +76,7 @@ public class PessimisticRepositoryProvider extends RepositoryProvider implements e.printStackTrace(); return e.getStatus(); } - } + } return Status.OK_STATUS; } @@ -97,7 +97,7 @@ public class PessimisticRepositoryProvider extends RepositoryProvider implements if (resourceAttributes != null) { resourceAttributes.setReadOnly(readOnly); resource.setResourceAttributes(resourceAttributes); - } + } } public boolean isReadOnly(IResource resource) throws CoreException { diff --git a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/SaveableCompareEditorInputTest.java b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/SaveableCompareEditorInputTest.java index 7591d873a..60aad58dd 100644 --- a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/SaveableCompareEditorInputTest.java +++ b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/SaveableCompareEditorInputTest.java @@ -56,7 +56,7 @@ public class SaveableCompareEditorInputTest extends TeamTest { private static final String COMPARE_EDITOR = CompareUIPlugin.PLUGIN_ID + ".CompareEditor"; //$NON-NLS-1$ - + private IFile file1; private IFile file2; private String appendFileContents = "_append"; @@ -334,7 +334,7 @@ public class SaveableCompareEditorInputTest extends TeamTest { * handled, see javadoc to SaveableCompareEditorInput. */ } - + private void verifyModifyAndSaveBothSidesOfCompareEditor(String extention) throws InterruptedException, InvocationTargetException, IllegalArgumentException, SecurityException, diff --git a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/synchronize/ResourceContentTests.java b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/synchronize/ResourceContentTests.java index 360d989b3..fd9a8b26a 100644 --- a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/synchronize/ResourceContentTests.java +++ b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/synchronize/ResourceContentTests.java @@ -32,7 +32,7 @@ import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration; public class ResourceContentTests extends TeamTest { public static class TestableResourceModelContentProvider extends ResourceModelContentProvider { - + private final ISynchronizationScope scope; private final ISynchronizationContext context; private final ISynchronizePageConfiguration configuration; @@ -55,13 +55,13 @@ public class ResourceContentTests extends TeamTest { return scope; } } - + public static Test suite() { return suite(ResourceContentTests.class); } private ResourceModelContentProvider provider; - + public ResourceContentTests() { super(); } @@ -69,12 +69,12 @@ public class ResourceContentTests extends TeamTest { public ResourceContentTests(String name) { super(name); } - + protected void setUp() throws Exception { initializeProvider(null, null, null); super.setUp(); } - + protected void tearDown() throws Exception { cleanupProvider(); super.tearDown(); @@ -84,17 +84,17 @@ public class ResourceContentTests extends TeamTest { cleanupProvider(); provider = new TestableResourceModelContentProvider(scope, context, configuration); } - + private void cleanupProvider() { if (provider != null) provider.dispose(); provider = null; } - + private void assertContentMatches(IProject project, String[] leaves) { assertContentsMatch(asResources(project, leaves)); } - + private void assertContentsMatch(IResource[] resources) { Set paths = getPaths(ResourcesPlugin.getWorkspace().getRoot()); Set resourceSet = new HashSet(); @@ -129,9 +129,9 @@ public class ResourceContentTests extends TeamTest { } return result; } - + private Set getPaths(ResourceModelContentProvider provider, TreePath path) { - Object[] children = provider.getChildren(path); + Object[] children = provider.getChildren(path); Set result = new HashSet(); if (children.length == 0) result.add(path); @@ -186,11 +186,11 @@ public class ResourceContentTests extends TeamTest { files = new String[] {".project", "file.txt", "file2.txt", "folder1/file3.txt", "folder1/folder2/file4.txt"}; assertContentMatches(project, files); } - + public void testFileChange() throws CoreException { // String[] files = new String[] {"file.txt", "file2.txt", "folder1/file3.txt", "folder1/folder2/file4.txt"}; // IProject project = createProject(files); - + } -- cgit v1.2.3