Skip to main content
summaryrefslogtreecommitdiffstats
blob: 1948e5a8710aa19275239fbb244b25eca76b01b8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*******************************************************************************
 * Copyright (c) 2009 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * 
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.equinox.p2.tests.ui.repohandling;

import java.io.File;
import org.eclipse.equinox.internal.p2.ui.UpdateManagerCompatibility;
import org.eclipse.equinox.internal.p2.ui.model.MetadataRepositoryElement;
import org.eclipse.equinox.p2.tests.ui.AbstractProvisioningUITest;

public class SiteImportExportTest extends AbstractProvisioningUITest {
	public void testUpdateManagerImport() {
		int siteCount;
		File bookmarks = getTestData("Getting site bookmarks", "/testData/siteBookmarks/siteexport33.xml/");
		MetadataRepositoryElement[] elements = UpdateManagerCompatibility.readBookmarkFile(bookmarks);
		siteCount = elements.length;
		assertNotNull("1.0", elements);
		assertTrue("1.1", siteCount > 0);
		MetadataRepositoryElement element = elements[0];
		element.setNickname("Foo");

		File folder = getTempFolder();
		File testExport = new File(folder, "testExport.xml");
		UpdateManagerCompatibility.writeBookmarkFile(testExport.getAbsolutePath(), elements);

		elements = UpdateManagerCompatibility.readBookmarkFile(testExport);
		assertEquals("1.2", siteCount, elements.length);
		assertEquals("1.3", elements[0].getName(), "Foo");
	}
}

Back to the top