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

Collapse All | Expand All

(-)src/org/eclipse/equinox/p2/tests/artifact/repository/ArtifactRepositoryManagerTest.java (+22 lines)
Lines 129-134 Link Here
129
		assertTrue("1.0", manager.contains(location));
129
		assertTrue("1.0", manager.contains(location));
130
	}
130
	}
131
131
132
	public void testNickname() throws ProvisionException {
133
		File site = getTestData("Repository", "/testData/artifactRepo/simple/");
134
		URI location = site.toURI();
135
		manager.addRepository(location);
136
		String nick = manager.getRepositoryProperty(location, IRepository.PROP_NICKNAME);
137
		assertNull(nick);
138
		nick = "Nick";
139
		manager.setRepositoryProperty(location, IRepository.PROP_NICKNAME, nick);
140
		nick = manager.getRepositoryProperty(location, IRepository.PROP_NICKNAME);
141
		assertEquals("Nick", nick);
142
		//ensure loading the repository doesn't affect the nickname
143
		manager.loadRepository(location, getMonitor());
144
		nick = manager.getRepositoryProperty(location, IRepository.PROP_NICKNAME);
145
		assertEquals("Nick", nick);
146
147
		//remove and re-add the repository should lose the nickname
148
		manager.removeRepository(location);
149
		manager.loadRepository(location, getMonitor());
150
		nick = manager.getRepositoryProperty(location, IRepository.PROP_NICKNAME);
151
		assertNull(nick);
152
	}
153
132
	public void testPathWithSpaces() {
154
	public void testPathWithSpaces() {
133
		File site = getTestData("Repository", "/testData/artifactRepo/simple with spaces/");
155
		File site = getTestData("Repository", "/testData/artifactRepo/simple with spaces/");
134
		URI location = site.toURI();
156
		URI location = site.toURI();
(-)src/org/eclipse/equinox/p2/tests/metadata/repository/MetadataRepositoryManagerTest.java (+22 lines)
Lines 311-316 Link Here
311
		cacheFile.delete();
311
		cacheFile.delete();
312
	}
312
	}
313
313
314
	public void testNickname() throws ProvisionException {
315
		File site = getTestData("Repositoy", "/testData/metadataRepo/good/");
316
		URI location = site.toURI();
317
		manager.addRepository(location);
318
		String nick = manager.getRepositoryProperty(location, IRepository.PROP_NICKNAME);
319
		assertNull(nick);
320
		nick = "Nick";
321
		manager.setRepositoryProperty(location, IRepository.PROP_NICKNAME, nick);
322
		nick = manager.getRepositoryProperty(location, IRepository.PROP_NICKNAME);
323
		assertEquals("Nick", nick);
324
		//ensure loading the repository doesn't affect the nickname
325
		manager.loadRepository(location, getMonitor());
326
		nick = manager.getRepositoryProperty(location, IRepository.PROP_NICKNAME);
327
		assertEquals("Nick", nick);
328
329
		//remove and re-add the repository should lose the nickname
330
		manager.removeRepository(location);
331
		manager.loadRepository(location, getMonitor());
332
		nick = manager.getRepositoryProperty(location, IRepository.PROP_NICKNAME);
333
		assertNull(nick);
334
	}
335
314
	public void testPathWithSpaces() {
336
	public void testPathWithSpaces() {
315
		File site = getTestData("Repository", "/testData/metadataRepo/good with spaces/");
337
		File site = getTestData("Repository", "/testData/metadataRepo/good with spaces/");
316
		URI location = site.toURI();
338
		URI location = site.toURI();
(-)src/org/eclipse/equinox/internal/provisional/p2/core/repository/IRepository.java (+7 lines)
Lines 42-47 Link Here
42
	public static final String PROP_NAME = "name"; //$NON-NLS-1$
42
	public static final String PROP_NAME = "name"; //$NON-NLS-1$
43
43
44
	/**
44
	/**
45
	 * The key for a string property providing a user-defined name for the repository.
46
	 * This property is never stored in the repository itself, but is instead tracked and managed
47
	 * by an {@link IRepositoryManager}.
48
	 */
49
	public static final String PROP_NICKNAME = "p2.nickname"; //$NON-NLS-1$
50
51
	/**
45
	 * The key for a string property providing a human-readable description for the repository.
52
	 * The key for a string property providing a human-readable description for the repository.
46
	 */
53
	 */
47
	public static final String PROP_DESCRIPTION = "description"; //$NON-NLS-1$
54
	public static final String PROP_DESCRIPTION = "description"; //$NON-NLS-1$
(-)src/org/eclipse/equinox/internal/p2/core/helpers/AbstractRepositoryManager.java (-5 / +13 lines)
Lines 34-39 Link Here
34
		public boolean isSystem = false;
34
		public boolean isSystem = false;
35
		public URI location;
35
		public URI location;
36
		public String name;
36
		public String name;
37
		public String nickname;
37
		public SoftReference repository;
38
		public SoftReference repository;
38
		public String suffix;
39
		public String suffix;
39
40
Lines 48-53 Link Here
48
	public static final String KEY_DESCRIPTION = "description"; //$NON-NLS-1$
49
	public static final String KEY_DESCRIPTION = "description"; //$NON-NLS-1$
49
	public static final String KEY_ENABLED = "enabled"; //$NON-NLS-1$
50
	public static final String KEY_ENABLED = "enabled"; //$NON-NLS-1$
50
	public static final String KEY_NAME = "name"; //$NON-NLS-1$
51
	public static final String KEY_NAME = "name"; //$NON-NLS-1$
52
	public static final String KEY_NICKNAME = "nickname"; //$NON-NLS-1$
51
	public static final String KEY_PROVIDER = "provider"; //$NON-NLS-1$
53
	public static final String KEY_PROVIDER = "provider"; //$NON-NLS-1$
52
	public static final String KEY_SUFFIX = "suffix"; //$NON-NLS-1$
54
	public static final String KEY_SUFFIX = "suffix"; //$NON-NLS-1$
53
	public static final String KEY_SYSTEM = "isSystem"; //$NON-NLS-1$
55
	public static final String KEY_SYSTEM = "isSystem"; //$NON-NLS-1$
Lines 491-500 Link Here
491
				return null;// Repository not found
493
				return null;// Repository not found
492
			if (IRepository.PROP_DESCRIPTION.equals(key))
494
			if (IRepository.PROP_DESCRIPTION.equals(key))
493
				return info.description;
495
				return info.description;
494
			if (IRepository.PROP_NAME.equals(key))
496
			else if (IRepository.PROP_NAME.equals(key))
495
				return info.name;
497
				return info.name;
496
			if (IRepository.PROP_SYSTEM.equals(key))
498
			else if (IRepository.PROP_SYSTEM.equals(key))
497
				return Boolean.toString(info.isSystem);
499
				return Boolean.toString(info.isSystem);
500
			else if (IRepository.PROP_NICKNAME.equals(key))
501
				return info.nickname;
498
			// Key not known, return null
502
			// Key not known, return null
499
			return null;
503
			return null;
500
		}
504
		}
Lines 512-521 Link Here
512
				return;// Repository not found
516
				return;// Repository not found
513
			if (IRepository.PROP_DESCRIPTION.equals(key))
517
			if (IRepository.PROP_DESCRIPTION.equals(key))
514
				info.description = value;
518
				info.description = value;
515
			if (IRepository.PROP_NAME.equals(key))
519
			else if (IRepository.PROP_NAME.equals(key))
516
				info.name = value;
520
				info.name = value;
517
			if (IRepository.PROP_SYSTEM.equals(key))
521
			else if (IRepository.PROP_NICKNAME.equals(key))
518
				//only true is value.equals("true") which is OK because a repository is only system if it's explicitly set to system.
522
				info.nickname = value;
523
			else if (IRepository.PROP_SYSTEM.equals(key))
524
				//only true if value.equals("true") which is OK because a repository is only system if it's explicitly set to system.
519
				info.isSystem = Boolean.valueOf(value).booleanValue();
525
				info.isSystem = Boolean.valueOf(value).booleanValue();
520
			// Key not known
526
			// Key not known
521
		}
527
		}
Lines 712-717 Link Here
712
		changed |= putValue(node, KEY_SYSTEM, Boolean.toString(info.isSystem));
718
		changed |= putValue(node, KEY_SYSTEM, Boolean.toString(info.isSystem));
713
		changed |= putValue(node, KEY_DESCRIPTION, info.description);
719
		changed |= putValue(node, KEY_DESCRIPTION, info.description);
714
		changed |= putValue(node, KEY_NAME, info.name);
720
		changed |= putValue(node, KEY_NAME, info.name);
721
		changed |= putValue(node, KEY_NICKNAME, info.nickname);
715
		changed |= putValue(node, KEY_SUFFIX, info.suffix);
722
		changed |= putValue(node, KEY_SUFFIX, info.suffix);
716
		changed |= putValue(node, KEY_ENABLED, Boolean.toString(info.isEnabled));
723
		changed |= putValue(node, KEY_ENABLED, Boolean.toString(info.isEnabled));
717
		if (changed && flush)
724
		if (changed && flush)
Lines 788-793 Link Here
788
			RepositoryInfo info = new RepositoryInfo();
795
			RepositoryInfo info = new RepositoryInfo();
789
			info.location = location;
796
			info.location = location;
790
			info.name = child.get(KEY_NAME, null);
797
			info.name = child.get(KEY_NAME, null);
798
			info.nickname = child.get(KEY_NICKNAME, null);
791
			info.description = child.get(KEY_DESCRIPTION, null);
799
			info.description = child.get(KEY_DESCRIPTION, null);
792
			info.isSystem = child.getBoolean(KEY_SYSTEM, false);
800
			info.isSystem = child.getBoolean(KEY_SYSTEM, false);
793
			info.isEnabled = child.getBoolean(KEY_ENABLED, true);
801
			info.isEnabled = child.getBoolean(KEY_ENABLED, true);

Return to bug 259598