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/CvsBundleImportDescription.java (-2 / +25 lines)
Lines 10-18 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
15
import java.util.Map;
14
import java.util.Map;
15
import org.eclipse.pde.internal.core.importing.provisional.BundleImportDescription;
16
16
17
/**
17
/**
18
 * Describes a bundle to be imported by CVS.
18
 * Describes a bundle to be imported by CVS.
Lines 20-25 Link Here
20
 */
20
 */
21
public class CvsBundleImportDescription extends BundleImportDescription {
21
public class CvsBundleImportDescription extends BundleImportDescription {
22
22
23
	/**
24
	 * Property key used in {@link BundleImportDescription}s.
25
	 * @since 3.7
26
	 */
27
	public static final String SCM_URL = "SCM_URL"; //$NON-NLS-1$
28
23
	String tag;
29
	String tag;
24
	String server;
30
	String server;
25
	String path;
31
	String path;
Lines 63-66 Link Here
63
		return protocol;
69
		return protocol;
64
	}
70
	}
65
71
72
	public URI getURI() {
73
		return (URI) getProperty(SCM_URL);
74
	}
75
76
	public URI toURI() {
77
		URI uri = getURI();
78
		if (uri != null) {
79
			if (tag == null) {
80
				String s = uri.toString();
81
				// TODO: false? assumption that the 'tag' parameter is always the last one
82
				s = s.substring(0, s.indexOf(";tag="));
83
				uri = URI.create(s);
84
			}
85
		}
86
		return uri;
87
	}
88
66
}
89
}
(-)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(CvsBundleImportDescription.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(description.toURI(), 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/team/internal/ccvs/core/CVSProjectSetCapability.java (-1 / +7 lines)
Lines 629-635 Link Here
629
			CVSURI cvsURI = CVSURI.fromUri(uri);
629
			CVSURI cvsURI = CVSURI.fromUri(uri);
630
			ICVSRepositoryLocation location = cvsURI.getRepository();
630
			ICVSRepositoryLocation location = cvsURI.getRepository();
631
			ICVSFolder folder = cvsURI.toFolder();
631
			ICVSFolder folder = cvsURI.toFolder();
632
			IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
632
			// TODO: use project name from CVS URI if specified
633
			IProject project = ResourcesPlugin
634
					.getWorkspace()
635
					.getRoot()
636
					.getProject(
637
							cvsURI.getProjectName() != null ? cvsURI
638
									.getProjectName() : projectName);
633
			return asReference((CVSRepositoryLocation)location, folder, project);
639
			return asReference((CVSRepositoryLocation)location, folder, project);
634
		} catch (TeamException e) {
640
		} catch (TeamException e) {
635
			CVSProviderPlugin.log(e);
641
			CVSProviderPlugin.log(e);
(-)src/org/eclipse/team/internal/ccvs/core/filesystem/CVSURI.java (-13 / +79 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 24-70 Link Here
24
24
25
public class CVSURI {
25
public class CVSURI {
26
26
27
	private static final String SCHEME = "cvs"; //$NON-NLS-1$
27
	private static final String SCHEME_CVS = "cvs"; //$NON-NLS-1$
28
	private static final String SCHEME_SCM = "scm"; //$NON-NLS-1$
28
	private final ICVSRepositoryLocation repository;
29
	private final ICVSRepositoryLocation repository;
29
	private final IPath path;
30
	private final IPath path;
30
	private final CVSTag tag;
31
	private final CVSTag tag;
31
	private final String revision;
32
	private final String revision;
33
	private final String projectName;
32
34
33
	/**
35
	/**
34
	 * Convert the given URI to a CVSURI. There are two supported formats: the
36
	 * Convert the given URI to a CVSURI. There are three supported formats: the
35
	 * original opaque format and a newer hierarchical format.
37
	 * original opaque format, a newer hierarchical format and a CVS SCM URL
38
	 * format.
39
	 * 
40
	 * In the last format, as delimiter you can use either colon ':' or, if you
41
	 * use a colon for one of the variables (e.g. a windows path), a pipe '|'.
42
	 * For more information visit http://maven.apache.org/scm/cvs.html.
43
	 * 
36
	 * <ul>
44
	 * <ul>
37
	 * <li>cvs://[:]method:user[:password]@host:[port]/root/path#project/path[,tagName]</li>
45
	 * <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>
46
	 * <li>cvs://_method_user[_password]~host_[port]!root!path/project/path[?<version,branch,date,revision>=tagName]</li>
47
	 * <li>scm:cvs<delimiter>method<delimiter>[user[<delimiter>password]@]host[<delimiter>port]<delimiter>/root/path<delimiter>project/path[;project="projectName"][;tag=tagName]</li>
39
	 * </ul>
48
	 * </ul>
40
	 * @param uri the URI
49
	 * 
50
	 * @param uri
51
	 *            the URI
41
	 * @return a CVS URI
52
	 * @return a CVS URI
42
	 */
53
	 */
43
	public static CVSURI fromUri(URI uri) {
54
	public static CVSURI fromUri(URI uri) {
44
		try {
55
		try {
56
			if (SCHEME_SCM.equals(uri.getScheme())) {
57
				uri = convert(uri);
58
			}
59
			
45
			ICVSRepositoryLocation repository = getRepository(uri);
60
			ICVSRepositoryLocation repository = getRepository(uri);
46
			if (repository != null) {
61
			if (repository != null) {
47
				IPath path = new Path(null, uri.getPath());
62
				IPath path = new Path(null, uri.getPath());
48
				CVSTag tag = getTag(uri);
63
				CVSTag tag = getTag(uri);
49
				String revision = getRevision(uri);
64
				String revision = getRevision(uri);
50
				return new CVSURI(repository, path, tag, revision);
65
				String projectName = getProjectName(uri);
66
				return new CVSURI(repository, path, tag, revision, projectName);
51
			} else {
67
			} else {
52
				repository = getOldRepository(uri);
68
				repository = getOldRepository(uri);
53
				IPath path = getOldPath(uri);
69
				IPath path = getOldPath(uri);
54
				CVSTag tag = getOldTag(uri);
70
				CVSTag tag = getOldTag(uri);
55
				return new CVSURI(repository, path, tag);
71
				String projectName = getProjectName(uri);
72
				return new CVSURI(repository, path, tag, projectName);
56
			}
73
			}
57
		} catch (CVSException e) {
74
		} catch (CVSException e) {
58
			CVSProviderPlugin.log(e);
75
			CVSProviderPlugin.log(e);
59
			throw new IllegalArgumentException(NLS.bind(CVSMessages.CVSURI_InvalidURI, new String[] {uri.toString(), e.getMessage()}));
76
			throw new IllegalArgumentException(NLS.bind(CVSMessages.CVSURI_InvalidURI, new String[] {uri.toString(), e.getMessage()}));
77
		} catch (URISyntaxException e) {
78
			throw new IllegalArgumentException(NLS.bind(CVSMessages.CVSURI_InvalidURI, new String[] {uri.toString(), e.getMessage()}));
60
		}
79
		}
61
	}
80
	}
62
81
	
82
	private static URI convert(URI uri) throws URISyntaxException {
83
		StringBuffer sb = new StringBuffer();
84
		String ssp = uri.getSchemeSpecificPart();
85
		if (ssp.startsWith(SCHEME_CVS + ":")) {
86
			// sb.append(SCHEME_CVS + "://");
87
			// ssp = ssp.substring((SCHEME_CVS + ":").length());
88
		}
89
		int i = ssp.lastIndexOf("|");
90
		if (i != -1) {
91
			sb.append(ssp.substring(0, i)).append("#").append(ssp.substring(i + 1));
92
		} else {
93
			i = ssp.lastIndexOf(":");
94
			sb.append(ssp.substring(0, i)).append("#").append(ssp.substring(i + 1));
95
		}
96
		
97
		i = sb.indexOf(";project=");
98
		if (i != -1)
99
			sb.replace(i, i + ";project=".length(), ",");
100
		// TODO: see https://bugs.eclipse.org/bugs/show_bug.cgi?id=326926#c2
101
		i = sb.indexOf(";tag="); // PDE way of providing tags 
102
		if (i != -1)
103
			sb.replace(i, i + ";tag=".length(), ",version=");
104
		return new URI(sb.toString());
105
	}
106
	
63
	private static CVSTag getTag(URI uri) {
107
	private static CVSTag getTag(URI uri) {
64
		String query = uri.getQuery();
108
		String query = uri.getQuery();
65
		if (query == null)
109
		if (query == null)
66
			return null;
110
			return null;
67
		StringTokenizer tokens = new StringTokenizer(query, ","); //$NON-NLS-1$
111
		return getTag(query);
112
	}
113
114
	private static CVSTag getTag(String s) {
115
		StringTokenizer tokens = new StringTokenizer(s, ","); //$NON-NLS-1$
68
		while (tokens.hasMoreTokens()) {
116
		while (tokens.hasMoreTokens()) {
69
			String token = tokens.nextToken();
117
			String token = tokens.nextToken();
70
			int index = token.indexOf('=');
118
			int index = token.indexOf('=');
Lines 116-121 Link Here
116
164
117
	private static ICVSRepositoryLocation getRepository(URI uri) throws CVSException {
165
	private static ICVSRepositoryLocation getRepository(URI uri) throws CVSException {
118
		String authority = uri.getAuthority();
166
		String authority = uri.getAuthority();
167
		if (authority == null)
168
			return null;
119
		if (authority.indexOf('/') != -1)
169
		if (authority.indexOf('/') != -1)
120
			return null;
170
			return null;
121
		if (authority.indexOf('!') == -1)
171
		if (authority.indexOf('!') == -1)
Lines 123-135 Link Here
123
		authority = decodeAuthority(authority);
173
		authority = decodeAuthority(authority);
124
		return CVSRepositoryLocation.fromString(authority);
174
		return CVSRepositoryLocation.fromString(authority);
125
	}
175
	}
126
176
	
177
	private static String getProjectName(URI uri) {
178
		return null;
179
	}
180
	
127
	private static CVSTag getOldTag(URI uri) {
181
	private static CVSTag getOldTag(URI uri) {
128
		String f = uri.getFragment();
182
		String f = uri.getFragment();
129
		int i = f.indexOf(',');
183
		int i = f.indexOf(',');
130
		if (i == -1) {
184
		if (i == -1) {
131
			return CVSTag.DEFAULT;
185
			return CVSTag.DEFAULT;
132
		}
186
		}
187
		CVSTag tag = getTag(f.substring(i + 1));
188
		if (tag != null)
189
			return tag;
133
		
190
		
134
		return CVSTag.DEFAULT;//just use HEAD for now (name, CVSTag.BRANCH);
191
		return CVSTag.DEFAULT;//just use HEAD for now (name, CVSTag.BRANCH);
135
	}
192
	}
Lines 152-161 Link Here
152
	}
209
	}
153
	
210
	
154
	public CVSURI(ICVSRepositoryLocation repository, IPath path, CVSTag tag) {
211
	public CVSURI(ICVSRepositoryLocation repository, IPath path, CVSTag tag) {
155
		this(repository, path, tag, null);
212
		this(repository, path, tag, null, null);
156
	}
213
	}
157
	
214
	
158
	public CVSURI(ICVSRepositoryLocation repository, IPath path, CVSTag tag, String revision) {
215
	public CVSURI(ICVSRepositoryLocation repository, IPath path, CVSTag tag, String revision) {
216
		this(repository, path, tag, revision, null);
217
	}
218
	
219
	public CVSURI(ICVSRepositoryLocation repository, IPath path, CVSTag tag, String revision, String projectName) {
159
		this.repository = repository;
220
		this.repository = repository;
160
		this.path = path;
221
		this.path = path;
161
		this.tag = tag;
222
		this.tag = tag;
Lines 163-170 Link Here
163
			this.revision = revision;
224
			this.revision = revision;
164
		else
225
		else
165
			this.revision = null;
226
			this.revision = null;
227
		this.projectName = projectName;
166
	}
228
	}
167
229
	
168
	public CVSURI append(String name) {
230
	public CVSURI append(String name) {
169
		return new CVSURI(repository, path.append(name), tag);
231
		return new CVSURI(repository, path.append(name), tag);
170
	}
232
	}
Lines 197-203 Link Here
197
					query = query + "," + string; //$NON-NLS-1$
259
					query = query + "," + string; //$NON-NLS-1$
198
				}
260
				}
199
			}
261
			}
200
			return new URI(SCHEME, authority, pathString, query, null);
262
			return new URI(SCHEME_CVS, authority, pathString, query, null);
201
		} catch (URISyntaxException e) {
263
		} catch (URISyntaxException e) {
202
			CVSProviderPlugin.log(IStatus.ERROR, NLS.bind("An error occurred while creating a URI for {0} {1}", repository, path), e); //$NON-NLS-1$
264
			CVSProviderPlugin.log(IStatus.ERROR, NLS.bind("An error occurred while creating a URI for {0} {1}", repository, path), e); //$NON-NLS-1$
203
			throw new IllegalStateException(e.getMessage());
265
			throw new IllegalStateException(e.getMessage());
Lines 305-308 Link Here
305
	public String getRevision() {
367
	public String getRevision() {
306
		return revision;
368
		return revision;
307
	}
369
	}
370
	
371
	public String getProjectName() {
372
		return projectName;
373
	}
308
}
374
}
(-)src/org/eclipse/team/tests/ccvs/core/cvsresources/CVSURITest.java (-1 / +91 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 17-22 Link Here
17
import junit.framework.TestSuite;
17
import junit.framework.TestSuite;
18
18
19
import org.eclipse.team.internal.ccvs.core.CVSException;
19
import org.eclipse.team.internal.ccvs.core.CVSException;
20
import org.eclipse.team.internal.ccvs.core.CVSProjectSetCapability;
20
import org.eclipse.team.internal.ccvs.core.CVSTag;
21
import org.eclipse.team.internal.ccvs.core.CVSTag;
21
import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
22
import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
22
import org.eclipse.team.internal.ccvs.core.connection.CVSRepositoryLocation;
23
import org.eclipse.team.internal.ccvs.core.connection.CVSRepositoryLocation;
Lines 116-119 Link Here
116
		assertEquals(cvsUri.toURI(), uri);
117
		assertEquals(cvsUri.toURI(), uri);
117
	}
118
	}
118
	
119
	
120
	// CVS SCM URL tests, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=231190
121
	public void testRealLifeScmUriWithTag() throws CVSException {
122
		URI uri = URI.create("scm:cvs:pserver:dev.eclipse.org:/cvsroot/eclipse:org.eclipse.team.cvs.core;tag=I20100912-2000");
123
		CVSURI cvsUri = CVSURI.fromUri(uri);
124
		assertEquals("org.eclipse.team.cvs.core", cvsUri.getPath().toString());
125
		CVSRepositoryLocation location = CVSRepositoryLocation.fromString(":pserver:dev.eclipse.org:/cvsroot/eclipse");
126
		assertEquals(cvsUri.getRepository().getLocation(false), location.getLocation(false));
127
		assertEquals(cvsUri.getTag(), new CVSTag("I20100912-2000", CVSTag.VERSION));
128
		
129
		String refString = new CVSProjectSetCapability().asReference(uri, "org.eclipse.team.cvs.core");
130
		assertEquals("1.0,:pserver:dev.eclipse.org:/cvsroot/eclipse,org.eclipse.team.cvs.core,org.eclipse.team.cvs.core,I20100912-2000", refString);
131
	}
132
133
	public void testRealLifeScmUriWithVersion() throws URISyntaxException, CVSException {
134
		URI uri = new URI("scm:cvs:pserver:dev.eclipse.org:/cvsroot/eclipse:org.eclipse.team.cvs.core,version=I20100912-2000");
135
		CVSURI cvsUri = CVSURI.fromUri(uri);
136
		assertEquals("org.eclipse.team.cvs.core", cvsUri.getPath().toString());
137
		CVSRepositoryLocation location = CVSRepositoryLocation.fromString(":pserver:dev.eclipse.org:/cvsroot/eclipse");
138
		assertEquals(cvsUri.getRepository().getLocation(false), location.getLocation(false));
139
		assertEquals(cvsUri.getTag(), new CVSTag("I20100912-2000", CVSTag.VERSION));
140
		
141
		String refString = new CVSProjectSetCapability().asReference(uri, "org.eclipse.team.cvs.core");
142
		assertEquals("1.0,:pserver:dev.eclipse.org:/cvsroot/eclipse,org.eclipse.team.cvs.core,org.eclipse.team.cvs.core,I20100912-2000", refString);
143
	}
144
	
145
	public void testRealLifeScmUriWithProject() throws URISyntaxException, CVSException {
146
		URI uri = new URI("scm:cvs:pserver:dev.eclipse.org:/cvsroot/rt:org.eclipse.equinox/compendium/bundles/org.eclipse.equinox.http.jetty6;project=\"org.eclipse.equinox.http.jetty\";tag=v20100503");
147
		CVSURI cvsUri = CVSURI.fromUri(uri);
148
		assertEquals("org.eclipse.equinox/compendium/bundles/org.eclipse.equinox.http.jetty6", cvsUri.getPath().toString());
149
		CVSRepositoryLocation location = CVSRepositoryLocation.fromString(":pserver:dev.eclipse.org:/cvsroot/rt");
150
		assertEquals(cvsUri.getRepository().getLocation(false), location.getLocation(false));
151
		assertEquals(cvsUri.getTag(), new CVSTag("v20100503", CVSTag.VERSION));
152
		
153
		String refString = new CVSProjectSetCapability().asReference(uri, "org.eclipse.equinox.http.jetty6"); // last path segment
154
		assertEquals("1.0,:pserver:dev.eclipse.org:/cvsroot/rt,org.eclipse.equinox/compendium/bundles/org.eclipse.equinox.http.jetty6,org.eclipse.equinox.http.jetty,v20100503", refString);
155
	}
156
157
	public void testRealLifeScmUriWithoutTag() throws URISyntaxException, CVSException {
158
		URI uri = new URI("scm:cvs:pserver:dev.eclipse.org:/cvsroot/eclipse:org.eclipse.team.cvs.core");
159
		CVSURI cvsUri = CVSURI.fromUri(uri);
160
		assertEquals("org.eclipse.team.cvs.core", cvsUri.getPath().toString());
161
		CVSRepositoryLocation location = CVSRepositoryLocation.fromString(":pserver:dev.eclipse.org:/cvsroot/eclipse");
162
		assertEquals(cvsUri.getRepository().getLocation(false), location.getLocation(false));
163
		assertEquals(cvsUri.getTag(), CVSTag.DEFAULT);
164
		
165
		String refString = new CVSProjectSetCapability().asReference(uri, "org.eclipse.team.cvs.core");
166
		assertEquals("1.0,:pserver:dev.eclipse.org:/cvsroot/eclipse,org.eclipse.team.cvs.core,org.eclipse.team.cvs.core", refString);
167
	}
168
	
169
	// Example CVS SCM URIs from http://maven.apache.org/scm/cvs.html 
170
	public void testMavenScmUriExampleWithEmptyPassword() throws URISyntaxException, CVSException {
171
		URI uri = new URI("scm:cvs:pserver:anoncvs:@cvs.apache.org:/cvs/root:module");
172
		CVSURI cvsUri = CVSURI.fromUri(uri);
173
		assertEquals("module", cvsUri.getPath().toString());
174
		CVSRepositoryLocation location = CVSRepositoryLocation.fromString(":pserver:anoncvs:@cvs.apache.org:/cvs/root");
175
		assertEquals(cvsUri.getRepository().getLocation(false), location.getLocation(false));
176
		assertEquals(cvsUri.getTag(), CVSTag.DEFAULT);
177
		
178
		String refString = new CVSProjectSetCapability().asReference(uri, "module");
179
		assertEquals("1.0,:pserver:anoncvs:@cvs.apache.org:/cvs/root,module,module", refString);
180
	}
181
	
182
	// pipes not supported yet
183
	/*
184
	public void testMavenScmUriExampleWithPipe() throws CVSException, URISyntaxException {
185
		URI uri = new URI("scm:cvs|pserver|username@localhost|C:/Program Files/cvsnt/repositories|module_name");
186
		CVSURI cvsUri = CVSURI.fromUri(uri);
187
		assertEquals("module_name", cvsUri.getPath().toString());
188
		CVSRepositoryLocation location = CVSRepositoryLocation.fromString(":pserver:username@localhost:C:/Program Files/cvsnt/repositories");
189
		assertEquals(cvsUri.getRepository().getLocation(false), location.getLocation(false));
190
		assertEquals(cvsUri.getTag(), CVSTag.DEFAULT);
191
		
192
		String refString = new CVSProjectSetCapability().asReference(uri, "module_name");
193
		assertEquals("1.0,:pserver:anoncvs:@cvs.apache.org:/cvs/root,C:/Program Files/cvsnt/repositories,module_name", refString);
194
	}	
195
	*/
196
197
	public void testMavenScmUriExample() throws URISyntaxException, CVSException {
198
		URI uri = new URI("scm:cvs:ext:username@cvs.apache.org:/cvs/root:module");
199
		CVSURI cvsUri = CVSURI.fromUri(uri);
200
		assertEquals("module", cvsUri.getPath().toString());
201
		CVSRepositoryLocation location = CVSRepositoryLocation.fromString(":ext:username@cvs.apache.org:/cvs/root");
202
		assertEquals(cvsUri.getRepository().getLocation(false), location.getLocation(false));
203
		assertEquals(cvsUri.getTag(), CVSTag.DEFAULT);
204
		
205
		String refString = new CVSProjectSetCapability().asReference(uri, "module");
206
		assertEquals("1.0,:ext:username@cvs.apache.org:/cvs/root,module,module", refString);
207
	}
208
119
}
209
}

Return to bug 326926