Skip to main content
summaryrefslogtreecommitdiffstats
blob: e369416f5052ec6b350b55af77497a94a72dba54 (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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/*******************************************************************************
 * Copyright (c) 2009, 2016 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.ua.tests.doc.internal.linkchecker;

import static org.junit.Assert.assertNotNull;

import java.net.URL;

import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.junit.Test;
import org.osgi.framework.Bundle;

public class PrebuiltIndexChecker {

	private static final String PLATFORM_USER = "org.eclipse.platform.doc.user";
	private static final String PLATFORM_ISV = "org.eclipse.platform.doc.isv";
	private static final String PDE_USER = "org.eclipse.pde.doc.user";
	private static final String JDT_USER = "org.eclipse.jdt.doc.user";
	private static final String JDT_ISV = "org.eclipse.jdt.doc.isv";

	@Test
	public void testPlatformUserIndex() {
		validateIndex(PLATFORM_USER, "index");
	}

	@Test
	public void testPlatformIsvIndex() {
		validateIndex(PLATFORM_ISV, "index");
	}

	@Test
	public void testPdeUserIndex() {
		validateIndex(PDE_USER, "index");
	}

	@Test
	public void testJdtUserIndex() {
		validateIndex(JDT_USER, "index");
	}

	@Test
	public void testJdtIsvIndex() {
		validateIndex(JDT_ISV, "index");
	}

	private void validateIndex(String plugin, String filepath) {
		Bundle bundle = Platform.getBundle(plugin);
		assertNotNull(bundle);

		String[] suffixes = { "", "/indexed_contributions", "/indexed_docs", "/indexed_dependencies" };
		for (String suffixe : suffixes) {
			String fullPath = filepath + suffixe;
			IPath path = new Path(fullPath);
			URL url = FileLocator.find(bundle, path, null);
			assertNotNull("could not open: " + fullPath, url);
		}
	}

}

Back to the top