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

Collapse All | Expand All

(-)src/org/eclipse/equinox/internal/p2/repository/helpers/AbstractRepositoryManager.java (+3 lines)
Lines 177-182 Link Here
177
		checkValidLocation(location);
177
		checkValidLocation(location);
178
		clearNotFound(location);
178
		clearNotFound(location);
179
		boolean wasEnabled = isEnabled(location);
179
		boolean wasEnabled = isEnabled(location);
180
		String nick = getRepositoryProperty(location, IRepository.PROP_NICKNAME);
180
		//remove the repository so  event is broadcast and repositories can clear their caches
181
		//remove the repository so  event is broadcast and repositories can clear their caches
181
		if (!removeRepository(location))
182
		if (!removeRepository(location))
182
			fail(location, ProvisionException.REPOSITORY_NOT_FOUND);
183
			fail(location, ProvisionException.REPOSITORY_NOT_FOUND);
Lines 190-195 Link Here
190
			//if we failed to load, make sure the repository is not lost
191
			//if we failed to load, make sure the repository is not lost
191
			if (!loaded)
192
			if (!loaded)
192
				addRepository(location, wasEnabled, true);
193
				addRepository(location, wasEnabled, true);
194
			if (nick != null)
195
				setRepositoryProperty(location, IRepository.PROP_NICKNAME, nick);
193
		}
196
		}
194
	}
197
	}
195
198
(-)src/org/eclipse/equinox/p2/tests/artifact/repository/ArtifactRepositoryManagerTest.java (+20 lines)
Lines 166-171 Link Here
166
	}
166
	}
167
167
168
	/**
168
	/**
169
	 * Tests for {@link IMetadataRepositoryManager#refreshRepository(URI, org.eclipse.core.runtime.IProgressMonitor)}.
170
	 */
171
	public void testRefresh() throws ProvisionException {
172
		File site = getTestData("Repositoy", "/testData/artifactRepo/simple/");
173
		URI location = site.toURI();
174
		manager.addRepository(location);
175
		manager.refreshRepository(location, getMonitor());
176
		assertTrue("1.0", manager.contains(location));
177
		assertTrue("1.1", manager.isEnabled(location));
178
179
		//tests that refreshing doesn't lose repository properties
180
		manager.setEnabled(location, false);
181
		manager.setRepositoryProperty(location, IRepository.PROP_NICKNAME, "MyNick");
182
		manager.refreshRepository(location, getMonitor());
183
		assertTrue("2.0", manager.contains(location));
184
		assertFalse("2.1", manager.isEnabled(location));
185
		assertEquals("2.2", "MyNick", manager.getRepositoryProperty(location, IRepository.PROP_NICKNAME));
186
	}
187
188
	/**
169
	 * Tests for {@link IRepositoryManager#setRepositoryProperty}.
189
	 * Tests for {@link IRepositoryManager#setRepositoryProperty}.
170
	 */
190
	 */
171
	public void testSetRepositoryProperty() {
191
	public void testSetRepositoryProperty() {
(-)src/org/eclipse/equinox/p2/tests/metadata/repository/MetadataRepositoryManagerTest.java (+20 lines)
Lines 389-394 Link Here
389
	}
389
	}
390
390
391
	/**
391
	/**
392
	 * Tests for {@link IMetadataRepositoryManager#refreshRepository(URI, org.eclipse.core.runtime.IProgressMonitor)}.
393
	 */
394
	public void testRefresh() throws ProvisionException {
395
		File site = getTestData("Repositoy", "/testData/metadataRepo/good/");
396
		URI location = site.toURI();
397
		manager.addRepository(location);
398
		manager.refreshRepository(location, getMonitor());
399
		assertTrue("1.0", manager.contains(location));
400
		assertTrue("1.1", manager.isEnabled(location));
401
402
		//tests that refreshing doesn't lose repository properties
403
		manager.setEnabled(location, false);
404
		manager.setRepositoryProperty(location, IRepository.PROP_NICKNAME, "MyNick");
405
		manager.refreshRepository(location, getMonitor());
406
		assertTrue("2.0", manager.contains(location));
407
		assertFalse("2.1", manager.isEnabled(location));
408
		assertEquals("2.2", "MyNick", manager.getRepositoryProperty(location, IRepository.PROP_NICKNAME));
409
	}
410
411
	/**
392
	 * Repository references were originally encoded as URL, but we now encode
412
	 * Repository references were originally encoded as URL, but we now encode
393
	 * as URI. This test ensures we handle both old and new references.
413
	 * as URI. This test ensures we handle both old and new references.
394
	 */
414
	 */

Return to bug 275479