Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 339990 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/team/tests/ccvs/core/cvsresources/EclipseSynchronizerTest.java (+62 lines)
Lines 29-34 Link Here
29
import org.eclipse.core.resources.IResourceVisitor;
29
import org.eclipse.core.resources.IResourceVisitor;
30
import org.eclipse.core.resources.IWorkspaceRoot;
30
import org.eclipse.core.resources.IWorkspaceRoot;
31
import org.eclipse.core.resources.ResourcesPlugin;
31
import org.eclipse.core.resources.ResourcesPlugin;
32
import org.eclipse.core.resources.mapping.ResourceMapping;
32
import org.eclipse.core.runtime.CoreException;
33
import org.eclipse.core.runtime.CoreException;
33
import org.eclipse.core.runtime.IProgressMonitor;
34
import org.eclipse.core.runtime.IProgressMonitor;
34
import org.eclipse.core.runtime.Path;
35
import org.eclipse.core.runtime.Path;
Lines 45-52 Link Here
45
import org.eclipse.team.internal.ccvs.core.syncinfo.MutableResourceSyncInfo;
46
import org.eclipse.team.internal.ccvs.core.syncinfo.MutableResourceSyncInfo;
46
import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
47
import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
47
import org.eclipse.team.internal.ccvs.core.util.SyncFileWriter;
48
import org.eclipse.team.internal.ccvs.core.util.SyncFileWriter;
49
import org.eclipse.team.internal.ccvs.ui.model.AllRootsElement;
50
import org.eclipse.team.internal.ccvs.ui.model.BranchCategory;
51
import org.eclipse.team.internal.ccvs.ui.model.CVSTagElement;
52
import org.eclipse.team.internal.ccvs.ui.model.RemoteContentProvider;
48
import org.eclipse.team.tests.ccvs.core.CVSTestSetup;
53
import org.eclipse.team.tests.ccvs.core.CVSTestSetup;
49
import org.eclipse.team.tests.ccvs.core.EclipseTest;
54
import org.eclipse.team.tests.ccvs.core.EclipseTest;
55
import org.eclipse.team.tests.ccvs.core.mappings.ResourceMapperTests;
50
56
51
/**
57
/**
52
 * Tests the EclipseSynchronizer.
58
 * Tests the EclipseSynchronizer.
Lines 917-920 Link Here
917
		assertTrue(!sync.getResourceSync(file21).getRevision().equals(revision));
923
		assertTrue(!sync.getResourceSync(file21).getRevision().equals(revision));
918
		
924
		
919
	}
925
	}
926
	
927
	private String moduleName;
928
	private String branchName;
929
	
930
	public void testBug339990() throws TeamException, CoreException {
931
		
932
		IProject project = getUniqueTestProject("Bug339990Project");
933
		buildResources(project, new String[] { "file1.txt" }, true);
934
		shareProject(getRepository(), project, moduleName, DEFAULT_MONITOR);
935
936
		CVSTag version = new CVSTag("Root_" + branchName, CVSTag.VERSION);
937
		branch(new ResourceMapping[] { ResourceMapperTests.asResourceMapping(
938
				new IResource[] { project }, IResource.DEPTH_INFINITE) },
939
				version, new CVSTag(branchName, CVSTag.BRANCH), true);
940
941
		RemoteContentProvider rcp = new RemoteContentProvider();
942
		AllRootsElement are = new AllRootsElement();
943
		Object[] elements = rcp.getElements(are);
944
		for (int i = 0; i < elements.length; i++) {
945
			Object o = elements[i];
946
			displayChildren(rcp, o, 0);
947
		}
948
	}
949
950
	private void displayChildren(RemoteContentProvider rcp, Object o, int depth) {
951
		boolean branchCategory = (o instanceof BranchCategory);
952
		if(depth == 1 && !branchCategory){
953
			return;
954
		} 
955
		if(branchCategory){
956
			BranchCategory b = (BranchCategory) o;
957
			Object[] branches = rcp.getChildren(b);
958
			for(int j = 0; j < branches.length; j++){
959
				if(branches[j] instanceof CVSTagElement){
960
					CVSTagElement el = (CVSTagElement) branches[j]; 
961
					Object[] modules = rcp.getChildren(el);
962
					System.out.println(modules);
963
				}
964
			}
965
			return;
966
		}
967
		++depth;
968
		if(rcp.hasChildren(o)){
969
			Object[] children = rcp.getChildren(o);
970
			for(int j = 0; j < children.length; j++){
971
				displayChildren(rcp, children[j], depth );
972
			}
973
		}
974
	}
975
976
	protected void setUp() throws Exception {
977
		String time = Long.toString(System.currentTimeMillis());
978
		moduleName = "Bug339990TestModule" + time;
979
		branchName = "Bug339990branch" + time;
980
		super.setUp();
981
	}
920
}
982
}

Return to bug 339990