Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcvs2svn2004-01-23 16:51:45 -0500
committercvs2svn2004-01-23 16:51:45 -0500
commit813761447515a73ad4c3aa63fe5dd4ad399b577b (patch)
treeaaf70af086000b712faa3beef403802dacfdf9b0
parent720a77ab60522efd637d347062cb59498f20015e (diff)
downloadeclipse.platform.team-813761447515a73ad4c3aa63fe5dd4ad399b577b.tar.gz
eclipse.platform.team-813761447515a73ad4c3aa63fe5dd4ad399b577b.tar.xz
eclipse.platform.team-813761447515a73ad4c3aa63fe5dd4ad399b577b.zip
This commit was manufactured by cvs2svn to create branch
'branch_20031205_synchWorkFlowEnhancements'. Cherrypick from master 2004-01-23 21:51:43 UTC Michael Valenta <mvalenta> '*** empty log message ***': tests/org.eclipse.team.tests.core/plugin.xml tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/synchronize/SyncInfoSetContentProviderTest.java tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/synchronize/TestSubscriber.java tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/synchronize/TestSyncInfo.java tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/views/ContentProviderTestView.java tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/views/TestTreeViewer.java
-rw-r--r--tests/org.eclipse.team.tests.core/plugin.xml108
-rw-r--r--tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/synchronize/SyncInfoSetContentProviderTest.java127
-rw-r--r--tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/synchronize/TestSubscriber.java95
-rw-r--r--tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/synchronize/TestSyncInfo.java32
-rw-r--r--tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/views/ContentProviderTestView.java46
-rw-r--r--tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/views/TestTreeViewer.java30
6 files changed, 438 insertions, 0 deletions
diff --git a/tests/org.eclipse.team.tests.core/plugin.xml b/tests/org.eclipse.team.tests.core/plugin.xml
new file mode 100644
index 000000000..a99182bcb
--- /dev/null
+++ b/tests/org.eclipse.team.tests.core/plugin.xml
@@ -0,0 +1,108 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+<plugin
+ id="org.eclipse.team.tests.core"
+ name="Eclipse Team Core Tests"
+ version="3.0.0"
+ provider-name="Eclipse.org"
+ class="">
+
+ <runtime>
+ <library name="teamtests.jar">
+ <export name="*"/>
+ <packages prefixes="org.eclipse.team.tests.core"/>
+ </library>
+ </runtime>
+ <requires>
+ <import plugin="org.eclipse.ui.ide" optional="true"/>
+ <import plugin="org.eclipse.ui.views" optional="true"/>
+ <import plugin="org.eclipse.jface.text" optional="true"/>
+ <import plugin="org.eclipse.ui.workbench.texteditor" optional="true"/>
+ <import plugin="org.eclipse.ui.editors" optional="true"/>
+ <import plugin="org.eclipse.core.tests.harness"/>
+ <import plugin="org.eclipse.core.resources"/>
+ <import plugin="org.eclipse.core.runtime.compatibility"/>
+ <import plugin="org.eclipse.core.boot"/>
+ <import plugin="org.eclipse.team.core"/>
+ <import plugin="org.eclipse.team.cvs.core"/>
+ <import plugin="org.eclipse.team.ui"/>
+ <import plugin="org.eclipse.team.cvs.ui"/>
+ <import plugin="org.eclipse.compare"/>
+ <import plugin="org.eclipse.ui"/>
+ <import plugin="org.junit"/>
+ </requires>
+
+
+ <extension
+ point="org.eclipse.core.tests.harness.tests">
+ <test
+ id="team.all">
+ <run
+ class="org.eclipse.team.tests.core.RepositoryProviderTests">
+ </run>
+ </test>
+ </extension>
+ <extension
+ point="org.eclipse.core.tests.harness.tests">
+ <test
+ id="target.all">
+ <run
+ class="org.eclipse.team.tests.core.TargetProviderTests">
+ </run>
+ </test>
+ </extension>
+ <extension
+ point="org.eclipse.core.tests.harness.tests">
+ <test
+ id="team.ftp">
+ <run
+ class="org.eclipse.team.tests.ftp.ClientTest">
+ </run>
+ </test>
+ </extension>
+<!-- *************** Repository Providers **************** -->
+ <extension
+ point="org.eclipse.team.core.repository">
+ <repository
+ class="org.eclipse.team.tests.core.RepositoryProviderBic"
+ id="org.eclipse.team.tests.core.bic-provider">
+ </repository>
+ </extension>
+ <extension
+ point="org.eclipse.team.core.repository">
+ <repository
+ class="org.eclipse.team.tests.core.RepositoryProviderNaish"
+ id="org.eclipse.team.tests.core.naish-provider">
+ </repository>
+ </extension>
+<!-- *************** Bad provider that is not registered ****************
+ <extension
+ point="org.eclipse.team.core.repository">
+ <repository
+ id="org.eclipse.team.tests.core.other"
+ class="org.eclipse.team.tests.core.RepositoryProviderOtherSport">
+ </repository>
+ </extension>
+ -->
+ <extension
+ point="org.eclipse.team.core.repository">
+ <repository
+ class="org.eclipse.team.tests.core.RepositoryProviderWithLinking"
+ id="org.eclipse.team.tests.core.linking">
+ </repository>
+ </extension>
+ <extension
+ point="org.eclipse.ui.views">
+ <category
+ name="Team Test Views"
+ id="org.eclipse.team.tests.core">
+ </category>
+ <view
+ name="Content Provider Test View"
+ category="org.eclipse.team.tests.core"
+ class="org.eclipse.team.tests.ui.views.ContentProviderTestView"
+ id="org.eclipse.team.tests.ui.views.ContentProviderTestView">
+ </view>
+ </extension>
+
+</plugin>
diff --git a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/synchronize/SyncInfoSetContentProviderTest.java b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/synchronize/SyncInfoSetContentProviderTest.java
new file mode 100644
index 000000000..3a5c9f441
--- /dev/null
+++ b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/synchronize/SyncInfoSetContentProviderTest.java
@@ -0,0 +1,127 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.tests.ui.synchronize;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.team.core.TeamException;
+import org.eclipse.team.core.subscribers.MutableSyncInfoSet;
+import org.eclipse.team.core.subscribers.SyncInfo;
+import org.eclipse.team.tests.core.TeamTest;
+import org.eclipse.team.tests.ui.views.*;
+
+/**
+ * Tests for the SyncInfoSet content providers.
+ */
+public class SyncInfoSetContentProviderTest extends TeamTest {
+
+ public static final TestSubscriber subscriber = new TestSubscriber();
+ /*
+ * This method creates a project with the given resources, imports
+ * it to CVS and checks it out
+ */
+ protected IProject createProject(String prefix, String[] resources) throws CoreException {
+ IProject project = getUniqueTestProject(prefix);
+ 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);
+ }
+
+ private MutableSyncInfoSet createSet(IProject project, String[] resources, int[] syncKind) throws TeamException {
+ MutableSyncInfoSet set = new MutableSyncInfoSet();
+ adjustSet(
+ set,
+ project,
+ resources,
+ syncKind);
+ return set;
+ }
+
+ private void adjustSet(MutableSyncInfoSet set, IProject project, String[] resourceStrings, int[] syncKind) throws TeamException {
+ IResource[] resources = buildResources(project, resourceStrings);
+ set.beginInput();
+ for (int i = 0; i < resources.length; i++) {
+ IResource resource = resources[i];
+ int kind = syncKind[i];
+ if (kind == SyncInfo.IN_SYNC) {
+ set.remove(resource);
+ } else {
+ SyncInfo newInfo = subscriber.getSyncInfo(resource, kind);
+ if (set.getSyncInfo(resource) != null) {
+ set.changed(newInfo);
+ } else {
+ set.add(newInfo);
+ }
+ }
+ }
+ set.endInput(new NullProgressMonitor());
+ }
+
+ /**
+ * Ensure that the resource
+ * @param resources
+ */
+ private void assertVisible(IProject project, String[] resources) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void simpleTest() throws CoreException {
+ IProject project = createProject(new String[] { "file.txt", "folder1/file2.txt", "folder1/folder2/file3.txt"});
+ MutableSyncInfoSet set = createSet(
+ project,
+ new String[] { "file.txt" },
+ new int[] {SyncInfo.OUTGOING | SyncInfo.CHANGE});
+ assertVisible(project, new String[] { "file.txt" });
+
+ adjustSet(
+ set,
+ project,
+ new String[] { "folder1/file2.txt", "folder1/folder2/file3.txt" },
+ new int[] {
+ SyncInfo.OUTGOING | SyncInfo.CHANGE,
+ SyncInfo.OUTGOING | SyncInfo.CHANGE});
+ assertVisible(project, new String[] { "file.txt", "folder1/file2.txt", "folder1/folder2/file3.txt" });
+
+ adjustSet(
+ set,
+ project,
+ new String[] { "folder1/file2.txt"},
+ new int[] {
+ SyncInfo.IN_SYNC,
+ });
+ assertVisible(project, new String[] { "file.txt", "folder1/folder2/file3.txt" });
+
+ }
+
+ /* (non-Javadoc)
+ * @see junit.framework.TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ TestTreeViewer viewer = new TestTreeViewer(null);
+ }
+ /* (non-Javadoc)
+ * @see junit.framework.TestCase#tearDown()
+ */
+ protected void tearDown() throws Exception {
+ // TODO Dispose of whatever was created
+ super.tearDown();
+ }
+}
diff --git a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/synchronize/TestSubscriber.java b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/synchronize/TestSubscriber.java
new file mode 100644
index 000000000..0f1129ca7
--- /dev/null
+++ b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/synchronize/TestSubscriber.java
@@ -0,0 +1,95 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.tests.ui.synchronize;
+
+import org.eclipse.core.resources.*;
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.team.core.TeamException;
+import org.eclipse.team.core.subscribers.*;
+
+/**
+ * @author Administrator
+ *
+ * To change the template for this generated type comment go to
+ * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
+ */
+public class TestSubscriber extends TeamSubscriber {
+ /* (non-Javadoc)
+ * @see org.eclipse.team.core.subscribers.TeamSubscriber#getDescription()
+ */
+ public String getDescription() {
+ return "Test Subscriber";
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.team.core.subscribers.TeamSubscriber#isSupervised(org.eclipse.core.resources.IResource)
+ */
+ public boolean isSupervised(IResource resource) throws TeamException {
+ return true;
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.team.core.subscribers.TeamSubscriber#members(org.eclipse.core.resources.IResource)
+ */
+ public IResource[] members(IResource resource) throws TeamException {
+ if (resource.getType() == IResource.FILE) {
+ return new IResource[0];
+ }
+ try {
+ return ((IContainer)resource).members();
+ } catch (CoreException e) {
+ throw TeamException.asTeamException(e);
+ }
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.team.core.subscribers.TeamSubscriber#roots()
+ */
+ public IResource[] roots() {
+ return ResourcesPlugin.getWorkspace().getRoot().getProjects();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.core.subscribers.TeamSubscriber#getSyncInfo(org.eclipse.core.resources.IResource)
+ */
+ public SyncInfo getSyncInfo(IResource resource) throws TeamException {
+ return getSyncInfo(resource, SyncInfo.IN_SYNC);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.core.subscribers.TeamSubscriber#refresh(org.eclipse.core.resources.IResource[], int, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ public void refresh(IResource[] resources, int depth, IProgressMonitor monitor) throws TeamException {
+ // Nothing to do
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.core.subscribers.TeamSubscriber#getDefaultComparisonCriteria()
+ */
+ public IComparisonCriteria getDefaultComparisonCriteria() {
+ return new IComparisonCriteria() {
+ public boolean compare(Object e1, Object e2) {
+ return false;
+ }
+ };
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.core.subscribers.TeamSubscriber#isThreeWay()
+ */
+ public boolean isThreeWay() {
+ return false;
+ }
+
+ public SyncInfo getSyncInfo(IResource resource, int i) throws TeamException {
+ return new TestSyncInfo(resource, i, this);
+ }
+}
diff --git a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/synchronize/TestSyncInfo.java b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/synchronize/TestSyncInfo.java
new file mode 100644
index 000000000..75812e94c
--- /dev/null
+++ b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/synchronize/TestSyncInfo.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.tests.ui.synchronize;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.team.core.TeamException;
+import org.eclipse.team.core.subscribers.SyncInfo;
+
+public class TestSyncInfo extends SyncInfo {
+
+ private int kind;
+
+ public TestSyncInfo(IResource resource, int kind, TestSubscriber subscriber) throws TeamException {
+ super(resource, null, null, subscriber);
+ this.kind = kind;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.core.subscribers.SyncInfo#calculateKind()
+ */
+ protected int calculateKind() throws TeamException {
+ return this.kind;
+ }
+}
diff --git a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/views/ContentProviderTestView.java b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/views/ContentProviderTestView.java
new file mode 100644
index 000000000..6e230dcaf
--- /dev/null
+++ b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/views/ContentProviderTestView.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.tests.ui.views;
+
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.team.core.subscribers.SyncInfo;
+import org.eclipse.team.core.subscribers.SyncInfoSet;
+import org.eclipse.team.internal.ui.synchronize.views.CompressedFolderContentProvider;
+import org.eclipse.team.ui.synchronize.SyncInfoDiffNode;
+import org.eclipse.team.ui.synchronize.TeamSubscriberParticipantLabelProvider;
+import org.eclipse.ui.part.ViewPart;
+
+public class ContentProviderTestView extends ViewPart {
+
+ public static final String ID = "org.eclipse.team.tests.ui.views.ContentProviderTestView";
+
+ private TestTreeViewer viewer;
+
+ public ContentProviderTestView() {
+ }
+
+ public void createPartControl(Composite parent) {
+ viewer = new TestTreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
+ viewer.setContentProvider(new CompressedFolderContentProvider());
+ viewer.setLabelProvider(new TeamSubscriberParticipantLabelProvider());
+ setInput(new SyncInfoSet(new SyncInfo[0]));
+ }
+
+ public void setInput(SyncInfoSet set) {
+ viewer.setInput(new SyncInfoDiffNode(set, ResourcesPlugin.getWorkspace().getRoot()));
+ }
+
+ public void setFocus() {
+ viewer.getControl().setFocus();
+ }
+} \ No newline at end of file
diff --git a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/views/TestTreeViewer.java b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/views/TestTreeViewer.java
new file mode 100644
index 000000000..4284e4a27
--- /dev/null
+++ b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/views/TestTreeViewer.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.tests.ui.views;
+
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Tree;
+
+public class TestTreeViewer extends TreeViewer {
+
+ public TestTreeViewer(Composite parent) {
+ super(parent);
+ }
+
+ public TestTreeViewer(Composite parent, int style) {
+ super(parent, style);
+ }
+
+ public TestTreeViewer(Tree tree) {
+ super(tree);
+ }
+}

Back to the top