Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Valenta2002-05-28 14:09:09 +0000
committerMichael Valenta2002-05-28 14:09:09 +0000
commitdda8b55c1331f061e335c61f6a747cceef7fc55d (patch)
treea1c0dd88c500c8df904c582e51a6e54cf1fd50d9 /tests/org.eclipse.team.tests.core
parent6ea06c81fe02f61c10313f7d69aaadb507b81699 (diff)
downloadeclipse.platform.team-dda8b55c1331f061e335c61f6a747cceef7fc55d.tar.gz
eclipse.platform.team-dda8b55c1331f061e335c61f6a747cceef7fc55d.tar.xz
eclipse.platform.team-dda8b55c1331f061e335c61f6a747cceef7fc55d.zip
*** empty log message ***
Diffstat (limited to 'tests/org.eclipse.team.tests.core')
-rw-r--r--tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/SyncElementTest.java12
-rw-r--r--tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/TargetProviderTests.java21
-rw-r--r--tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/TeamTest.java51
3 files changed, 67 insertions, 17 deletions
diff --git a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/SyncElementTest.java b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/SyncElementTest.java
index 5c5026620..5cc95fbd5 100644
--- a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/SyncElementTest.java
+++ b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/SyncElementTest.java
@@ -355,18 +355,6 @@ public class SyncElementTest extends TeamTest {
IRemoteSyncElement.CONFLICTING | IRemoteSyncElement.CHANGE,
IRemoteSyncElement.OUTGOING | IRemoteSyncElement.ADDITION });
- // Release the conflict cases (MERGE is not required for add3.txt but we do it anyway to ensure it doesn't cause problems)
-
- tree = getRemoteSyncTree(project, DEFAULT_MONITOR);
- assertSyncEquals(
- "testAdditionConflicts",
- tree,
- new String[] { "file.txt", "add1b.txt", "add2b.txt", "add3.txt" },
- new int[] {
- IRemoteSyncElement.IN_SYNC,
- IRemoteSyncElement.OUTGOING | IRemoteSyncElement.CHANGE,
- IRemoteSyncElement.OUTGOING | IRemoteSyncElement.CHANGE,
- IRemoteSyncElement.OUTGOING | IRemoteSyncElement.ADDITION });
getProvider(project).put(
new IResource[] { project.getFile("add1b.txt"), project.getFile("add2b.txt"), project.getFile("add3.txt")},
DEFAULT_MONITOR);
diff --git a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/TargetProviderTests.java b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/TargetProviderTests.java
index e8d7544fa..46840a73e 100644
--- a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/TargetProviderTests.java
+++ b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/TargetProviderTests.java
@@ -199,22 +199,33 @@ public class TargetProviderTests extends TeamTest {
IProject project = getUniqueTestProject("put");
IResource[] resources = buildEmptyResources(project, new String[] { "file1.txt", "folder1/", "folder1/b.txt" }, false);
TargetProvider target = createProvider(project);
+ target.put(resources, null);
for (int i = 0; i < resources.length; i++) {
resources[i].delete(true, null);
}
try {
target.put(resources, null);
- fail("Shouldn't be able to put files that don't exist locally.");
- } catch (TeamException e) {} catch (RuntimeException e) {}
+ for (int i = 0; i < resources.length; i++) {
+ assertTrue(!target.getRemoteResourceFor(resources[i]).exists(null));
+ }
+ } catch (TeamException e) {} catch (RuntimeException e) {
+ fail("Putting files that don't exist locally should delete them remotely");
+ }
}
public void testGetWithPhantoms() throws CoreException, TeamException {
IProject project = getUniqueTestProject("get");
- IResource[] resources = buildEmptyResources(project, new String[] { "file1.txt", "folder1/", "folder1/b.txt" }, false);
+ String[] testFileNames=new String[] { "file1.txt", "folder1/", "folder1/b.txt" };
+ IResource[] resources = buildResources(project, testFileNames, false);
TargetProvider target = createProvider(project);
try {
target.get(new IResource[] { project }, null);
- fail("Shouldn't be able to get files that don't exist");
- } catch (TeamException e) {}
+ IResource[] phantoms=getResources(project,testFileNames);
+ for (int i = 0; i < phantoms.length; i++) {
+ assertTrue(!project.getFile(testFileNames[i]).exists());
+ }
+ } catch (TeamException e) {
+ fail("Getting files that don't exist remotely should delete them locally");
+ }
}
/**
* @see TestCase#setUp()
diff --git a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/TeamTest.java b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/TeamTest.java
index 224d7de4a..bb208de9d 100644
--- a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/TeamTest.java
+++ b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/TeamTest.java
@@ -238,4 +238,55 @@ public class TeamTest extends EclipseWorkspaceTest {
}
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<members1.size();i++) {
+ IResource member1 = (IResource)members1.get(i);
+ IResource member2 = container2.findMember(member1.getName());
+ assertNotNull(member2);
+ assertEquals(member1, member2);
+ }
+ }
+
+ // Assert that the two files have equal contents
+ protected void assertEquals(IFile file1, IFile file2) throws CoreException {
+ assertEquals(file1.getName(), file2.getName());
+ assertTrue(compareContent(file1.getContents(), file2.getContents()));
+ }
+
+ // Assert that the two projects have equal contents ignoreing the project name
+ // and the .vcm_meta file
+ protected void assertEquals(IProject container1, IProject container2) throws CoreException {
+ List members1 = new ArrayList();
+ members1.addAll(Arrays.asList(container1.members()));
+ members1.remove(container1.findMember(".project"));
+
+ List members2 = new ArrayList();
+ members2.addAll(Arrays.asList(container2.members()));
+ members2.remove(container2.findMember(".project"));
+
+ assertTrue("Number of children differs for " + container1.getFullPath(), members1.size() == members2.size());
+ for (int i=0;i<members1.size();i++) {
+ IResource member1 = (IResource)members1.get(i);
+ IResource member2 = container2.findMember(member1.getName());
+ assertNotNull(member2);
+ assertEquals(member1, member2);
+ }
+ }
+ protected void assertEquals(IResource resource1, IResource resource2) throws CoreException {
+ assertEquals(resource1.getType(), resource2.getType());
+ if (resource1.getType() == IResource.FILE)
+ assertEquals((IFile)resource1, (IFile)resource2);
+ else
+ assertEquals((IContainer)resource1, (IContainer)resource2);
+ }
}

Back to the top