01: /*******************************************************************************
02: * Copyright (c) 2007 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.pde.ui.tests.performance.parts;
11:
12: import java.io.InputStream;
13:
14: import junit.framework.Test;
15: import junit.framework.TestSuite;
16:
17: import org.eclipse.pde.internal.core.XMLDefaultHandler;
18: import org.eclipse.pde.internal.core.schema.EditableSchema;
19: import org.eclipse.pde.internal.core.util.SAXParserWrapper;
20: import org.eclipse.pde.internal.core.util.SchemaUtil;
21: import org.eclipse.test.performance.Dimension;
22:
23: /**
24: * SchemaLoaderPerfTest
25: *
26: */
27: public class SchemaTraversePerfTest extends AbstractSchemaPerfTest {
28:
29: /**
30: * @return
31: */
32: public static Test suite() {
33: return new TestSuite(SchemaTraversePerfTest.class);
34: }
35:
36: /* (non-Javadoc)
37: * @see org.eclipse.pde.ui.tests.performance.parts.AbstractSchemaPerfTest#setUpIterations()
38: */
39: protected void setUpIterations() {
40: fTestIterations = 5;
41: fWarmupIterations = 50;
42: fRuns = 3000;
43: }
44:
45: /**
46: * @throws Exception
47: */
48: public void testSchemaTraverse() throws Exception {
49: tagAsSummary(
50: "Show hover info in manifest editor", Dimension.ELAPSED_PROCESS); //$NON-NLS-1$
51: executeTestRun();
52: }
53:
54: /* (non-Javadoc)
55: * @see org.eclipse.pde.ui.tests.performance.parts.AbstractSchemaPerfTest#executeTest()
56: */
57: protected void executeTest() throws Exception {
58: InputStream input = null;
59: input = SchemaUtil.getInputStream(fXSDFile.toURL());
60: SAXParserWrapper parser = new SAXParserWrapper();
61: XMLDefaultHandler handler = new XMLDefaultHandler(true);
62: parser.parse(input, handler);
63: if (input != null) {
64: input.close();
65: }
66: EditableSchema schema = new EditableSchema("pluginID",
67: "pointID", "name", true);
68: schema.traverseDocumentTree(handler.getDocumentElement());
69: }
70:
71: }
|