Skip to main content
summaryrefslogtreecommitdiffstats
blob: 222cbb7e0d3f30aae4809835b331dde66f97a182 (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
71
72
73
74
package org.eclipse.wst.xml.catalog.tests.internal;


public class CatalogResolverTest extends AbstractCatalogTest {

	protected void setUp() throws Exception {
		super.setUp();
	}

	protected void tearDown() throws Exception {
		super.tearDown();
	}

	public CatalogResolverTest(String name) {
		super(name);
	}

	public final void testResolveResolver() throws Exception {
	
	
		// from plugin.xml file
		String pluginBase = resolvePluginLocation(TestPlugin.getDefault().getBundle().getSymbolicName()).toString();

		String resolvedActual = defaultCatalog.resolvePublic("InvoiceId_test", null);
		String resolvedURI = makeAbsolute(pluginBase, "data/Invoice/Invoice.dtd");
		assertEquals(resolvedURI, resolvedActual);
		resolvedActual = defaultCatalog.resolveSystem("http://personal/personal.dtd");
		resolvedURI = makeAbsolute(pluginBase, "data/Personal/personal.dtd");
		assertEquals(resolvedURI, resolvedActual);
		resolvedActual = defaultCatalog.resolveURI("http://apache.org/xml/xcatalog/example");
		resolvedURI = makeAbsolute(pluginBase, "data/example/example.xsd");
		assertEquals(resolvedURI, resolvedActual);
		resolvedActual = defaultCatalog.resolveURI("http://www.w3.org/2001/XMLSchema");
		resolvedURI = resolvePath("", "platform:/plugin/org.eclipse.xsd/cache/www.w3.org/2001/XMLSchema.xsd");
		resolvedURI = makeAbsolute(pluginBase, resolvedURI);
		assertEquals(resolvedURI, resolvedActual);
		
		// from catalog1.xml
		resolvedActual = defaultCatalog.resolvePublic("InvoiceId_test", null);
		resolvedURI = makeAbsolute(pluginBase, "data/Invoice/Invoice.dtd");
		assertEquals(resolvedURI, resolvedActual);

		resolvedActual = defaultCatalog.resolveSystem("Invoice.dtd");
		resolvedURI = makeAbsolute(pluginBase, "data/Invoice/Invoice.dtd");
		assertEquals(resolvedURI, resolvedActual);

		resolvedActual = defaultCatalog.resolveURI("http://www.test.com/Invoice.dtd");
		resolvedURI = makeAbsolute(pluginBase, "data/Invoice/Invoice.dtd");
		assertEquals(resolvedURI, resolvedActual);

		
		// from catalog2.xml
		resolvedActual = defaultCatalog.resolvePublic("http://www.eclipse.org/webtools/Catalogue_001", null);
		resolvedURI = makeAbsolute(pluginBase, "data/PublicationCatalog/Catalogue.xsd");
		assertEquals(resolvedURI, resolvedActual);
		
		resolvedActual = defaultCatalog.resolvePublic("http://www.eclipse.org/webtools/Catalogue_002", null);
		resolvedURI = makeAbsolute(pluginBase, "data/PublicationCatalog/Catalogue.xsd");
		assertEquals(resolvedURI, resolvedActual);

		resolvedActual = defaultCatalog.resolveSystem("Catalogue.xsd");
		resolvedURI = makeAbsolute(pluginBase, "data/PublicationCatalog/Catalogue.xsd");
		assertEquals(resolvedURI, resolvedActual);

		resolvedActual = defaultCatalog.resolveURI("http://Catalogue.xsd");
		resolvedURI = "http://www.eclipse.org/webtools/Catalogue.xsd";
		assertEquals(resolvedURI, resolvedURI);


	}



}

Back to the top