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 326926 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/pde/internal/core/importing/CvsBundleImporterDelegate.java (-34 / +10 lines)
Lines 10-24 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.pde.internal.core.importing;
11
package org.eclipse.pde.internal.core.importing;
12
12
13
import org.eclipse.pde.internal.core.importing.provisional.BundleImportDescription;
13
import java.net.URI;
14
import org.eclipse.pde.internal.core.importing.provisional.IBundleImporterDelegate;
14
import java.net.URISyntaxException;
15
16
import java.util.*;
15
import java.util.*;
17
import org.eclipse.core.resources.IProject;
16
import org.eclipse.core.resources.IProject;
18
import org.eclipse.core.runtime.*;
17
import org.eclipse.core.runtime.*;
19
import org.eclipse.osgi.util.ManifestElement;
18
import org.eclipse.osgi.util.ManifestElement;
20
import org.eclipse.pde.internal.core.ICoreConstants;
19
import org.eclipse.pde.internal.core.ICoreConstants;
21
import org.eclipse.pde.internal.core.PDECore;
20
import org.eclipse.pde.internal.core.PDECore;
21
import org.eclipse.pde.internal.core.importing.provisional.BundleImportDescription;
22
import org.eclipse.pde.internal.core.importing.provisional.IBundleImporterDelegate;
22
import org.eclipse.team.core.*;
23
import org.eclipse.team.core.*;
23
import org.osgi.framework.BundleException;
24
import org.osgi.framework.BundleException;
24
import org.osgi.framework.Constants;
25
import org.osgi.framework.Constants;
Lines 86-94 Link Here
86
									}
87
									}
87
								}
88
								}
88
								results[i] = createImportDescription(url, manifest, tag, project);
89
								results[i] = createImportDescription(url, manifest, tag, project);
90
								results[i].setProperty(IBundleImporterDelegate.SCM_URL, new URI(value));
89
							}
91
							}
90
						} catch (BundleException e) {
92
						} catch (BundleException e) {
91
							PDECore.log(e);
93
							PDECore.log(e);
94
						} catch (URISyntaxException e) {
95
							PDECore.log(e);
92
						}
96
						}
93
					}
97
					}
94
				}
98
				}
Lines 102-115 Link Here
102
	 */
106
	 */
103
	public IProject[] performImport(BundleImportDescription[] descriptions, IProgressMonitor monitor) throws CoreException {
107
	public IProject[] performImport(BundleImportDescription[] descriptions, IProgressMonitor monitor) throws CoreException {
104
		List references = new ArrayList();
108
		List references = new ArrayList();
109
		ProjectSetCapability psfCapability = CVS_PROVIDER_TYPE.getProjectSetCapability();
105
		// collect and validate all header values
110
		// collect and validate all header values
106
		for (int i = 0; i < descriptions.length; i++) {
111
		for (int i = 0; i < descriptions.length; i++) {
107
			references.add(createPSF((CvsBundleImportDescription) descriptions[i]));
112
			CvsBundleImportDescription description = (CvsBundleImportDescription) descriptions[i];
113
			references.add(psfCapability.asReference((URI) description.getProperty(IBundleImporterDelegate.SCM_URL), description.getProject()));
108
		}
114
		}
109
		// create projects
115
		// create projects
110
		if (!references.isEmpty()) {
116
		if (!references.isEmpty()) {
111
			SubMonitor subMonitor = SubMonitor.convert(monitor, references.size());
117
			SubMonitor subMonitor = SubMonitor.convert(monitor, references.size());
112
			ProjectSetCapability psfCapability = CVS_PROVIDER_TYPE.getProjectSetCapability();
113
			if (psfCapability != null) {
118
			if (psfCapability != null) {
114
				// TODO: specify shell
119
				// TODO: specify shell
115
				psfCapability.addToWorkspace((String[]) references.toArray(new String[references.size()]), new ProjectSetSerializationContext(), subMonitor);
120
				psfCapability.addToWorkspace((String[]) references.toArray(new String[references.size()]), new ProjectSetSerializationContext(), subMonitor);
Lines 168-200 Link Here
168
		return new CvsBundleImportDescription(project, manifest, protocol, server, path, module, tag);
173
		return new CvsBundleImportDescription(project, manifest, protocol, server, path, module, tag);
169
	}
174
	}
170
175
171
	/**
172
	 * Constructs a CVS project set import description from an SCMURL.
173
	 * 
174
	 * @param url
175
	 * @param tag attribute value or <code>null</code>
176
	 * @param project suggested project name or <code>null</code>
177
	 * @return corresponding CVS project set reference
178
	 */
179
	private String createPSF(CvsBundleImportDescription description) {
180
		// format is 1.0,protocol:host:cvs folder,project name [, tag]
181
		StringBuffer buffer = new StringBuffer();
182
		buffer.append("1.0,:"); //$NON-NLS-1$
183
		buffer.append(description.protocol); // protocol
184
		buffer.append(COLON);
185
		buffer.append(description.server);
186
		buffer.append(COLON);
187
		buffer.append(description.path);
188
		buffer.append(',');
189
		buffer.append(description.module);
190
		buffer.append(',');
191
		buffer.append(description.getProject());
192
		String tag = description.tag;
193
		if (tag != null) {
194
			buffer.append(',');
195
			buffer.append(tag);
196
		}
197
		return buffer.toString();
198
	}
199
200
}
176
}
(-)src/org/eclipse/pde/internal/core/importing/provisional/IBundleImporterDelegate.java (+6 lines)
Lines 44-49 Link Here
44
public interface IBundleImporterDelegate {
44
public interface IBundleImporterDelegate {
45
45
46
	/**
46
	/**
47
	 * Property key used in {@link BundleImportDescription}s.
48
	 * @since 3.7
49
	 */
50
	public static final String SCM_URL = "SCM_URL";
51
52
	/**
47
	 * Returns an array of objects describing how each given bundle (manifest headers and values)
53
	 * Returns an array of objects describing how each given bundle (manifest headers and values)
48
	 * can be imported into a workspace project. A <code>null</code> entry in the returned array
54
	 * can be imported into a workspace project. A <code>null</code> entry in the returned array
49
	 * indicates the corresponding bundle cannot be imported by this delegate.
55
	 * indicates the corresponding bundle cannot be imported by this delegate.
(-)src/org/eclipse/pde/internal/ui/views/plugins/ImportActionGroup.java (-7 / +15 lines)
Lines 16-29 Link Here
16
import org.eclipse.jface.dialogs.MessageDialog;
16
import org.eclipse.jface.dialogs.MessageDialog;
17
import org.eclipse.jface.viewers.ISelection;
17
import org.eclipse.jface.viewers.ISelection;
18
import org.eclipse.jface.viewers.IStructuredSelection;
18
import org.eclipse.jface.viewers.IStructuredSelection;
19
import org.eclipse.jface.wizard.WizardDialog;
20
import org.eclipse.pde.core.plugin.*;
19
import org.eclipse.pde.core.plugin.*;
20
import org.eclipse.pde.internal.core.importing.IBundleImporter;
21
import org.eclipse.pde.internal.core.importing.provisional.BundleImportDescription;
21
import org.eclipse.pde.internal.core.importing.provisional.BundleImportDescription;
22
import org.eclipse.pde.internal.core.importing.provisional.IBundleImporterDelegate;
22
import org.eclipse.pde.internal.core.importing.provisional.IBundleImporterDelegate;
23
import org.eclipse.pde.internal.core.project.BundleProjectService;
23
import org.eclipse.pde.internal.core.project.BundleProjectService;
24
import org.eclipse.pde.internal.ui.PDEPlugin;
24
import org.eclipse.pde.internal.ui.PDEPlugin;
25
import org.eclipse.pde.internal.ui.PDEUIMessages;
25
import org.eclipse.pde.internal.ui.PDEUIMessages;
26
import org.eclipse.pde.internal.ui.wizards.imports.*;
26
import org.eclipse.pde.internal.ui.wizards.imports.PluginImportOperation;
27
import org.eclipse.pde.internal.ui.wizards.imports.PluginImportWizard;
27
import org.eclipse.swt.widgets.Display;
28
import org.eclipse.swt.widgets.Display;
28
import org.eclipse.swt.widgets.Shell;
29
import org.eclipse.swt.widgets.Shell;
29
import org.eclipse.ui.actions.ActionContext;
30
import org.eclipse.ui.actions.ActionContext;
Lines 89-103 Link Here
89
		if (display == null)
90
		if (display == null)
90
			display = Display.getDefault();
91
			display = Display.getDefault();
91
		IPluginModelBase[] models = (IPluginModelBase[]) externalModels.toArray(new IPluginModelBase[externalModels.size()]);
92
		IPluginModelBase[] models = (IPluginModelBase[]) externalModels.toArray(new IPluginModelBase[externalModels.size()]);
93
		Shell shell = display.getActiveShell();
92
		if (importType == PluginImportOperation.IMPORT_FROM_REPOSITORY) {
94
		if (importType == PluginImportOperation.IMPORT_FROM_REPOSITORY) {
93
			Map importMap = getImportDescriptions(display.getActiveShell(), models);
95
			Map/*<IBundleImporter, BundleImportDescription[]*/importMap = getImportDescriptions(shell, models);
94
			if (importMap != null) {
96
			if (importMap != null) {
95
				RepositoryImportWizard wizard = new RepositoryImportWizard(importMap);
97
				for (Iterator iter = importMap.keySet().iterator(); iter.hasNext();) {
96
				WizardDialog dialog = new WizardDialog(display.getActiveShell(), wizard);
98
					IBundleImporter importer = (IBundleImporter) iter.next();
97
				dialog.open();
99
					try {
100
						// TODO: missing progress monitor, import with PluginImportOperation
101
						importer.performImport((BundleImportDescription[]) importMap.get(importer), null);
102
					} catch (CoreException e) {
103
						PDEPlugin.log(e);
104
					}
105
				}
98
			}
106
			}
99
		} else {
107
		} else {
100
			PluginImportWizard.doImportOperation(display.getActiveShell(), importType, models, false);
108
			PluginImportWizard.doImportOperation(shell, importType, models, false);
101
		}
109
		}
102
	}
110
	}
103
111
(-)src/org/eclipse/pde/internal/ui/wizards/imports/RepositoryImportWizard.java (-149 lines)
Removed Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2010 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.pde.internal.ui.wizards.imports;
12
13
import java.util.*;
14
import java.util.Map.Entry;
15
import org.eclipse.core.runtime.*;
16
import org.eclipse.jface.dialogs.IDialogSettings;
17
import org.eclipse.jface.wizard.IWizardPage;
18
import org.eclipse.jface.wizard.Wizard;
19
import org.eclipse.pde.core.plugin.IPluginModelBase;
20
import org.eclipse.pde.internal.core.importing.IBundleImporter;
21
import org.eclipse.pde.internal.core.importing.provisional.BundleImportDescription;
22
import org.eclipse.pde.internal.core.project.BundleProjectService;
23
import org.eclipse.pde.internal.ui.*;
24
import org.eclipse.pde.internal.ui.provisional.IBundeImportWizardPage;
25
26
/**
27
 * Wizard to import plug-ins from a repository.
28
 * 
29
 * @since 3.6
30
 */
31
public class RepositoryImportWizard extends Wizard {
32
33
	/**
34
	 * Map of import delegates to import descriptions as provided by the {@link BundleProjectService}
35
	 */
36
	private Map fImportMap;
37
38
	/**
39
	 * Map of importer identifier to associated wizard import page
40
	 */
41
	private Map fIdToPages = new HashMap();
42
43
	private static final String STORE_SECTION = "RepositoryImportWizard"; //$NON-NLS-1$
44
45
	/**
46
	 * Map of import delegates to import descriptions.
47
	 * 
48
	 * @param importMap
49
	 */
50
	public RepositoryImportWizard(Map importMap) {
51
		IDialogSettings masterSettings = PDEPlugin.getDefault().getDialogSettings();
52
		setDialogSettings(getSettingsSection(masterSettings));
53
		setDefaultPageImageDescriptor(PDEPluginImages.DESC_PLUGIN_IMPORT_WIZ);
54
		setWindowTitle(PDEUIMessages.ImportWizard_title);
55
		fImportMap = importMap;
56
	}
57
58
	/* (non-Javadoc)
59
	 * @see org.eclipse.jface.wizard.Wizard#addPages()
60
	 */
61
	public void addPages() {
62
		Iterator iterator = fImportMap.entrySet().iterator();
63
		while (iterator.hasNext()) {
64
			Entry entry = (Entry) iterator.next();
65
			IBundleImporter importer = (IBundleImporter) entry.getKey();
66
			BundleImportDescription[] descriptions = (BundleImportDescription[]) entry.getValue();
67
			IBundeImportWizardPage page = (IBundeImportWizardPage) fIdToPages.get(importer.getId());
68
			if (page == null) {
69
				page = getImportPage(importer.getId());
70
				if (page != null) {
71
					fIdToPages.put(importer.getId(), page);
72
					addPage(page);
73
					page.setSelection(descriptions);
74
				}
75
			}
76
		}
77
	}
78
79
	/**
80
	 * Creates and returns a wizard page associated with the given bundle importer extension identifier
81
	 * or <code>null</code> of none.
82
	 * 
83
	 * @param importerId org.eclipse.pde.core.bundleImporters extension identifier
84
	 * @return associated bundle import wizard page or <code>null</code>
85
	 */
86
	private IBundeImportWizardPage getImportPage(String importerId) {
87
		IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(IPDEUIConstants.EXTENSION_POINT_BUNDLE_IMPORT_PAGES);
88
		if (point != null) {
89
			IConfigurationElement[] infos = point.getConfigurationElements();
90
			for (int i = 0; i < infos.length; i++) {
91
				IConfigurationElement element = infos[i];
92
				String id = element.getAttribute("bundleImporter"); //$NON-NLS-1$
93
				if (id != null && importerId.equals(id)) {
94
					try {
95
						return (IBundeImportWizardPage) element.createExecutableExtension("class"); //$NON-NLS-1$
96
					} catch (CoreException e) {
97
						PDEPlugin.log(e);
98
					}
99
				}
100
			}
101
		}
102
		return null;
103
	}
104
105
	private IDialogSettings getSettingsSection(IDialogSettings master) {
106
		IDialogSettings setting = master.getSection(STORE_SECTION);
107
		if (setting == null) {
108
			setting = master.addNewSection(STORE_SECTION);
109
		}
110
		return setting;
111
	}
112
113
	/* (non-Javadoc)
114
	 * @see org.eclipse.jface.wizard.Wizard#performFinish()
115
	 */
116
	public boolean performFinish() {
117
		// collect the bundle descriptions from each page and import
118
		Map importMap = new HashMap();
119
		List plugins = new ArrayList();
120
		IWizardPage[] pages = getPages();
121
		for (int i = 0; i < pages.length; i++) {
122
			IBundeImportWizardPage page = (IBundeImportWizardPage) pages[i];
123
			if (page.finish()) {
124
				BundleImportDescription[] descriptions = page.getSelection();
125
				if (descriptions != null && descriptions.length > 0) {
126
					for (int j = 0; j < descriptions.length; j++) {
127
						BundleImportDescription description = descriptions[j];
128
						if (j == 0) {
129
							Object importer = description.getProperty(BundleProjectService.BUNDLE_IMPORTER);
130
							if (importer != null) {
131
								importMap.put(importer, descriptions);
132
							}
133
						}
134
						Object plugin = description.getProperty(BundleProjectService.PLUGIN);
135
						if (plugin != null) {
136
							plugins.add(plugin);
137
						}
138
					}
139
				}
140
			} else {
141
				return false;
142
			}
143
		}
144
		if (!importMap.isEmpty()) {
145
			PluginImportWizard.doImportOperation(PluginImportOperation.IMPORT_FROM_REPOSITORY, (IPluginModelBase[]) plugins.toArray(new IPluginModelBase[plugins.size()]), false, false, null, importMap);
146
		}
147
		return true;
148
	}
149
}
(-)src/org/eclipse/team/internal/ccvs/core/filesystem/CVSURI.java (-6 / +52 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2007 IBM Corporation and others.
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 31-47 Link Here
31
	private final String revision;
31
	private final String revision;
32
32
33
	/**
33
	/**
34
	 * Convert the given URI to a CVSURI. There are two supported formats: the
34
	 * Convert the given URI to a CVSURI. There are three supported formats: the
35
	 * original opaque format and a newer hierarchical format.
35
	 * original opaque format, a newer hierarchical format and a CVS SCM URL
36
	 * format.
37
	 * 
38
	 * In the last format, as delimiter you can use either colon ':' or, if you
39
	 * use a colon for one of the variables (e.g. a windows path), a pipe '|'.
40
	 * For more information visit http://maven.apache.org/scm/cvs.html.
41
	 * 
36
	 * <ul>
42
	 * <ul>
37
	 * <li>cvs://[:]method:user[:password]@host:[port]/root/path#project/path[,tagName]</li>
43
	 * <li>cvs://[:]method:user[:password]@host:[port]/root/path#project/path[,tagName]</li>
38
	 * <li>cvs://_method_user[_password]~host_[port]!root!path/project/path[?<version,branch,date,revision>=tagName]</li>
44
	 * <li>cvs://_method_user[_password]~host_[port]!root!path/project/path[?<version,branch,date,revision>=tagName]</li>
45
	 * <li>scm:cvs<delimiter>method<delimiter>[user[<delimiter>password]@]host[<delimiter>port]<delimiter>/root/path<delimiter>project/path[;tag=tagName]</li>
39
	 * </ul>
46
	 * </ul>
40
	 * @param uri the URI
47
	 * 
48
	 * @param uri
49
	 *            the URI
41
	 * @return a CVS URI
50
	 * @return a CVS URI
42
	 */
51
	 */
43
	public static CVSURI fromUri(URI uri) {
52
	public static CVSURI fromUri(URI uri) {
44
		try {
53
		try {
54
			if ("scm".equals(uri.getScheme())) {
55
				uri = getURIforSCM(uri);
56
			}
57
			
45
			ICVSRepositoryLocation repository = getRepository(uri);
58
			ICVSRepositoryLocation repository = getRepository(uri);
46
			if (repository != null) {
59
			if (repository != null) {
47
				IPath path = new Path(null, uri.getPath());
60
				IPath path = new Path(null, uri.getPath());
Lines 57-70 Link Here
57
		} catch (CVSException e) {
70
		} catch (CVSException e) {
58
			CVSProviderPlugin.log(e);
71
			CVSProviderPlugin.log(e);
59
			throw new IllegalArgumentException(NLS.bind(CVSMessages.CVSURI_InvalidURI, new String[] {uri.toString(), e.getMessage()}));
72
			throw new IllegalArgumentException(NLS.bind(CVSMessages.CVSURI_InvalidURI, new String[] {uri.toString(), e.getMessage()}));
73
		} catch (URISyntaxException e) {
74
			throw new IllegalArgumentException(NLS.bind(CVSMessages.CVSURI_InvalidURI, new String[] {uri.toString(), e.getMessage()}));
60
		}
75
		}
61
	}
76
	}
62
77
	
78
	private static URI getURIforSCM(URI uri) throws URISyntaxException {
79
		StringBuffer sb = new StringBuffer();
80
		String ssp = uri.getSchemeSpecificPart();
81
		if (ssp.startsWith(SCHEME + ":")) {
82
//			sb.append(SCHEME + "://");
83
//			ssp = ssp.substring((SCHEME + ":").length());
84
		}
85
		int i = ssp.lastIndexOf("|");
86
		if (i != -1) {
87
			sb.append(ssp.substring(0, i)).append("#").append(ssp.substring(i + 1));
88
		} else {
89
			i = ssp.lastIndexOf(":");
90
			sb.append(ssp.substring(0, i)).append("#").append(ssp.substring(i + 1));
91
		}
92
		
93
		// TODO: see https://bugs.eclipse.org/bugs/show_bug.cgi?id=326926#c2
94
		i = sb.indexOf(";tag="); // PDE way of providing tags 
95
		if (i != -1)
96
			sb.replace(i, i + ";tag=".length(), ",version=");
97
		return new URI(sb.toString());
98
	}
99
	
63
	private static CVSTag getTag(URI uri) {
100
	private static CVSTag getTag(URI uri) {
64
		String query = uri.getQuery();
101
		String query = uri.getQuery();
65
		if (query == null)
102
		if (query == null)
66
			return null;
103
			return null;
67
		StringTokenizer tokens = new StringTokenizer(query, ","); //$NON-NLS-1$
104
		return getTag(query);
105
	}
106
107
	private static CVSTag getTag(String s) {
108
		StringTokenizer tokens = new StringTokenizer(s, ","); //$NON-NLS-1$
68
		while (tokens.hasMoreTokens()) {
109
		while (tokens.hasMoreTokens()) {
69
			String token = tokens.nextToken();
110
			String token = tokens.nextToken();
70
			int index = token.indexOf('=');
111
			int index = token.indexOf('=');
Lines 116-121 Link Here
116
157
117
	private static ICVSRepositoryLocation getRepository(URI uri) throws CVSException {
158
	private static ICVSRepositoryLocation getRepository(URI uri) throws CVSException {
118
		String authority = uri.getAuthority();
159
		String authority = uri.getAuthority();
160
		if (authority == null)
161
			return null;
119
		if (authority.indexOf('/') != -1)
162
		if (authority.indexOf('/') != -1)
120
			return null;
163
			return null;
121
		if (authority.indexOf('!') == -1)
164
		if (authority.indexOf('!') == -1)
Lines 130-135 Link Here
130
		if (i == -1) {
173
		if (i == -1) {
131
			return CVSTag.DEFAULT;
174
			return CVSTag.DEFAULT;
132
		}
175
		}
176
		CVSTag tag = getTag(f.substring(i + 1));
177
		if (tag != null)
178
			return tag;
133
		
179
		
134
		return CVSTag.DEFAULT;//just use HEAD for now (name, CVSTag.BRANCH);
180
		return CVSTag.DEFAULT;//just use HEAD for now (name, CVSTag.BRANCH);
135
	}
181
	}
(-)src/org/eclipse/team/tests/ccvs/core/cvsresources/CVSURITest.java (-1 / +78 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2006, 2008 IBM Corporation and others.
2
 * Copyright (c) 2006, 2010 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 115-119 Link Here
115
		assertEquals(null, cvsUri.getTag());
115
		assertEquals(null, cvsUri.getTag());
116
		assertEquals(cvsUri.toURI(), uri);
116
		assertEquals(cvsUri.toURI(), uri);
117
	}
117
	}
118
119
	// CVS SCM URL tests, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=231190
120
	public void testRealLifeScmUriWithPde() throws URISyntaxException, CVSException {
121
		URI uri = new URI("scm:cvs:pserver:dev.eclipse.org:/cvsroot/eclipse:org.eclipse.team.cvs.core;tag=I20100912-2000");
122
		CVSURI cvsUri = CVSURI.fromUri(uri);
123
		assertEquals("org.eclipse.team.cvs.core", cvsUri.getPath().toString());
124
		CVSRepositoryLocation location = CVSRepositoryLocation.fromString(":pserver:dev.eclipse.org:/cvsroot/eclipse");
125
		assertEquals(cvsUri.getRepository().getLocation(false), location.getLocation(false));
126
		assertEquals(cvsUri.getTag(), new CVSTag("I20100912-2000", CVSTag.VERSION));
127
	}
128
129
	public void testRealLifeScmUriWithProperTag() throws URISyntaxException, CVSException {
130
		URI uri = new URI("scm:cvs:pserver:dev.eclipse.org:/cvsroot/eclipse:org.eclipse.team.cvs.core,version=I20100912-2000");
131
		CVSURI cvsUri = CVSURI.fromUri(uri);
132
		assertEquals("org.eclipse.team.cvs.core", cvsUri.getPath().toString());
133
		CVSRepositoryLocation location = CVSRepositoryLocation.fromString(":pserver:dev.eclipse.org:/cvsroot/eclipse");
134
		assertEquals(cvsUri.getRepository().getLocation(false), location.getLocation(false));
135
		assertEquals(cvsUri.getTag(), new CVSTag("I20100912-2000", CVSTag.VERSION));
136
	}
118
	
137
	
138
	public void testRealLifeScmUriWithoutTag() throws URISyntaxException, CVSException {
139
		URI uri = new URI("scm:cvs:pserver:dev.eclipse.org:/cvsroot/eclipse:org.eclipse.team.cvs.core");
140
		CVSURI cvsUri = CVSURI.fromUri(uri);
141
		assertEquals("org.eclipse.team.cvs.core", cvsUri.getPath().toString());
142
		CVSRepositoryLocation location = CVSRepositoryLocation.fromString(":pserver:dev.eclipse.org:/cvsroot/eclipse");
143
		assertEquals(cvsUri.getRepository().getLocation(false), location.getLocation(false));
144
		assertEquals(cvsUri.getTag(), CVSTag.DEFAULT);
145
	}
146
	
147
	// Example CVS SCM URIs from http://maven.apache.org/scm/cvs.html 
148
	public void testMavenScmUriExampleWithEmptyPassword() throws URISyntaxException, CVSException {
149
		URI uri = new URI("scm:cvs:pserver:anoncvs:@cvs.apache.org:/cvs/root:module");
150
		CVSURI cvsUri = CVSURI.fromUri(uri);
151
		assertEquals("module", cvsUri.getPath().toString());
152
		CVSRepositoryLocation location = CVSRepositoryLocation.fromString(":pserver:anoncvs:@cvs.apache.org:/cvs/root");
153
		assertEquals(cvsUri.getRepository().getLocation(false), location.getLocation(false));
154
		assertEquals(cvsUri.getTag(), CVSTag.DEFAULT);
155
	}
156
157
	public void testMavenScmUriExampleWithPipe() throws CVSException, URISyntaxException {
158
		URI uri = new URI("scm:cvs|pserver|username@localhost|C:/Program Files/cvsnt/repositories|module_name");
159
		CVSURI cvsUri = CVSURI.fromUri(uri);
160
		assertEquals("module_name", cvsUri.getPath().toString());
161
		CVSRepositoryLocation location = CVSRepositoryLocation.fromString(":pserver:username@localhost:C:/Program Files/cvsnt/repositories");
162
		assertEquals(cvsUri.getRepository().getLocation(false), location.getLocation(false));
163
		assertEquals(cvsUri.getTag(), CVSTag.DEFAULT);
164
	}	
165
166
	public void testMavenScmUriExample() throws URISyntaxException, CVSException {
167
		URI uri = new URI("scm:cvs:ext:username@cvs.apache.org:/cvs/root:module");
168
		CVSURI cvsUri = CVSURI.fromUri(uri);
169
		assertEquals("module", cvsUri.getPath().toString());
170
		CVSRepositoryLocation location = CVSRepositoryLocation.fromString(":ext:username@cvs.apache.org:/cvs/root");
171
		assertEquals(cvsUri.getRepository().getLocation(false), location.getLocation(false));
172
		assertEquals(cvsUri.getTag(), CVSTag.DEFAULT);
173
	}
174
	
175
	// local and sspi methods are not supported
176
	/*
177
	public void testMavenScmUriExamplesParse4() throws URISyntaxException, CVSException {
178
		URI uri = new URI("scm:cvs:local:/cvs/root:module");
179
		CVSURI cvsUri = CVSURI.fromUri(uri);
180
		assertEquals("module", cvsUri.getPath().toString());
181
		CVSRepositoryLocation location = CVSRepositoryLocation.fromString(":local:@dev.eclipse.org:/cvs/root");
182
		assertEquals(cvsUri.getRepository().getLocation(false), location.getLocation(false));
183
		assertEquals(cvsUri.getTag(), CVSTag.DEFAULT);
184
	}
185
186
	public void testMavenScmUriExamplesParse5() throws URISyntaxException, CVSException {
187
		URI uri = new URI("scm:cvs:sspi:cvs.apache.org:2222:/cvs/root:module");
188
		CVSURI cvsUri = CVSURI.fromUri(uri);
189
		assertEquals("module", cvsUri.getPath().toString());
190
		CVSRepositoryLocation location = CVSRepositoryLocation.fromString(":sspi:@cvs.apache.org:2222:/cvs/root");
191
		assertEquals(cvsUri.getRepository().getLocation(false), location.getLocation(false));
192
		assertEquals(cvsUri.getTag(), CVSTag.DEFAULT);
193
	}
194
	*/
195
119
}
196
}

Return to bug 326926