Skip to main content

This CGIT instance is deprecated, and repositories have been moved to Gitlab or Github. See the repository descriptions for specific locations.

summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorjeffliu2005-10-05 20:00:33 +0000
committerjeffliu2005-10-05 20:00:33 +0000
commit873a2087548a7fc1ebeb787f243f7f95e1915b6f (patch)
treedb18d44c4758d475664865792e193aa0e9356042 /tests
parenta9fa25e3b77523372b292d4d5548ec08788cbd5e (diff)
downloadwebtools.webservices-873a2087548a7fc1ebeb787f243f7f95e1915b6f.tar.gz
webtools.webservices-873a2087548a7fc1ebeb787f243f7f95e1915b6f.tar.xz
webtools.webservices-873a2087548a7fc1ebeb787f243f7f95e1915b6f.zip
[110070] Need new WSDL validation performance test case
Diffstat (limited to 'tests')
-rw-r--r--tests/org.eclipse.wst.wsdl.tests.performance/performance/org/eclipse/wst/wsdl/tests/performance/ValidateWSDLProjectTestCase.java127
-rw-r--r--tests/org.eclipse.wst.wsdl.tests.performance/plugin.xml2
-rw-r--r--tests/org.eclipse.wst.wsdl.tests.performance/test.xml2
3 files changed, 130 insertions, 1 deletions
diff --git a/tests/org.eclipse.wst.wsdl.tests.performance/performance/org/eclipse/wst/wsdl/tests/performance/ValidateWSDLProjectTestCase.java b/tests/org.eclipse.wst.wsdl.tests.performance/performance/org/eclipse/wst/wsdl/tests/performance/ValidateWSDLProjectTestCase.java
new file mode 100644
index 000000000..6d3e69a60
--- /dev/null
+++ b/tests/org.eclipse.wst.wsdl.tests.performance/performance/org/eclipse/wst/wsdl/tests/performance/ValidateWSDLProjectTestCase.java
@@ -0,0 +1,127 @@
+/**********************************************************************
+ * Copyright (c) 2004 IBM Corporation and others.
+ * All rights reserved.   This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.wst.wsdl.tests.performance;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+
+import junit.framework.Assert;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.IWorkspaceRunnable;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.test.performance.Dimension;
+import org.eclipse.test.performance.PerformanceTestCase;
+import org.eclipse.wst.validation.internal.operations.OneValidatorOperation;
+import org.eclipse.wst.ws.internal.ui.plugin.WSUIPlugin;
+import org.eclipse.wst.ws.internal.ui.wsi.preferences.PersistentWSIContext;
+
+/**
+ * Test for validation of 50 WSDL files in the sample workspace.
+ *
+ * @author Kihup Boo, IBM
+ */
+public class ValidateWSDLProjectTestCase extends PerformanceTestCase {
+
+ public static Test suite() {
+ return new TestSuite(ValidateWSDLProjectTestCase.class, "Test");
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see junit.framework.TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ // Set the WS-I preference to ignore so WS-I validation will not be run.
+ WSUIPlugin wsui = WSUIPlugin.getInstance();
+ PersistentWSIContext wsicontext = wsui.getWSISSBPContext();
+ wsicontext.updateWSICompliances(PersistentWSIContext.IGNORE_NON_WSI);
+ }
+
+ public void testWSDLProjectValidation() throws Exception {
+ String projectDir = System.getProperty("projectDir");
+ Assert.assertNotNull(projectDir);
+ if (!projectDir.endsWith("/") && !projectDir.endsWith("\\"))
+ projectDir = projectDir + "/";
+ File dir = new File(projectDir);
+ if (dir.exists() && dir.isDirectory()) {
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject("WSDLProject");
+ project.create(null);
+ project.open(null);
+ copy(dir, project);
+ joinBackgroundJobs();
+
+ IWorkspaceRunnable myRunnable = new OneValidatorOperation(
+ project,
+ "org.eclipse.wst.wsdl.validation.internal.ui.eclipse.Validator",
+ true,
+ false);
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+
+ tagAsSummary("Validate WSDL Project", new Dimension[] {Dimension.ELAPSED_PROCESS, Dimension.WORKING_SET });
+ startMeasuring();
+ workspace.run(myRunnable, null);
+ // project.build(IncrementalProjectBuilder.CLEAN_BUILD,null);
+ stopMeasuring();
+ commitMeasurements();
+ assertPerformance();
+ } else
+ fail(dir.toString());
+ }
+
+ private void copy(File src, IContainer dest) throws CoreException,
+ FileNotFoundException {
+ File[] children = src.listFiles();
+ for (int i = 0; i < children.length; i++) {
+ String name = children[i].getName();
+ if (children[i].isDirectory()) {
+ IFolder folder = dest.getFolder(new Path(name));
+ folder.create(true, true, null);
+ copy(children[i], folder);
+ } else {
+ IFile file = dest.getFile(new Path(name));
+ file.create(new FileInputStream(children[i]), true, null);
+ }
+ }
+ }
+
+ private void joinBackgroundJobs() {
+ Display.getDefault().syncExec(new Runnable() {
+ public void run() {
+ try {
+ Platform.getJobManager().join(
+ ResourcesPlugin.FAMILY_AUTO_BUILD, null);
+ } catch (InterruptedException e) {
+ }
+ long start = System.currentTimeMillis();
+ Display display = Display.getDefault();
+ while (System.currentTimeMillis() - start < 5000) {
+ if (!display.readAndDispatch()) {
+ display.sleep();
+ }
+ }
+ }
+ });
+ }
+}
diff --git a/tests/org.eclipse.wst.wsdl.tests.performance/plugin.xml b/tests/org.eclipse.wst.wsdl.tests.performance/plugin.xml
index de18786f5..dbcfd3277 100644
--- a/tests/org.eclipse.wst.wsdl.tests.performance/plugin.xml
+++ b/tests/org.eclipse.wst.wsdl.tests.performance/plugin.xml
@@ -21,6 +21,8 @@
<import plugin="org.eclipse.ui"/>
<import plugin="org.eclipse.ui.ide"/>
<import plugin="org.eclipse.test.performance"/>
+ <import plugin="org.eclipse.wst.validation"/>
+ <import plugin="org.eclipse.wst.common.frameworks"/>
<import plugin="org.eclipse.wst.wsdl"/>
<import plugin="org.eclipse.wst.wsdl.validation"/>
<import plugin="org.wsdl4j"/>
diff --git a/tests/org.eclipse.wst.wsdl.tests.performance/test.xml b/tests/org.eclipse.wst.wsdl.tests.performance/test.xml
index 39404640a..4f002f95b 100644
--- a/tests/org.eclipse.wst.wsdl.tests.performance/test.xml
+++ b/tests/org.eclipse.wst.wsdl.tests.performance/test.xml
@@ -9,7 +9,7 @@
<property name="plugin-name" value="org.eclipse.wst.wsdl.tests.performance"/>
<property name="library-file" value="${eclipse-home}/plugins/org.eclipse.test_3.1.0/library.xml"/>
<property name="perf-tests-file" value="${testDir}/performance-tests.xml"/>
- <property name="extraVMargs" value="-Doagis80Dir=${testDir} -Xmx256M"/>
+ <property name="extraVMargs" value="-Doagis80Dir=${testDir} -DprojectDir=${testDir}/OAGIS8.0 -Xmx256M"/>
<property name="workspace" value="${eclipse-home}/workspace_wsdl_performance"/>

Back to the top