Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'tests/org.eclipse.jst.ws.tests/tests/org')
-rw-r--r--tests/org.eclipse.jst.ws.tests/tests/org/eclipse/jst/ws/tests/WSWizardTest.java206
-rw-r--r--tests/org.eclipse.jst.ws.tests/tests/org/eclipse/jst/ws/tests/axis/tomcat/v50/WSWizardTomcat50Test.java41
-rw-r--r--tests/org.eclipse.jst.ws.tests/tests/org/eclipse/jst/ws/tests/plugin/TestsPlugin.java81
-rw-r--r--tests/org.eclipse.jst.ws.tests/tests/org/eclipse/jst/ws/tests/unittest/AllWSJUnitTests.java99
-rw-r--r--tests/org.eclipse.jst.ws.tests/tests/org/eclipse/jst/ws/tests/unittest/ComponentCreationTests.java117
-rw-r--r--tests/org.eclipse.jst.ws.tests/tests/org/eclipse/jst/ws/tests/unittest/J2EEUtilsTests.java205
-rw-r--r--tests/org.eclipse.jst.ws.tests/tests/org/eclipse/jst/ws/tests/unittest/LaunchTest.java33
-rw-r--r--tests/org.eclipse.jst.ws.tests/tests/org/eclipse/jst/ws/tests/unittest/ResourceUtilsTests.java100
-rw-r--r--tests/org.eclipse.jst.ws.tests/tests/org/eclipse/jst/ws/tests/unittest/ServerCreationTests.java66
-rw-r--r--tests/org.eclipse.jst.ws.tests/tests/org/eclipse/jst/ws/tests/unittest/WSJUnitConstants.java46
-rw-r--r--tests/org.eclipse.jst.ws.tests/tests/org/eclipse/jst/ws/tests/unittest/WebServiceRuntimeTests.java529
-rw-r--r--tests/org.eclipse.jst.ws.tests/tests/org/eclipse/jst/ws/tests/util/AccumulateStatusHandler.java100
-rw-r--r--tests/org.eclipse.jst.ws.tests/tests/org/eclipse/jst/ws/tests/util/DynamicPopupJUnitWizard.java67
-rw-r--r--tests/org.eclipse.jst.ws.tests/tests/org/eclipse/jst/ws/tests/util/JUnitUtils.java358
-rw-r--r--tests/org.eclipse.jst.ws.tests/tests/org/eclipse/jst/ws/tests/util/ScenarioConstants.java45
15 files changed, 0 insertions, 2093 deletions
diff --git a/tests/org.eclipse.jst.ws.tests/tests/org/eclipse/jst/ws/tests/WSWizardTest.java b/tests/org.eclipse.jst.ws.tests/tests/org/eclipse/jst/ws/tests/WSWizardTest.java
deleted file mode 100644
index 3d8402a94..000000000
--- a/tests/org.eclipse.jst.ws.tests/tests/org/eclipse/jst/ws/tests/WSWizardTest.java
+++ /dev/null
@@ -1,206 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 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.jst.ws.tests;
-
-import junit.framework.TestCase;
-
-import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jst.ws.tests.unittest.WSJUnitConstants;
-import org.eclipse.jst.ws.tests.util.JUnitUtils;
-import org.eclipse.wst.command.internal.env.context.PersistentResourceContext;
-import org.eclipse.wst.command.internal.env.eclipse.EclipseEnvironment;
-import org.eclipse.wst.command.internal.env.ui.eclipse.EclipseStatusHandler;
-import org.eclipse.wst.common.environment.IEnvironment;
-import org.eclipse.wst.server.core.IRuntime;
-import org.eclipse.wst.server.core.IServer;
-
-public abstract class WSWizardTest extends TestCase implements WSJUnitConstants
-{
- protected IEnvironment env_;
- protected IRuntime serverRuntime_;
- protected IServer server_;
- protected IStructuredSelection initialSelection_;
-
- public String defaultURL_ = "http://localhost:8080/";
-
- /**
- * Set up the workspace for the Web Service Wizard JUnit test. Setup consists of the following steps:
- * 1) Obtain an instance of the environment.
- * 2) Install the server runtime.
- * 3) Install the input data. This may include projects, source files etc.
- * 4) Install an instance of the server if required. This may also include configuration of the input data on the server.
- * 5) Initialize the J2EE, Web Service Runtime and Server type defaults for the Web Service wizard to use.
- * 6) Initialize the initial selection object to set the context for the Web Service wizard.
- * @throws Exception
- */
- protected void setUp() throws Exception
- {
- // Get an instance of the default environment with the AccumulateStatusHandler to minimize UI dialog blocks.
- PersistentResourceContext resourceContext = PersistentResourceContext.getInstance();
- EclipseStatusHandler handler = new EclipseStatusHandler();
- EclipseEnvironment environment = new EclipseEnvironment( null, resourceContext, handler );
-
- env_ = environment;
- assertTrue(env_ != null);
-
- server_ = null;
- JUnitUtils.hideActionDialogs();
- installServerRuntime();
- installServer();
-
- // unzip pre-configured workspace projects
- if (!ProjectUtilities.getProject(WSJUnitConstants.BU_PROJECT_NAME).exists())
- createProjects();
-
- installInputData();
- initJ2EEWSRuntimeServerDefaults();
- initInitialSelection();
- }
-
- /**
- * Install the server runtime.
- * @throws Exception
- */
- protected abstract void installServerRuntime() throws Exception;
-
- /**
- * Installs the input data from an aggregator. This ensures that the environment, runtime
- * and server are correctly set on the aggregate since its lifecycle methods are not necessarily
- * called.
- * @param env
- * @param serverRuntime
- * @param server
- * @throws Exception
- */
- public void installInputData(IEnvironment env,IRuntime serverRuntime,IServer server) throws Exception
- {
- env_ = env;
- serverRuntime_ = serverRuntime;
- server_ = server;
- //installInputData();
- }
-
- // Creates projects from the provided ZIP file.
-// public static boolean createProjects() {
-// IPath localZipPath = getLocalPath();
-// ProjectUnzipUtil util = new ProjectUnzipUtil(localZipPath, perf_projectNames);
-// return util.createProjects();
-// }
-
-// private static IPath getLocalPath() {
-// URL url = TestsPlugin.getDefault().find(perf_zipFilePath);
-// try {
-// url = Platform.asLocalURL(url);
-// } catch (IOException e) {
-// e.printStackTrace();
-// }
-// return new Path(url.getPath());
-// }
-
- /**
- * Create the necessary projects for the tests. This could be Web, Java, or other J2EE projects.
- * @throws Exception
- */
- protected abstract void createProjects() throws Exception;
-
- /**
- * Install the input data for the test. This may include projects, source files etc.
- * @throws Exception
- */
- protected abstract void installInputData() throws Exception;
-
- /**
- * Install an instance of the server. This may also configure input data on the server.
- * @throws Exception
- */
- protected abstract void installServer() throws Exception;
-
- /**
- * Initialize the J2EE level, Web Service runtime type and Server defaults for the test case.
- * @throws Exception
- */
- protected abstract void initJ2EEWSRuntimeServerDefaults() throws Exception;
-
- /**
- * Initialize the initial selection which drives the Web Service wizard. This could include source Java files,
- * WSDL URLs and even EJBs.
- * @throws Exception
- */
- protected abstract void initInitialSelection() throws Exception;
-
- /**
- * Clean up the workspace. Cleanup consists of the following steps:
- * 1) Delete the input data. This should include removal of configuration data on the server if necessary.
- * 2) Stop the server.
- * 3) Delete the server.
- * 4) Delete the server runtime.
- */
- protected void tearDown() throws Exception
- {
- stopServer();
-// deleteServer();
-// deleteInputData();
-// deleteServerRuntime();
- }
-
- /**
- * Delete the input data. This should include removal of projects, src files etc. as well as removal of any server configured data.
- * @throws Exception
- */
- protected abstract void deleteInputData() throws Exception;
-
- /**
- * Stop the server if it is running.
- * @throws Exception
- */
- protected void stopServer() throws Exception
- {
- if (server_ != null && server_.getServerState() == IServer.STATE_STARTED)
- server_.stop(true);
- assertTrue(server_.getServerState() == IServer.STATE_STOPPED);
- }
-
- /**
- * Delete the server.
- * @throws Exception
- */
- protected void deleteServer() throws Exception
- {
- if (server_ != null)
- server_.delete();
- }
-
- /**
- * Delete the server runtime.
- * @throws Exception
- */
- protected void deleteServerRuntime() throws Exception
- {
- if (serverRuntime_ != null)
- serverRuntime_.delete();
- }
-
- /**
- * Get the default URL in the form of: http://localhost:9080/<contextRoot>/<path>
- * @param path - a file or URL relative path.
- * @param contextRoot - the context root of the Web module for this URL.
- * @return
- */
- protected String getDefaultURL(String path,String contextRoot)
- {
- StringBuffer url = new StringBuffer(defaultURL_);
- url.append(contextRoot);
- url.append('/');
- url.append(path);
- return url.toString();
- }
-} \ No newline at end of file
diff --git a/tests/org.eclipse.jst.ws.tests/tests/org/eclipse/jst/ws/tests/axis/tomcat/v50/WSWizardTomcat50Test.java b/tests/org.eclipse.jst.ws.tests/tests/org/eclipse/jst/ws/tests/axis/tomcat/v50/WSWizardTomcat50Test.java
deleted file mode 100644
index 87d78c297..000000000
--- a/tests/org.eclipse.jst.ws.tests/tests/org/eclipse/jst/ws/tests/axis/tomcat/v50/WSWizardTomcat50Test.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 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.jst.ws.tests.axis.tomcat.v50;
-
-import org.eclipse.jst.ws.tests.WSWizardTest;
-import org.eclipse.jst.ws.tests.util.JUnitUtils;
-
-
-public abstract class WSWizardTomcat50Test extends WSWizardTest {
-
- protected final String SERVER_INSTALL_PATH = System.getProperty("org.eclipse.jst.server.tomcat.50");
- protected final String RUNTIMETYPEID_TC50 = "org.eclipse.jst.server.tomcat.runtime.50";
- protected final String SERVERTYPEID_TC50 = "org.eclipse.jst.server.tomcat.50";
-
-
- /* (non-Javadoc)
- * @see com.ibm.etools.webservice.was.tests.WSWizardTest#installServerRuntime()
- */
- protected void installServerRuntime() throws Exception {
-
- serverRuntime_ = JUnitUtils.createServerRuntime(RUNTIMETYPEID_TC50, SERVER_INSTALL_PATH);
- }
-
-
- /* (non-Javadoc)
- * @see com.ibm.etools.webservice.was.tests.WSWizardTest#installServer()
- */
- protected void installServer() throws Exception {
-
- server_ = JUnitUtils.createServer("Apache Tomcat v50", SERVERTYPEID_TC50, serverRuntime_, env_, null );
- }
-
-}
diff --git a/tests/org.eclipse.jst.ws.tests/tests/org/eclipse/jst/ws/tests/plugin/TestsPlugin.java b/tests/org.eclipse.jst.ws.tests/tests/org/eclipse/jst/ws/tests/plugin/TestsPlugin.java
deleted file mode 100644
index f76825569..000000000
--- a/tests/org.eclipse.jst.ws.tests/tests/org/eclipse/jst/ws/tests/plugin/TestsPlugin.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 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.jst.ws.tests.plugin;
-
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-import org.eclipse.core.runtime.Plugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The main plugin class to be used in the desktop.
- */
-public class TestsPlugin extends Plugin {
- //The shared instance.
- private static TestsPlugin plugin;
- //Resource bundle.
- private ResourceBundle resourceBundle;
-
- /**
- * The constructor.
- */
- public TestsPlugin() {
- super();
- plugin = this;
- try {
- resourceBundle = ResourceBundle.getBundle("org.eclipse.jst.ws.tests.plugin.TestsPlugin");
- } catch (MissingResourceException x) {
- resourceBundle = null;
- }
- }
-
- /**
- * This method is called upon plug-in activation
- */
- public void start(BundleContext context) throws Exception {
- super.start(context);
- }
-
- /**
- * This method is called when the plug-in is stopped
- */
- public void stop(BundleContext context) throws Exception {
- super.stop(context);
- }
-
- /**
- * Returns the shared instance.
- */
- public static TestsPlugin getDefault() {
- return plugin;
- }
-
- /**
- * Returns the string from the plugin's resource bundle,
- * or 'key' if not found.
- */
- public static String getResourceString(String key) {
- ResourceBundle bundle = TestsPlugin.getDefault().getResourceBundle();
- try {
- return (bundle != null) ? bundle.getString(key) : key;
- } catch (MissingResourceException e) {
- return key;
- }
- }
-
- /**
- * Returns the plugin's resource bundle,
- */
- public ResourceBundle getResourceBundle() {
- return resourceBundle;
- }
-} \ No newline at end of file
diff --git a/tests/org.eclipse.jst.ws.tests/tests/org/eclipse/jst/ws/tests/unittest/AllWSJUnitTests.java b/tests/org.eclipse.jst.ws.tests/tests/org/eclipse/jst/ws/tests/unittest/AllWSJUnitTests.java
deleted file mode 100644
index edd8b1cb1..000000000
--- a/tests/org.eclipse.jst.ws.tests/tests/org/eclipse/jst/ws/tests/unittest/AllWSJUnitTests.java
+++ /dev/null
@@ -1,99 +0,0 @@
-package org.eclipse.jst.ws.tests.unittest;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestResult;
-import junit.framework.TestSuite;
-import junit.textui.TestRunner;
-
-import org.eclipse.jst.ws.tests.util.JUnitUtils;
-
-/**
- * This class is to run all the unittest tests.
- */
-public class AllWSJUnitTests extends TestCase implements WSJUnitConstants
-{
- /**
- * Method parseArgs.
- *
- * @param args
- */
- private void parseArgs(Object args)
- {
- // typicially args is an array of strings,
- // not sure when it wouldn't be.
- }
-
- public static void main(String[] args)
- {
- new AllWSJUnitTests().runMain(args);
- }
-
-
- public Object runMain(Object args)
- {
- Object result = null;
- try
- {
- TestRunner testRunner = null;
-
- parseArgs(args);
-
- testRunner = new TestRunner(System.out);
-
- Test suite = suite();
- TestResult testResult = testRunner.doRun(suite, false);
- printHeader(testResult);
- }
- catch (Exception e)
- {
- result = e;
- }
-
- return result;
- }
-
- public static Test suite()
- {
- JUnitUtils.enableOverwrite(true);
-
- TestSuite testSuite = new TestSuite();
- testSuite.addTest( ComponentCreationTests.suite() );
- testSuite.addTest( J2EEUtilsTests.suite() );
-
- String s = System.getProperty("org.eclipse.jst.server.tomcat.50");
- if (s != null && s.length() > 0) {
- testSuite.addTest( ServerCreationTests.suite());
- }
- testSuite.addTest( ResourceUtilsTests.suite() );
-
-
- return testSuite;
- }
-
- /**
- * Prints the header of the report
- */
- protected void printHeader(TestResult result)
- {
- if (result.wasSuccessful())
- {
- System.out.println();
- System.out.print("OK");
- System.out.println(" (" + result.runCount() + " tests)");
-
- }
- else
- {
- System.out.println();
- System.out.println("FAILURES!!!");
- System.out.println(
- "Tests run: "
- + result.runCount()
- + ", Failures: "
- + result.failureCount()
- + ", Errors: "
- + result.errorCount());
- }
- }
-}
diff --git a/tests/org.eclipse.jst.ws.tests/tests/org/eclipse/jst/ws/tests/unittest/ComponentCreationTests.java b/tests/org.eclipse.jst.ws.tests/tests/org/eclipse/jst/ws/tests/unittest/ComponentCreationTests.java
deleted file mode 100644
index f4780b14d..000000000
--- a/tests/org.eclipse.jst.ws.tests/tests/org/eclipse/jst/ws/tests/unittest/ComponentCreationTests.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/**
- *
- */
-package org.eclipse.jst.ws.tests.unittest;
-
-import java.io.IOException;
-import java.net.URL;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.etools.common.test.apitools.ProjectUnzipUtil;
-import org.eclipse.jst.j2ee.internal.J2EEVersionConstants;
-import org.eclipse.jst.ws.internal.common.ResourceUtils;
-import org.eclipse.jst.ws.internal.consumption.command.common.CreateModuleCommand;
-import org.eclipse.jst.ws.tests.plugin.TestsPlugin;
-import org.eclipse.jst.ws.tests.util.JUnitUtils;
-import org.eclipse.wst.common.componentcore.ComponentCore;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-
-/**
- * Tests the various Component creation commands
- */
-public class ComponentCreationTests extends TestCase implements WSJUnitConstants {
-
- public static Test suite(){
- return new TestSuite(ComponentCreationTests.class);
- }
-
- public void testWebComponentCreation(){
-
- createServerRuntime();
- createProjects();
- //createWebModule(projectName, projectName, J2EEVersionConstants.J2EE_1_4_ID);
- //createWebModule(project2Name, project2Name, J2EEVersionConstants.J2EE_1_3_ID);
-
- }
-
- // Creates projects from the provided ZIP file.
- public static boolean createProjects() {
- IPath localZipPath = getLocalPath();
- ProjectUnzipUtil util = new ProjectUnzipUtil(localZipPath, projectNames);
- return util.createProjects();
- }
-
- private static IPath getLocalPath() {
- URL url = TestsPlugin.getDefault().find(zipFilePath);
- try {
- url = Platform.asLocalURL(url);
- } catch (IOException e) {
- e.printStackTrace();
- }
- return new Path(url.getPath());
- }
-
- public void createServerRuntime(){
-
- try {
- JUnitUtils.createServerRuntime(RUNTIMETYPEID_TC50, SERVER_INSTALL_PATH);
- }
- catch(Exception e){
- e.printStackTrace();
- }
-
- }
-
- public void dtestCreateEJBModule(){
-
- CreateModuleCommand cmc = new CreateModuleCommand();
- cmc.setJ2eeLevel(new Integer(J2EEVersionConstants.J2EE_1_3_ID).toString());
- cmc.setModuleName(ejbComponentName);
- cmc.setModuleType(CreateModuleCommand.EJB);
- cmc.setProjectName(ejbProjectName);
- cmc.setServerFactoryId(SERVERTYPEID_TC50);
- cmc.execute(null, null );
-
- System.out.println("Done creating EJB component.");
- IProject p = ResourceUtils.getWorkspaceRoot().getProject(ejbProjectName);
- IVirtualComponent vc = ComponentCore.createComponent(p);
- assertTrue(vc.exists());
- }
-
- public void dtestCreateAppClientModule(){
- CreateModuleCommand cmc = new CreateModuleCommand();
- cmc.setJ2eeLevel(new Integer(J2EEVersionConstants.J2EE_1_3_ID).toString());
- cmc.setModuleName(appClientCompName);
- cmc.setModuleType(CreateModuleCommand.APPCLIENT);
- cmc.setProjectName(appClientProjectName);
- cmc.setServerFactoryId(SERVERTYPEID_TC50);
- cmc.execute(null, null);
-
- System.out.println("Done creating App client component.");
- IProject p = ResourceUtils.getWorkspaceRoot().getProject(appClientProjectName);
- IVirtualComponent vc = ComponentCore.createComponent(p);
- assertTrue(vc.exists());
- }
-
- public void dtestCreateEARModule(){
- CreateModuleCommand cmc = new CreateModuleCommand();
- cmc.setJ2eeLevel(new Integer(J2EEVersionConstants.J2EE_1_3_ID).toString());
- cmc.setModuleName(earCompName);
- cmc.setModuleType(CreateModuleCommand.EAR);
- cmc.setProjectName(projectName);
- cmc.setServerFactoryId(SERVERTYPEID_TC50);
- cmc.execute(null, null);
-
- System.out.println("Done creating EAR component.");
- IProject p = ResourceUtils.getWorkspaceRoot().getProject(projectName);
- IVirtualComponent vc = ComponentCore.createComponent(p);
- assertTrue(vc.exists());
- }
-}
diff --git a/tests/org.eclipse.jst.ws.tests/tests/org/eclipse/jst/ws/tests/unittest/J2EEUtilsTests.java b/tests/org.eclipse.jst.ws.tests/tests/org/eclipse/jst/ws/tests/unittest/J2EEUtilsTests.java
deleted file mode 100644
index 18a135465..000000000
--- a/tests/org.eclipse.jst.ws.tests/tests/org/eclipse/jst/ws/tests/unittest/J2EEUtilsTests.java
+++ /dev/null
@@ -1,205 +0,0 @@
-/**
- *
- */
-package org.eclipse.jst.ws.tests.unittest;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
-import org.eclipse.jst.j2ee.internal.J2EEVersionConstants;
-import org.eclipse.jst.ws.internal.common.J2EEUtils;
-import org.eclipse.jst.ws.internal.common.ResourceUtils;
-import org.eclipse.jst.ws.internal.consumption.command.common.AssociateModuleWithEARCommand;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-
-/**
- * @author sengpl
- *
- */
-public class J2EEUtilsTests extends TestCase implements WSJUnitConstants{
-
- private IProject project1 = null;
- private IProject project2 = null;
- private IProject ejbProject = null;
-
- private String comp1 = webComponentName;
-
- protected void setUp() throws Exception {
- super.setUp();
-
- // Project and component names initialized here!
- project1 = ProjectUtilities.getProject(projectName);
- assertNotNull(project1);
-
- project2 = ProjectUtilities.getProject(project2Name);
- assertNotNull(project2);
-
- ejbProject = ProjectUtilities.getProject(ejbProjectName);
- assertNotNull(ejbProject);
-
- }
-
- protected void tearDown() throws Exception {
- super.tearDown();
- // TODO Clear the workspace
-
- }
-
- public static Test suite()
- {
- return new TestSuite(J2EEUtilsTests.class);
- }
-
- public void testComponentsExist(){
- System.out.println("< BEGIN: testComponentExists ...");
- IVirtualComponent vc1 = J2EEUtils.getVirtualComponent(project1);
- IVirtualComponent vc2 = J2EEUtils.getVirtualComponent(project2.getName());
-
- assertTrue(vc1.exists());
- assertTrue(J2EEUtils.exists(project1));
- assertTrue(vc2.exists());
- assertTrue(J2EEUtils.exists(project2.getName(), project2Name));
- System.out.println("< END: testComponentExists ...");
- }
-
- public void testLocationGetterMethods(){
-
- System.out.println("< BEGIN: testLocationGetterMethods ...");
- IPath loc1 = J2EEUtils.getWebContentPath(project1);
- System.out.println("WebContentPath of project1 = "+loc1);
- IResource res = ResourceUtils.getWorkspaceRoot().findMember(loc1);
- assertTrue(res.exists());
- assertTrue(res.toString().endsWith("WebContent"));
-
- IPath loc2 = J2EEUtils.getWebContentPath(project2);
- System.out.println("WebContentPath of project2 = "+loc2);
- IResource res2 = ResourceUtils.getWorkspaceRoot().findMember(loc2);
- assertTrue(res2.exists());
- assertTrue(res2.toString().endsWith("WebContent"));
-
- IPath loc3 = J2EEUtils.getWebInfPath(project1);
- System.out.println("Web-INF path = "+loc3);
- IResource res3 = ResourceUtils.getWorkspaceRoot().findMember(loc3);
- assertTrue(res3.exists());
- assertTrue(res3.toString().endsWith("WEB-INF"));
-
- IContainer container = J2EEUtils.getWebContentContainer(project2);
- IResource res4 = ResourceUtils.getWorkspaceRoot().findMember(container.getFullPath());
- assertEquals(res2, res4);
-
- System.out.println("< END: testLocationGetterMethods ...");
-
- }
-
- public void testJ2EEVersionMethods(){
-
- System.out.println("< BEGIN: testJ2EEVersionMethods ...");
-
- String j3 = J2EEUtils.getJ2EEVersionAsString(project1);
- System.out.println("J2EEVersion p1 as String: "+j3);
- assertEquals(J2EEVersionConstants.VERSION_2_4_TEXT, j3);
-
- IVirtualComponent vc2 = J2EEUtils.getVirtualComponent(project2);
- int j2 = J2EEUtils.getJ2EEVersion(vc2);
- System.out.println("J2EEVersions p1: "+j2);
- assertEquals(J2EEVersionConstants.SERVLET_2_3, j2);
-
- System.out.println("< END: testJ2EEVersionMethods ...");
- }
-
- public void testComponentGetterMethods(){
-
- System.out.println("< BEGIN: testComponentGetterMethods ...");
-
- IVirtualComponent[] vcs = J2EEUtils.getAllComponents();
- checkVirtualComponentsExists(vcs);
-
- IVirtualComponent[] vcs2 = J2EEUtils.getAllEARComponents();
- checkVirtualComponentsExists(vcs2);
-
- IVirtualComponent[] vcs3 = J2EEUtils.getAllWebComponents();
- checkVirtualComponentsExists(vcs3);
-
- IVirtualComponent[] vcs4 = J2EEUtils.getWebComponents(project1);
- checkVirtualComponentsExists(vcs4);
-
- String[] names = J2EEUtils.getWebComponentNames(project2);
- printNameStrings(names);
-
- String[] names2 = J2EEUtils.toComponentNamesArray(J2EEUtils.getComponentsByType(project1, J2EEUtils.WEB | J2EEUtils.EJB));
- printNameStrings(names2);
-
- IProject[] projects = J2EEUtils.getAllFlexibleProjects();
- for (int i=0;i<projects.length;i++){
- System.out.println("Flex project "+i+" = "+projects[i]);
- }
-
- System.out.println("< END: testComponentGetterMethods ...");
- }
-
- private void checkVirtualComponentsExists(IVirtualComponent[] vcs){
- for (int i=0; i<vcs.length;i++){
- IVirtualComponent vc = vcs[i];
- System.out.println("VC: Project = "+vc.getProject()+" Name = "+vc.getName());
- assertTrue(vc.exists());
-
- }
- }
-
- private void printNameStrings(String[] names){
- for (int i=0;i<names.length;i++){
- System.out.println("Name"+i+" = "+names[i]);
- }
- }
-
- public void dtestAssociateComponentCommand(){
-
- System.out.println("< BEGIN: testAssociateComponentCommand ...");
-
- AssociateModuleWithEARCommand amwe = new AssociateModuleWithEARCommand();
- amwe.setEar(earCompName);
- amwe.setEARProject(projectName);
- amwe.setModule(comp1);
- amwe.setProject(projectName);
- amwe.execute(null, null);
-
- System.out.println("< END: testAssociateComponentCommand ...");
- }
-
- public void dtestReferencingGetterMethods(){
-
- System.out.println("< BEGIN: testReferencingGetterMethods ...");
-
- System.out.println("isComponentAssociated ..");
- J2EEUtils.isComponentAssociated(project1, project1);
-
- String[] names = J2EEUtils.toComponentNamesArray(J2EEUtils.getReferencingEARComponents(project1));
- printNameStrings(names);
- String[] names2 = J2EEUtils.toComponentNamesArray(J2EEUtils.getReferencingEARComponents(project2));
- printNameStrings(names2);
-
- String[] names3 = J2EEUtils.toComponentNamesArray(J2EEUtils.getReferencingWebComponentsFromEAR(project1));
- printNameStrings(names3);
-
- System.out.println("< END: testReferencingGetterMethods ...");
- }
-
- public void dtestIsComponentMethods(){
-
- System.out.println("< BEGIN: testIsComponentMethods ...");
-
- //assertFalse(J2EEUtils.isEJB20Component(ejbProject, ejbComponentName));
- assertTrue(J2EEUtils.isEJB20Component(ejbProject));
-
- System.out.println("< END: testIsComponentMethods ...");
- }
-
-
-
-}
diff --git a/tests/org.eclipse.jst.ws.tests/tests/org/eclipse/jst/ws/tests/unittest/LaunchTest.java b/tests/org.eclipse.jst.ws.tests/tests/org/eclipse/jst/ws/tests/unittest/LaunchTest.java
deleted file mode 100644
index ec2f6aa5b..000000000
--- a/tests/org.eclipse.jst.ws.tests/tests/org/eclipse/jst/ws/tests/unittest/LaunchTest.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package org.eclipse.jst.ws.tests.unittest;
-
-import org.eclipse.core.runtime.IPlatformRunnable;
-
-/**
- * Minimal app to run as Eclipse "application"
- */
-public class LaunchTest implements IPlatformRunnable
-{
- /**
- * @see org.eclipse.core.runtime.IPlatformRunnable#run(Object)
- */
- public Object run(Object args) throws Exception
- {
-
- Object result = new AllWSJUnitTests().runMain(args);
-
- if (result != null)
- {
- if (result instanceof Throwable)
- {
- ((Throwable) result).printStackTrace();
- }
- else
- {
- System.out.println("tests didn't return 'ok'");
- }
- return result;
- }
- else
- return IPlatformRunnable.EXIT_OK;
- }
-}
diff --git a/tests/org.eclipse.jst.ws.tests/tests/org/eclipse/jst/ws/tests/unittest/ResourceUtilsTests.java b/tests/org.eclipse.jst.ws.tests/tests/org/eclipse/jst/ws/tests/unittest/ResourceUtilsTests.java
deleted file mode 100644
index 69b8ef3f2..000000000
--- a/tests/org.eclipse.jst.ws.tests/tests/org/eclipse/jst/ws/tests/unittest/ResourceUtilsTests.java
+++ /dev/null
@@ -1,100 +0,0 @@
-package org.eclipse.jst.ws.tests.unittest;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
-import org.eclipse.jst.ws.internal.common.ResourceUtils;
-import org.eclipse.jst.ws.tests.util.JUnitUtils;
-import org.eclipse.wst.command.internal.env.context.PersistentResourceContext;
-import org.eclipse.wst.command.internal.env.eclipse.EclipseEnvironment;
-import org.eclipse.wst.command.internal.env.ui.eclipse.EclipseStatusHandler;
-import org.eclipse.wst.common.componentcore.ComponentCore;
-import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-
-/**
- * JUnit tests for selective ResourceUtils methods. Calls which return a simple String or rely on a IResource
- * API need not be tested. The focus is mainly to exercise Component and Flexible project APIs.
- *
- */
-public class ResourceUtilsTests extends TestCase implements WSJUnitConstants{
-
-
- public static Test suite(){
- return new TestSuite(ResourceUtilsTests.class);
- }
-
- public void testComponentType(){
- IProject project = ProjectUtilities.getProject(projectName);
- String componentType = ResourceUtils.getComponentType(project);
- assertEquals(IModuleConstants.JST_WEB_MODULE, componentType);
- }
-
- public void testComponentOf(){
- IProject project = ProjectUtilities.getProject(projectName);
- IPath destPath = ResourceUtils.getJavaSourceLocation(project);
- IFolder folder = (IFolder)ResourceUtils.findResource(destPath);
- try {
- PersistentResourceContext resourceContext = PersistentResourceContext.getInstance();
- EclipseStatusHandler handler = new EclipseStatusHandler();
- EclipseEnvironment env = new EclipseEnvironment( null, resourceContext, handler );
-
- IFile file = folder.getFile(new Path("foo/Echo.java"));
- if (!file.exists()) {
- JUnitUtils.copyTestData("BUJava/src", folder, env, null );
- }
- }
- catch (Exception ex){
- ex.printStackTrace();
- }
-
- IPath javaFilePath = folder.getFile(new Path("foo/Echo.java")).getFullPath();
- IVirtualComponent vc = ResourceUtils.getComponentOf(javaFilePath);
- assertTrue(vc.exists());
-
-
- }
-
- public void testJavaSourceLocation(){
- IProject project = ProjectUtilities.getProject(projectName);
- String javaSourceLoc = ResourceUtils.getJavaSourceLocation(project).toString();
- System.out.println("Java source location = "+javaSourceLoc);
- assertTrue(javaSourceLoc.endsWith("src"));
-
- // get all the JavaSourceLocations via the VirtualComponent
- IVirtualComponent vc1 = ComponentCore.createComponent(project);
- IVirtualComponent vc2 = ComponentCore.createComponent(project);
- IVirtualComponent[] vcs = new IVirtualComponent[]{vc1, vc2};
- IPath[] paths = ResourceUtils.getAllJavaSourceLocations(vcs);
-
- // verify first folder exists
- IPath path1 = (IPath)paths[0];
- IResource resource = ResourceUtils.findResource(path1);
- if (resource.exists()){
- assertEquals(IResource.FOLDER, resource.getType());
- }
-
- // verify second folder exists
- IPath path2 = (IPath)paths[1];
- IResource resource2 = ResourceUtils.findResource(path2);
- if (resource2.exists()){
- assertEquals(IResource.FOLDER, resource2.getType());
- }
- }
-
- public void testWebComponentServerRoot() {
- IProject project = ProjectUtilities.getProject(projectName);
- IFolder folder = ResourceUtils.getWebComponentServerRoot(project);
- assertTrue(folder.exists());
-
- }
-
-}
diff --git a/tests/org.eclipse.jst.ws.tests/tests/org/eclipse/jst/ws/tests/unittest/ServerCreationTests.java b/tests/org.eclipse.jst.ws.tests/tests/org/eclipse/jst/ws/tests/unittest/ServerCreationTests.java
deleted file mode 100644
index 12041b6ee..000000000
--- a/tests/org.eclipse.jst.ws.tests/tests/org/eclipse/jst/ws/tests/unittest/ServerCreationTests.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/**
- *
- */
-package org.eclipse.jst.ws.tests.unittest;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-import org.eclipse.jst.ws.internal.consumption.command.common.CreateServerCommand;
-import org.eclipse.jst.ws.tests.util.JUnitUtils;
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.ServerCore;
-
-public class ServerCreationTests extends TestCase implements WSJUnitConstants{
-
-
- public static Test suite(){
- return new TestSuite(ServerCreationTests.class);
- }
-
- public void init(){
- try {
- assertNotNull(SERVER_INSTALL_PATH);
- JUnitUtils.createServerRuntime(RUNTIMETYPEID_TC50, SERVER_INSTALL_PATH);
- }
- catch(Exception e){
- e.printStackTrace();
- }
- }
-
- public void testCreateTomcatv5Server(){
- init();
-
- System.out.println("Creating Tomcat v5 server.");
- CreateServerCommand csc = new CreateServerCommand();
- csc.setServerFactoryid(SERVERTYPEID_TC50);
- csc.execute(null, null );
-
- IServer server = null;
- String instId = csc.getServerInstanceId();
- System.out.println("Server instance Id = "+instId);
- if (instId!=null){
- server = ServerCore.findServer(instId);
- }
- assertNotNull(server);
-
- System.out.println("Done creating Tomcat v5 server.");
- }
-
- public void testReattemptCreateTomcatv5Server(){
- System.out.println("Attempting to create 2nd Tomcat v5 server.");
- CreateServerCommand csc = new CreateServerCommand();
- csc.setServerFactoryid(SERVERTYPEID_TC50);
- csc.execute(null, null );
-
- IServer server = null;
- String instId = csc.getServerInstanceId();
- if (instId!=null) {
- server = ServerCore.findServer(instId);
- }
- assertNotNull(server);
-
- System.out.println("Done attempting 2nd Tomcat v5 server creation.");
- }
-}
diff --git a/tests/org.eclipse.jst.ws.tests/tests/org/eclipse/jst/ws/tests/unittest/WSJUnitConstants.java b/tests/org.eclipse.jst.ws.tests/tests/org/eclipse/jst/ws/tests/unittest/WSJUnitConstants.java
deleted file mode 100644
index 9ba293bfa..000000000
--- a/tests/org.eclipse.jst.ws.tests/tests/org/eclipse/jst/ws/tests/unittest/WSJUnitConstants.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package org.eclipse.jst.ws.tests.unittest;
-
-import org.eclipse.core.runtime.Path;
-
-
-public interface WSJUnitConstants {
-
- public final String SERVER_INSTALL_PATH = System.getProperty("org.eclipse.jst.server.tomcat.50");
- public final String RUNTIMETYPEID_TC50 = "org.eclipse.jst.server.tomcat.runtime.50";
-
- public final String WS_RUNTIMEID_AXIS = "org.eclipse.jst.ws.runtime.axis11";
-
- public final String SERVERTYPEID_TC50 = "org.eclipse.jst.server.tomcat.50";
-
- public final String webProjectName = "WebProject";
-
- // flexible project structure 1
- public final String projectName = "FlexProject";
- public final String webComponentName = "webComponent";
- public final String webComponent2Name = "webComp2";
-
- // flexible project structure 2
- public final String project2Name = "FlexProject2";
- public final String webComp3Name = "webComp3";
- public final String webComp4Name = "webComp4";
-
- public final String ejbProjectName = "FlexEJBProject";
- public final String ejbComponentName = "ejbComponent";
-
- public final String appClientProjectName = "FlexAppClientProject";
- public final String appClientCompName = "appClientComponent";
-
- public final String earCompName = "EARComponent";
-
- public final Path zipFilePath = new Path("/data/WSTestProjects.zip");
- public final String[] projectNames = new String[]{projectName, project2Name};
-
- // performance constants
- public final String BU_PROJECT_NAME = "TestWeb";
- public final String TD_PROJECT_NAME = "TestTDProject";
- public final String CLIENT_PROJECT_NAME = "TestWebClient";
-
- public final Path perf_zipFilePath = new Path("/data/WSPerfProjects.zip");
- public final String[] perf_projectNames = new String[]{BU_PROJECT_NAME, TD_PROJECT_NAME, CLIENT_PROJECT_NAME};
-
-}
diff --git a/tests/org.eclipse.jst.ws.tests/tests/org/eclipse/jst/ws/tests/unittest/WebServiceRuntimeTests.java b/tests/org.eclipse.jst.ws.tests/tests/org/eclipse/jst/ws/tests/unittest/WebServiceRuntimeTests.java
deleted file mode 100644
index 43ac04f65..000000000
--- a/tests/org.eclipse.jst.ws.tests/tests/org/eclipse/jst/ws/tests/unittest/WebServiceRuntimeTests.java
+++ /dev/null
@@ -1,529 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 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
- * yyyymmdd bug Email and other contact information
- * -------- -------- -----------------------------------------------------------
- * 20060518 127189 rsinha@ca.ibm.com - Rupam Kuehner
- *******************************************************************************/
-package org.eclipse.jst.ws.tests.unittest;
-
-import java.io.File;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jdt.internal.debug.ui.jres.JREsUpdater;
-import org.eclipse.jdt.launching.IVMInstall;
-import org.eclipse.jdt.launching.IVMInstall2;
-import org.eclipse.jdt.launching.IVMInstallType;
-import org.eclipse.jdt.launching.JavaRuntime;
-import org.eclipse.jdt.launching.VMStandin;
-import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
-import org.eclipse.jst.j2ee.internal.J2EEVersionConstants;
-import org.eclipse.jst.j2ee.internal.plugin.IJ2EEModuleConstants;
-import org.eclipse.jst.server.core.FacetUtil;
-import org.eclipse.jst.server.tomcat.core.internal.ITomcatRuntimeWorkingCopy;
-import org.eclipse.jst.ws.internal.consumption.command.common.CreateFacetedProjectCommand;
-import org.eclipse.jst.ws.internal.consumption.common.FacetUtils;
-import org.eclipse.jst.ws.internal.consumption.common.RequiredFacetVersion;
-import org.eclipse.jst.ws.internal.consumption.datamodel.validate.ValidationManager;
-import org.eclipse.jst.ws.internal.consumption.ui.wsrt.FacetMatchCache;
-import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeExtensionUtils2;
-import org.eclipse.wst.common.project.facet.core.IFacetedProject;
-import org.eclipse.wst.common.project.facet.core.IFacetedProjectTemplate;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
-import org.eclipse.wst.server.core.IRuntime;
-import org.eclipse.wst.server.core.IRuntimeType;
-import org.eclipse.wst.server.core.IRuntimeWorkingCopy;
-import org.eclipse.wst.server.core.ServerCore;
-import org.eclipse.wst.ws.internal.wsrt.WebServiceScenario;
-
-/**
- * WebServiceRuntimeTests contains the JUnit tests which cover project
- * creation, project filtering, and project type filtering for the Axis
- * Web service runtime. In order for the test to run successfully:
- * <ol>
- * <li>The Eclipse test environment must be launched with JDK1.4.2</li>
- * <li>The following VM arguments must be specified:
- * <ul>
- * <li>org.eclipse.jst.server.tomcat.55: the install location of a Tomcat 5.5 server,<br>
- * for example, use -Dorg.eclipse.jst.server.tomcat.55=d:\jakarta-tomcat-5.5.9
- * <li>org.eclipse.jst.server.tomcat.50: the install location of a Tomcat 5.0 server,<br>
- * for example, use -Dorg.eclipse.jst.server.tomcat.50=d:\jakarta-tomcat-5.0.28
- * <li>org.eclipse.jst.server.tomcat.41: the install location of a Tomcat 4.1 server,<br>
- * for example, use -Dorg.eclipse.jst.server.tomcat.41=d:\jakarta-tomcat-4.1.29
- * <li>java.15.install.path: the install location of a Java 1.5 JDK,<br>
- * for example, use -Djava.15.install.path=d:\jdk1.5.0_02
- * </ul></li>
- * </ol>
- *
- *
- */
-public class WebServiceRuntimeTests extends TestCase
-{
-
- //Server install paths
- private final String SERVER_INSTALL_PATH_TC55 = System.getProperty("org.eclipse.jst.server.tomcat.55");
- private final String SERVER_INSTALL_PATH_TC50 = System.getProperty("org.eclipse.jst.server.tomcat.50");
- private final String SERVER_INSTALL_PATH_TC41 = System.getProperty("org.eclipse.jst.server.tomcat.41");
-
- //JDK 1.5 install info
- private final String JAVA15_VM_INSTALL_PATH = System.getProperty("java.15.install.path");
- private final String JAVA15_VM_INSTALL_TYPE = "org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType";
- private final String JAVA15_VM_INSTALL_NAME = "Java15";
- private final String JAVA15_VM_INSTALL_JAVADOC = "http://java.sun.com/j2se/1.5.0/docs/api/";
-
- //Runtime type ids ans server type ids
- private final String RUNTIMETYPEID_TC55 = "org.eclipse.jst.server.tomcat.runtime.55";
- private final String SERVERTYPEID_TC55 = "org.eclipse.jst.server.tomcat.55";
- private final String RUNTIMETYPEID_TC50 = "org.eclipse.jst.server.tomcat.runtime.50";
- private final String SERVERTYPEID_TC50 = "org.eclipse.jst.server.tomcat.50";
- private final String RUNTIMETYPEID_TC41 = "org.eclipse.jst.server.tomcat.runtime.41";
- private final String SERVERTYPEID_TC41 = "org.eclipse.jst.server.tomcat.41";
-
- //Runtime ids for runtimes that will be created
- private final String RUNTIMEID_TC55 = "Tomcat55Runtime";
- private final String RUNTIMEID_TC50 = "Tomcat50Runtime";
- private final String RUNTIMEID_TC41 = "Tomcat41Runtime";
-
- //Web service runtime extension ids for Axis
- private final String AXIS_RUNTIME = "org.eclipse.jst.ws.axis.creation.axisWebServiceRT";
- private final String SERVICE_IMPL_JAVA = "org.eclipse.jst.ws.wsImpl.java";
- private final String AXIS_SERVICE_RUNTIME = "org.eclipse.jst.ws.axis.creation.java";
- private final String CLIENT_IMPL_JAVA = "org.eclipse.jst.ws.client.type.java";
- private final String AXIS_CLIENT_RUNTIME_WEB = "org.eclipse.jst.ws.axis.consumption.web";
- private final String AXIS_CLIENT_RUNTIME_JAVA = "org.eclipse.jst.ws.axis.consumption.java";
-
- //Various constants used by the test case for identifying service/client side and
- //for setting names on created projects.
- private final String SERVICE_SIDE = "s";
- private final String CLIENT_SIDE = "c";
- private final String PROJECT_NAME_PREFIX = "tc";
- private final String PROJECT_NAME_SUFFIX = "project";
-
- //IProjectFacetVersions used in the expected results
- private final IProjectFacetVersion WEB23 = ProjectFacetsManager.getProjectFacet(IJ2EEModuleConstants.JST_WEB_MODULE).getVersion(J2EEVersionConstants.VERSION_2_3_TEXT);
- private final IProjectFacetVersion WEB24 = ProjectFacetsManager.getProjectFacet(IJ2EEModuleConstants.JST_WEB_MODULE).getVersion(J2EEVersionConstants.VERSION_2_4_TEXT);
- private final IProjectFacetVersion JAVA14 = ProjectFacetsManager.getProjectFacet(IJ2EEModuleConstants.JST_JAVA).getVersion(J2EEVersionConstants.VERSION_1_4_TEXT);
- private final IProjectFacetVersion JAVA50 = ProjectFacetsManager.getProjectFacet(IJ2EEModuleConstants.JST_JAVA).getVersion("5.0");
- private final IProjectFacetVersion UTILITY10 = ProjectFacetsManager.getProjectFacet(IJ2EEModuleConstants.JST_UTILITY_MODULE).getVersion(J2EEVersionConstants.VERSION_1_0_TEXT);
-
- private final IFacetedProjectTemplate TEMPLATE_WEB = ProjectFacetsManager.getTemplate(IJ2EEModuleConstants.JST_WEB_TEMPLATE);
- private final IFacetedProjectTemplate TEMPLATE_UTILITY = ProjectFacetsManager.getTemplate(IJ2EEModuleConstants.JST_UTILITY_TEMPLATE);
-
- private int multiplesForProjectCreation;
-
- public static Test suite()
- {
- return new TestSuite(WebServiceRuntimeTests.class);
- }
-
- private void init()
- {
- try
- {
- assertNotNull(SERVER_INSTALL_PATH_TC55);
- assertNotNull(SERVER_INSTALL_PATH_TC50);
- assertNotNull(SERVER_INSTALL_PATH_TC41);
- assertNotNull(JAVA15_VM_INSTALL_PATH);
-
- //Create a server runtime: Tomcat 4.1 with JDK 1.4.2
- createTomcatServerRuntime(RUNTIMEID_TC41, RUNTIMETYPEID_TC41, SERVER_INSTALL_PATH_TC41);
-
- //Create a server runtime: Tomcat 5.0 with JDK 1.4.2
- createTomcatServerRuntime(RUNTIMEID_TC50, RUNTIMETYPEID_TC50, SERVER_INSTALL_PATH_TC50);
-
- //Create a server runtime: Tomcat 5.5 with JDK 1.5
- createTomcatServerRuntime(RUNTIMEID_TC55, RUNTIMETYPEID_TC55, SERVER_INSTALL_PATH_TC55);
-
-
-
- String multiples = System.getProperty("multiples"); //this is an optional propery - defaulted to 1
- if (multiples != null && (Integer.parseInt(multiples) > 0))
- {
- multiplesForProjectCreation = Integer.parseInt(multiples);
- }
- else
- {
- multiplesForProjectCreation = 1;
- }
-
- } catch (Exception e)
- {
- e.printStackTrace();
- fail();
- }
- }
-
- private IRuntime createTomcatServerRuntime(String runtimeId, String runtimeTypeId, String serverInstallPath) throws Exception
- {
- IRuntimeType rt = ServerCore.findRuntimeType(runtimeTypeId);
- IRuntimeWorkingCopy wc = rt.createRuntime(runtimeId, null);
- wc.setLocation(new Path(serverInstallPath));
- IRuntime runtime = wc.save(true, null);
-
- if (runtimeTypeId.equals(RUNTIMETYPEID_TC55))
- {
- //Create a new IVMInstall
- IVMInstallType type = JavaRuntime.getVMInstallType(JAVA15_VM_INSTALL_TYPE);
- IVMInstall newVM = new VMStandin(type, createUniqueId(type));
- newVM.setInstallLocation(new File(JAVA15_VM_INSTALL_PATH).getAbsoluteFile());
- newVM.setName(JAVA15_VM_INSTALL_NAME);
- newVM.setJavadocLocation(new URL(JAVA15_VM_INSTALL_JAVADOC));
- if (newVM instanceof IVMInstall2)
- {
- IVMInstall2 newVM2 = (IVMInstall2) newVM;
- newVM2.setVMArgs(null);
- }
- newVM.setLibraryLocations(null);
-
- //Add the new IVMInstall to the master list.
- IVMInstall[] vms = new IVMInstall[]{newVM};
- //TODO Replace use of the internal class org.eclipse.jdt.internal.debug.ui.jres.JREsUpdater
- //with something public. Not sure if something public is available at this time. Need to check.
- JREsUpdater updater = new JREsUpdater();
- IVMInstall defaultVM = JavaRuntime.getDefaultVMInstall();
- updater.updateJRESettings(vms, defaultVM);
-
- //Get the new IVMInstall
- IVMInstallType vmType = JavaRuntime.getVMInstallType(JAVA15_VM_INSTALL_TYPE);
- IVMInstall java15VM = vmType.findVMInstallByName(JAVA15_VM_INSTALL_NAME);
-
- //Set the tomcat runtime to use the new Java 15 JDK.
- IRuntimeWorkingCopy wc2 = runtime.createWorkingCopy();
- //TODO Replace use of the internal class
- //org.eclipse.jst.server.tomcat.core.internal.ITomcatRuntimeWorkingCopy
- //with something public. Enhancement 127884 has been opened to request API
- //for this.
- ITomcatRuntimeWorkingCopy tcwc = (ITomcatRuntimeWorkingCopy)wc2.loadAdapter(ITomcatRuntimeWorkingCopy.class, new NullProgressMonitor());
- tcwc.setVMInstall(java15VM);
- wc2.save(true, null);
- }
-
- return ServerCore.findRuntime(runtimeId);
- }
-
- private String createUniqueId(IVMInstallType vmType)
- {
- String id = null;
- do
- {
- id = String.valueOf(System.currentTimeMillis());
- } while (vmType.findVMInstall(id) != null);
- return id;
- }
-
- /**
- * Tests project creation and filtering for the Axis Web service
- * runtime. Tests cover all valid combinations of ServiceRuntimes,
- * Tomcat servers, and J2EE project types and well as all valid
- * combinations of ClientRuntimes, Tomcat servers, and J2EE project types.
- */
- public void testProjectCreationAndFiltering()
- {
- init();
-
- String[] templateIds = new String[]{IJ2EEModuleConstants.JST_WEB_TEMPLATE,
- IJ2EEModuleConstants.JST_WEB_TEMPLATE,
- IJ2EEModuleConstants.JST_WEB_TEMPLATE,
- IJ2EEModuleConstants.JST_WEB_TEMPLATE,
- IJ2EEModuleConstants.JST_WEB_TEMPLATE,
- IJ2EEModuleConstants.JST_WEB_TEMPLATE,
- IJ2EEModuleConstants.JST_UTILITY_TEMPLATE,
- IJ2EEModuleConstants.JST_UTILITY_TEMPLATE,
- IJ2EEModuleConstants.JST_UTILITY_TEMPLATE};
- String[] scenarios = new String[]{SERVICE_SIDE,
- SERVICE_SIDE,
- SERVICE_SIDE,
- CLIENT_SIDE,
- CLIENT_SIDE,
- CLIENT_SIDE,
- CLIENT_SIDE,
- CLIENT_SIDE,
- CLIENT_SIDE};
- String[] serviceClientRuntimeIds = new String[]{AXIS_SERVICE_RUNTIME,
- AXIS_SERVICE_RUNTIME,
- AXIS_SERVICE_RUNTIME,
- AXIS_CLIENT_RUNTIME_WEB,
- AXIS_CLIENT_RUNTIME_WEB,
- AXIS_CLIENT_RUNTIME_WEB,
- AXIS_CLIENT_RUNTIME_JAVA,
- AXIS_CLIENT_RUNTIME_JAVA,
- AXIS_CLIENT_RUNTIME_JAVA};
- String[] serverTypes = new String[]{SERVERTYPEID_TC41,
- SERVERTYPEID_TC50,
- SERVERTYPEID_TC55,
- SERVERTYPEID_TC41,
- SERVERTYPEID_TC50,
- SERVERTYPEID_TC55,
- SERVERTYPEID_TC41,
- SERVERTYPEID_TC50,
- SERVERTYPEID_TC55};
-
-
- //Expected Results:
-
- IProjectFacetVersion[][] expectedFacets = new IProjectFacetVersion[][]{ new IProjectFacetVersion[]{WEB23, JAVA14},
- new IProjectFacetVersion[]{WEB24, JAVA14},
- new IProjectFacetVersion[]{WEB24, JAVA50},
- new IProjectFacetVersion[]{WEB23, JAVA14},
- new IProjectFacetVersion[]{WEB24, JAVA14},
- new IProjectFacetVersion[]{WEB24, JAVA50},
- new IProjectFacetVersion[]{UTILITY10, JAVA14},
- new IProjectFacetVersion[]{UTILITY10, JAVA14},
- new IProjectFacetVersion[]{UTILITY10, JAVA50},
- };
-
- String[] expectedRuntimes = new String[] {RUNTIMEID_TC41,
- RUNTIMEID_TC50,
- RUNTIMEID_TC55,
- RUNTIMEID_TC41,
- RUNTIMEID_TC50,
- RUNTIMEID_TC55,
- RUNTIMEID_TC41,
- RUNTIMEID_TC50,
- RUNTIMEID_TC55
- };
-
- String bigPrefix = PROJECT_NAME_PREFIX+"0"+PROJECT_NAME_SUFFIX;
- String[] expectedProjectsForAxisService = new String[] { bigPrefix+"0",
- bigPrefix+"1",
- bigPrefix+"2",
- bigPrefix+"3",
- bigPrefix+"4",
- bigPrefix+"5"
- };
-
- String[] expectedProjectsForAxisClient = new String[] { bigPrefix+"0",
- bigPrefix+"1",
- bigPrefix+"2",
- bigPrefix+"3",
- bigPrefix+"4",
- bigPrefix+"5",
- bigPrefix+"6",
- bigPrefix+"7",
- bigPrefix+"8",
- };
-
- boolean[] expectedBooleansForAxisService = new boolean[] {true, true, true, true, true, true, false, false, false};
- boolean[] expectedBooleansForAxisClientWeb = new boolean[] {true, true, true, true, true, true, false, false, false};
- boolean[] expectedBooleansForAxisClientJava = new boolean[] {false, false, false, false, false, false, true, true, true};
-
-
- //Turn auto-build off
- ValidationManager manager = new ValidationManager();
- manager.disableAutoBuild();
-
- //Create the projects
- for (int i=0; i<multiplesForProjectCreation; i++)
- {
- createProjects(templateIds, scenarios, serviceClientRuntimeIds, serverTypes, PROJECT_NAME_PREFIX+i);
- }
-
- //Restore auto-build
- manager.restoreAutoBuild();
-
- //Check Expected Results:
-
- //Check facets and runtime on the first "0"th set of created projects. Ignore higher multiples since they
- //are duplicates.
- for (int j=0; j<expectedFacets.length; j++)
- {
- String projectName = bigPrefix+j;
- IProject project = ProjectUtilities.getProject(projectName);
- assertNotNull(project);
- assertTrue(project.exists());
- try
- {
- IFacetedProject fProject = ProjectFacetsManager.create(project);
- assertNotNull(fProject);
-
- //Check facets
- //begin debug
- Iterator pfacets = fProject.getProjectFacets().iterator();
- while (pfacets.hasNext())
- {
- IProjectFacetVersion pfv = (IProjectFacetVersion)pfacets.next();
- System.out.println("facet="+pfv.getProjectFacet().getId()+", version="+pfv.getVersionString());
- }
-
- for (int k=0; k<expectedFacets[j].length; k++)
- {
- assertTrue(fProject.hasProjectFacet(expectedFacets[j][k]));
-
- }
-
- //Check runtime
- org.eclipse.wst.common.project.facet.core.runtime.IRuntime fRuntime = fProject.getRuntime();
- assertNotNull(fRuntime);
- IRuntime sRuntime = FacetUtil.getRuntime(fRuntime);
- assertNotNull(sRuntime);
- assertTrue(sRuntime.getId().equals(expectedRuntimes[j]));
-
- } catch (CoreException ce)
- {
- fail();
- }
-
- }
-
- //Check that WebServiceRuntimeExtensionUtils2.getProjectsForServiceTypeAndRuntime(..) returns
- //the right set of projects
- String serviceType = String.valueOf(WebServiceScenario.BOTTOMUP) + "/" + SERVICE_IMPL_JAVA;
- String[] projectsForAxisService = WebServiceRuntimeExtensionUtils2.getProjectsForServiceTypeAndRuntime(serviceType, AXIS_RUNTIME);
- assertEquals(expectedProjectsForAxisService.length, projectsForAxisService.length);
- List projectsForAxisServiceList = new ArrayList();
- for (int i=0; i<projectsForAxisService.length; i++)
- {
- projectsForAxisServiceList.add(projectsForAxisService[i]);
- }
- for (int i=0; i<expectedProjectsForAxisService.length; i++)
- {
- assertTrue(projectsForAxisServiceList.contains(expectedProjectsForAxisService[i]));
- }
-
- //Check that WebServiceRuntimeExtensionUtils2.getProjectsForClientTypeAndRuntime(..) returns
- //the right set of projects
- String[] projectsForAxisClient = WebServiceRuntimeExtensionUtils2.getProjectsForClientTypeAndRuntime(CLIENT_IMPL_JAVA, AXIS_RUNTIME);
- assertEquals(expectedProjectsForAxisClient.length, projectsForAxisClient.length);
- List projectsForAxisClientList = new ArrayList();
- for (int i=0; i<projectsForAxisClient.length; i++)
- {
- projectsForAxisClientList.add(projectsForAxisClient[i]);
- }
- for (int i=0; i<expectedProjectsForAxisClient.length; i++)
- {
- assertTrue(projectsForAxisClientList.contains(expectedProjectsForAxisClient[i]));
- }
-
- //Check that the Axis service and client runtimes' project compatibility checking is working
- for (int i=0; i<expectedBooleansForAxisService.length; i++)
- {
- String projectName = bigPrefix+i;
- assertEquals(expectedBooleansForAxisService[i], WebServiceRuntimeExtensionUtils2.doesServiceRuntimeSupportProject(AXIS_SERVICE_RUNTIME, projectName));
- assertEquals(expectedBooleansForAxisClientWeb[i], WebServiceRuntimeExtensionUtils2.doesClientRuntimeSupportProject(AXIS_CLIENT_RUNTIME_WEB, projectName));
- assertEquals(expectedBooleansForAxisClientJava[i], WebServiceRuntimeExtensionUtils2.doesClientRuntimeSupportProject(AXIS_CLIENT_RUNTIME_JAVA, projectName));
- }
-
- //Turn auto-build off
- manager.disableAutoBuild();
-
- //Delete the projects
- for (int i=0; i<multiplesForProjectCreation; i++)
- {
- deleteProjects(templateIds.length, PROJECT_NAME_PREFIX+i);
- }
-
- //Restore auto-build
- manager.restoreAutoBuild();
- }
-
- private void deleteProjects(int n, String namePrefix)
- {
- for (int i=0; i<n; i++)
- {
- String name = namePrefix + PROJECT_NAME_SUFFIX + i;
- IProject project = ProjectUtilities.getProject(name);
- try
- {
- project.delete(true, null);
- }
- catch (CoreException ce)
- {
- //Don't fail the test case if project deletion fails.
- }
- }
- }
-
- private void createProjects(String[] templateIds, String[] scenarios, String[] serviceClientRuntimeIds, String[] serverTypes, String namePrefix )
- {
- int n = templateIds.length;
- for (int i=0; i<n; i++)
- {
- String name = namePrefix + PROJECT_NAME_SUFFIX + i;
- RequiredFacetVersion[] rfvs = null;
- if (scenarios[i].equals(CLIENT_SIDE))
- {
-
- rfvs = WebServiceRuntimeExtensionUtils2.getClientRuntimeDescriptorById(serviceClientRuntimeIds[i]).getRequiredFacetVersions();
-
- }
- else
- {
- if (scenarios[i].equals(SERVICE_SIDE))
- {
- rfvs = WebServiceRuntimeExtensionUtils2.getServiceRuntimeDescriptorById(serviceClientRuntimeIds[i]).getRequiredFacetVersions();
- }
- else
- {
- rfvs = new RequiredFacetVersion[0];
- }
- }
-
- CreateFacetedProjectCommand command = new CreateFacetedProjectCommand();
- command.setProjectName(name);
- command.setTemplateId(templateIds[i]);
- command.setRequiredFacetVersions(rfvs);
- command.setServerFactoryId(serverTypes[i]);
- IStatus status = command.execute( new NullProgressMonitor(), null );
- if (status.getSeverity() == Status.ERROR)
- {
- fail();
- }
-
- IProject project = ProjectUtilities.getProject(name);
- FacetUtils.addRequiredFacetsToProject(project, rfvs, new NullProgressMonitor());
- }
- }
-
- /**
- * Tests project type filtering for the Axis Web service runtime.
- * Tests cover all ServiceRuntimes and ClientRuntimes.
- */
- public void testProjectTypeFiltering()
- {
- IFacetedProjectTemplate[] expectedTemplatesForAxisService = new IFacetedProjectTemplate[] {TEMPLATE_WEB};
- IFacetedProjectTemplate[] expectedTemplatesForAxisClientWeb = new IFacetedProjectTemplate[] {TEMPLATE_WEB};
- IFacetedProjectTemplate[] expectedTemplatesForAxisClientJava = new IFacetedProjectTemplate[] {TEMPLATE_UTILITY};
-
- Set templatesForAxisService = FacetMatchCache.getInstance().getTemplatesForServiceRuntime(AXIS_SERVICE_RUNTIME);
- assertEquals(expectedTemplatesForAxisService.length,templatesForAxisService.size());
- for (int i=0; i<expectedTemplatesForAxisService.length; i++)
- {
- assertTrue(templatesForAxisService.contains(expectedTemplatesForAxisService[i]));
- }
- Set templatesForAxisClientWeb = FacetMatchCache.getInstance().getTemplatesForClientRuntime(AXIS_CLIENT_RUNTIME_WEB);
- assertEquals(expectedTemplatesForAxisClientWeb.length, templatesForAxisClientWeb.size());
- for (int i=0; i<expectedTemplatesForAxisClientWeb.length; i++)
- {
- assertTrue(templatesForAxisClientWeb.contains(expectedTemplatesForAxisClientWeb[i]));
- }
- Set templatesForAxisClientJava = FacetMatchCache.getInstance().getTemplatesForClientRuntime(AXIS_CLIENT_RUNTIME_JAVA);
- assertEquals(expectedTemplatesForAxisClientJava.length, templatesForAxisClientJava.size());
- for (int i=0; i<expectedTemplatesForAxisClientJava.length; i++)
- {
- assertTrue(templatesForAxisClientJava.contains(expectedTemplatesForAxisClientJava[i]));
- }
-
-
- }
-}
diff --git a/tests/org.eclipse.jst.ws.tests/tests/org/eclipse/jst/ws/tests/util/AccumulateStatusHandler.java b/tests/org.eclipse.jst.ws.tests/tests/org/eclipse/jst/ws/tests/util/AccumulateStatusHandler.java
deleted file mode 100644
index 5441127d5..000000000
--- a/tests/org.eclipse.jst.ws.tests/tests/org/eclipse/jst/ws/tests/util/AccumulateStatusHandler.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 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.jst.ws.tests.util;
-
-import java.util.Vector;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.wst.command.internal.env.core.common.StatusUtils;
-import org.eclipse.wst.common.environment.Choice;
-import org.eclipse.wst.common.environment.IStatusHandler;
-import org.eclipse.wst.common.environment.StatusException;
-
-public class AccumulateStatusHandler implements IStatusHandler {
- Vector statusList_;
-
- public AccumulateStatusHandler()
- {
- resetStatus();
- }
-
- /**
- * Resets the status so that it starts out empty again.
- *
- */
- public void resetStatus()
- {
- statusList_ = new Vector();
- }
-
- public IStatus getStatus()
- {
- IStatus worstStatus = Status.OK_STATUS;
-
- // Find the worst error status code
- for( int index = 0; index < statusList_.size(); index++ )
- {
- IStatus status = (IStatus)statusList_.elementAt( index );
-
- if( status.getSeverity() > worstStatus.getSeverity() )
- {
- worstStatus = status;
- }
- }
-
- return StatusUtils.multiStatus( worstStatus.getMessage(),
- (IStatus[])statusList_.toArray( new IStatus[0] ) );
- }
-
- /**
- * @see org.eclipse.env.common.IStatusHandler#report(org.eclipse.env.common.Status, org.eclipse.env.common.Choice[])
- */
- public Choice report(IStatus status, Choice[] choices)
- {
- Choice result = null;
-
- // Always take the first choice if available.
- if( choices != null && choices.length > 0 )
- {
- result = choices[0];
- }
-
- statusList_.add( status );
-
- return result;
- }
-
- /**
- * @see org.eclipse.env.common.IStatusHandler#report(org.eclipse.env.common.Status)
- */
- public void report(IStatus status) throws StatusException
- {
- statusList_.add( status );
- }
-
- /**
- * @see com.ibm.env.common.IStatusHandler#reportError(com.ibm.env.common.Status)
- */
- public void reportError(IStatus status)
- {
- statusList_.add( status );
- }
-
- /**
- * @see com.ibm.env.common.IStatusHandler#reportInfo(com.ibm.env.common.Status)
- */
- public void reportInfo(IStatus status)
- {
- statusList_.add( status );
- }
-
-}
diff --git a/tests/org.eclipse.jst.ws.tests/tests/org/eclipse/jst/ws/tests/util/DynamicPopupJUnitWizard.java b/tests/org.eclipse.jst.ws.tests/tests/org/eclipse/jst/ws/tests/util/DynamicPopupJUnitWizard.java
deleted file mode 100644
index d52cba00f..000000000
--- a/tests/org.eclipse.jst.ws.tests/tests/org/eclipse/jst/ws/tests/util/DynamicPopupJUnitWizard.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 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.jst.ws.tests.util;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.operation.IRunnableContext;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.wst.command.internal.env.context.PersistentResourceContext;
-import org.eclipse.wst.command.internal.env.core.data.DataFlowManager;
-import org.eclipse.wst.command.internal.env.core.data.DataMappingRegistryImpl;
-import org.eclipse.wst.command.internal.env.core.fragment.CommandFragment;
-import org.eclipse.wst.command.internal.env.eclipse.EclipseEnvironment;
-import org.eclipse.wst.command.internal.env.ui.widgets.CommandWidgetBinding;
-import org.eclipse.wst.command.internal.env.ui.widgets.SimpleCommandEngineManager;
-import org.eclipse.wst.command.internal.env.ui.widgets.popup.DynamicPopupWizard;
-import org.eclipse.wst.common.environment.ILog;
-import org.eclipse.wst.common.environment.IStatusHandler;
-
-public class DynamicPopupJUnitWizard extends DynamicPopupWizard {
- private IStatusHandler handler_;
- private ILog log_;
- public DynamicPopupJUnitWizard(IStatusHandler handler)
- {
- handler_ = handler;
- }
-
- public DynamicPopupJUnitWizard(IStatusHandler handler, ILog log)
- {
- handler_ = handler;
- log_ = log;
- }
-
- public void runHeadLess(IStructuredSelection selection,IRunnableContext context) {
-
- PersistentResourceContext resourceContext = PersistentResourceContext.getInstance();
- EclipseEnvironment environment = new EclipseEnvironment( null, resourceContext, handler_ );
- if (log_!=null)
- environment.setLog(log_);
-
- DataMappingRegistryImpl dataRegistry_ = new DataMappingRegistryImpl();
- DataFlowManager dataManager = new DataFlowManager( dataRegistry_, environment );
- SimpleCommandEngineManager manager = new SimpleCommandEngineManager(environment, dataManager);
-
- try
- {
- commandWidgetBinding_ = (CommandWidgetBinding)wizardElement_.createExecutableExtension( "class" );
- }
- catch( CoreException exc )
- {
- exc.printStackTrace();
- }
-
- commandWidgetBinding_.registerDataMappings( dataRegistry_ );
-
- CommandFragment rootFragment = getRootFragment( selection, null );
- manager.setRootFragment( rootFragment );
- manager.runForwardToNextStop( context );
- }
-} \ No newline at end of file
diff --git a/tests/org.eclipse.jst.ws.tests/tests/org/eclipse/jst/ws/tests/util/JUnitUtils.java b/tests/org.eclipse.jst.ws.tests/tests/org/eclipse/jst/ws/tests/util/JUnitUtils.java
deleted file mode 100644
index 1ec8b4aee..000000000
--- a/tests/org.eclipse.jst.ws.tests/tests/org/eclipse/jst/ws/tests/util/JUnitUtils.java
+++ /dev/null
@@ -1,358 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 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.jst.ws.tests.util;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.Enumeration;
-
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IncrementalProjectBuilder;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtension;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.debug.core.ILaunchManager;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jst.ws.internal.common.ServerUtils;
-import org.eclipse.jst.ws.internal.consumption.command.common.CreateModuleCommand;
-import org.eclipse.jst.ws.internal.consumption.ui.plugin.WebServiceConsumptionUIPlugin;
-import org.eclipse.jst.ws.internal.consumption.ui.preferences.PersistentServerRuntimeContext;
-import org.eclipse.jst.ws.internal.context.ScenarioContext;
-import org.eclipse.jst.ws.internal.plugin.WebServicePlugin;
-import org.eclipse.jst.ws.tests.plugin.TestsPlugin;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.wst.command.internal.env.common.FileResourceUtils;
-import org.eclipse.wst.command.internal.env.common.WaitForAutoBuildCommand;
-import org.eclipse.wst.command.internal.env.context.PersistentActionDialogsContext;
-import org.eclipse.wst.command.internal.env.core.common.StatusUtils;
-import org.eclipse.wst.command.internal.env.core.context.ResourceContext;
-import org.eclipse.wst.command.internal.env.preferences.ActionDialogPreferenceType;
-import org.eclipse.wst.command.internal.env.ui.eclipse.EnvironmentUtils;
-import org.eclipse.wst.common.environment.IEnvironment;
-import org.eclipse.wst.server.core.IModule;
-import org.eclipse.wst.server.core.IRuntime;
-import org.eclipse.wst.server.core.IRuntimeType;
-import org.eclipse.wst.server.core.IRuntimeWorkingCopy;
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.IServerType;
-import org.eclipse.wst.server.core.IServerWorkingCopy;
-import org.eclipse.wst.server.core.ServerCore;
-import org.eclipse.wst.server.core.ServerUtil;
-import org.eclipse.wst.ws.internal.plugin.WSPlugin;
-import org.eclipse.wst.ws.internal.preferences.PersistentWSIContext;
-
-
-public class JUnitUtils {
- // Begin Server Utilities
- public static IRuntime createServerRuntime(String runtimeTypeId,String serverInstallPath) throws Exception
- {
- IRuntimeType rt = ServerCore.findRuntimeType(runtimeTypeId);
- IRuntimeWorkingCopy wc = rt.createRuntime("aRuntime", null);
- wc.setLocation(new Path(serverInstallPath));
-
- return wc.save(true, null);
- }
-
- public static IServer createServer(String name,String serverTypeId,IRuntime runtime,IEnvironment env, IProgressMonitor monitor ) throws Exception
- {
- IServerType serverType = ServerCore.findServerType(serverTypeId);
- IServer[] servers = ServerCore.getServers();
- for (int i=0;i<servers.length;i++){
- if(servers[i].getServerType().getId().equals(serverType.getId())){
- return servers[i];
- }
- }
-
- IServerWorkingCopy serverWc = serverType.createServer(serverTypeId,null, monitor );
- serverWc.setName(name);
- serverWc.setRuntime(runtime);
- IServer server = serverWc.saveAll(true, monitor );
- return server;
- }
-
- /**
- * createServer and install JRE for Servers requiring a specific JRE
- * @param javaRuntimePath JRE install location; i.e. E:\\Java141
- * @param jreID JRE id; i.e. java141
- * @param name server name
- * @param serverTypeId server type id
- * @param runtime IRuntime
- * @param env IEnvironment
- * @return server IServer
- * @throws Exception
- *
- * @deprecated
- */
- public static IServer createServer(String javaRuntimePath, String jreID, String name,String serverTypeId,IRuntime runtime,IEnvironment env, IProgressMonitor monitor ) throws Exception
- {
- IServerType serverType = ServerCore.findServerType(serverTypeId);
- IServer[] servers = ServerCore.getServers();
- for (int i=0;i<servers.length;i++){
- if(servers[i].getServerType().getId().equals(serverType.getId())){
- return servers[i];
- }
- }
-
- IServerWorkingCopy serverWc = serverType.createServer(serverTypeId,null, monitor );
- serverWc.setName(name);
- serverWc.setRuntime(runtime);
-
- IServer server = serverWc.saveAll(true, monitor );
-
- return server;
- }
-
- public static void startServer(IServer server,IEnvironment env) throws Exception
- {
- final IServer currentServer = server;
- IRunnableWithProgress runnable = new IRunnableWithProgress()
- {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException
- {
- try
- {
- currentServer.start(ILaunchManager.RUN_MODE, monitor );
- }
- catch (CoreException e)
- {
- InterruptedException wrapper = new InterruptedException(e.getMessage());
- wrapper.setStackTrace(e.getStackTrace());
- throw wrapper;
- }
- }
- };
- PlatformUI.getWorkbench().getProgressService().run(true,false,runnable);
- }
-
- public static boolean removeEARFromServer(IServer server,IProject earProject,IEnvironment env, IProgressMonitor monitor ) throws Exception
- {
- int numberOfModules = server.getModules().length;
- if (server != null)
- {
- final IModule earProjectModule = ServerUtil.getModule(earProject);
- final IModule[] modules = {earProjectModule};
- new ServerUtils().modifyModules(env, server,earProjectModule,false, monitor );
- final IServer currentServer = server;
- IRunnableWithProgress runnable = new IRunnableWithProgress()
- {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException
- {
- for (int i=0;i<1000;i++)
- {
- int moduleState = currentServer.getModuleState(modules);
- if (moduleState == IServer.STATE_STARTED || moduleState == IServer.STATE_STOPPING)
- {
- try
- {
- Thread.sleep(300);
- }
- catch (InterruptedException e)
- {
- e.printStackTrace(System.err);
- }
- }
- else
- break;
- }
- }
- };
- PlatformUI.getWorkbench().getProgressService().run(true,false,runnable);
- return (server.getModules().length == (numberOfModules-1));
- }
- return false;
- }
-
- public static boolean removeModuleFromServer(IServer server, IProject webProject, IEnvironment env, IProgressMonitor monitor ) throws Exception {
-
- int numberOfModules = server.getModules().length;
- if (server != null)
- {
- final IModule webProjectModule = ServerUtil.getModule(webProject);
- final IModule[] modules = {webProjectModule};
-
- new ServerUtils().modifyModules(env, server,webProjectModule,false, monitor );
- final IServer currentServer = server;
- IRunnableWithProgress runnable = new IRunnableWithProgress()
- {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException
- {
- for (int i=0;i<1000;i++)
- {
- int moduleState = currentServer.getModuleState(modules);
- if (moduleState == IServer.STATE_STARTED || moduleState == IServer.STATE_STOPPING)
- {
- try
- {
- Thread.sleep(300);
- }
- catch (InterruptedException e)
- {
- e.printStackTrace(System.err);
- }
- }
- else
- break;
- }
- }
- };
- PlatformUI.getWorkbench().getProgressService().run(true,false,runnable);
- //Thread.sleep(6000);
- return (server.getModules().length == (numberOfModules-1));
- }
- return false;
- }
-
- // Begin: General Eclipse Utilities
-
- public static void syncBuildProject(IProject project,IEnvironment env, IProgressMonitor monitor ) throws Exception
- {
- project.build(IncrementalProjectBuilder.FULL_BUILD, monitor );
- WaitForAutoBuildCommand cmd = new WaitForAutoBuildCommand();
- cmd.setEnvironment( env );
- cmd.execute( monitor, null );
- }
-
- private static void copyTestFiles(String pathString,int rootSegmentLength,IFolder destFolder,IEnvironment env, IProgressMonitor monitor ) throws Exception
- {
- Enumeration e = TestsPlugin.getDefault().getBundle().getEntryPaths(pathString);
- while (e.hasMoreElements())
- {
- String filePath = (String)e.nextElement();
- if (filePath.endsWith("/"))
- copyTestFiles(filePath,rootSegmentLength,destFolder,env, monitor );
- else
- {
- IPath fileIPath = new Path(filePath);
- FileResourceUtils.copyFile(EnvironmentUtils.getResourceContext(env),
- TestsPlugin.getDefault(),
- fileIPath.removeLastSegments(fileIPath.segmentCount()-rootSegmentLength), // /data/<subdir>
- (new Path(filePath)).removeFirstSegments(rootSegmentLength), // files after /data/<subdir>
- destFolder.getFullPath(),
- monitor,
- env.getStatusHandler());
- }
- }
- }
-
- public static void copyTestData(String dataSubdirectory,IFolder destFolder,IEnvironment env, IProgressMonitor monitor ) throws Exception
- {
- String pathString = "/data/"+dataSubdirectory;
- copyTestFiles(pathString,new Path(pathString).segmentCount(),destFolder,env, monitor);
-
- }
-
- // Begin: Web Services Utilities
- public static void hideActionDialogs()
- {
- PersistentActionDialogsContext actionDialogsCtx = PersistentActionDialogsContext.getInstance();
- ActionDialogPreferenceType[] actionDialogPrefs = actionDialogsCtx.getDialogs();
- for (int i=0;i<actionDialogPrefs.length;i++)
- actionDialogsCtx.setActionDialogEnabled(actionDialogPrefs[i].getId(),true);
- }
-
-
- public static boolean enableProxyGeneration(boolean enable)
- {
- ScenarioContext ctx = WebServicePlugin.getInstance().getScenarioContext();
- boolean previousSetting = ctx.getGenerateProxy();
- ctx.setGenerateProxy(enable);
- return previousSetting;
- }
-
- public static boolean enableOverwrite(boolean enable)
- {
- ResourceContext ctx = WebServicePlugin.getInstance().getResourceContext();
- boolean previousSetting = ctx.isOverwriteFilesEnabled();
- ctx.setOverwriteFilesEnabled(enable);
- return previousSetting;
- }
-
- public static void disableWSIDialog(IProject project){
-
- PersistentWSIContext ctx = WSPlugin.getInstance().getWSIAPContext();
- ctx.updateProjectWSICompliances(project, PersistentWSIContext.IGNORE_NON_WSI);
-
- PersistentWSIContext ctx2 = WSPlugin.getInstance().getWSISSBPContext();
- ctx2.updateProjectWSICompliances(project, PersistentWSIContext.IGNORE_NON_WSI);
-
- }
-
- public static void setWSRuntimeServer(String wsRuntimeId,String serverTypeId)
- {
- PersistentServerRuntimeContext serverRuntimeCtx = WebServiceConsumptionUIPlugin.getInstance().getServerRuntimeContext();
- serverRuntimeCtx.setRuntimeId(wsRuntimeId);
- serverRuntimeCtx.setServerFactoryId(serverTypeId);
- }
-
- private static IStatus launchWizard(String pluginNS,String wizardId,String objectClassId,IStructuredSelection initialSelection) throws Exception
- {
- IExtension[] extensions = Platform.getExtensionRegistry().getExtensionPoint("org.eclipse.ui.popupMenus").getExtensions();
- for (int i=0;i<extensions.length;i++)
- {
- if (extensions[i].getNamespace().equals(pluginNS));
- {
- IConfigurationElement[] configElements = extensions[i].getConfigurationElements();
- for (int j=0;j<configElements.length;j++)
- {
- if (configElements[j].getAttribute("id").equals(wizardId) && configElements[j].getAttribute("objectClass").equals(objectClassId))
- {
- IConfigurationElement actionElement = configElements[j].getChildren()[0];
- AccumulateStatusHandler statusHandler = new AccumulateStatusHandler();
- DynamicPopupJUnitWizard wizard = new DynamicPopupJUnitWizard(statusHandler);
- wizard.setInitializationData(actionElement,null,null);
- wizard.selectionChanged(null,initialSelection);
- wizard.run(null);
- return statusHandler.getStatus();
- }
- }
- }
- }
- return StatusUtils.errorStatus( "No wizard found for: " );
- }
-
- public static IStatus launchCreationWizard(String wizardId,String objectClassId,IStructuredSelection initialSelection) throws Exception
- {
- return launchWizard("org.eclipse.jst.ws.creation.ui",wizardId,objectClassId,initialSelection);
- }
-
- public static IStatus launchConsumptionWizard(String wizardId,String objectClassId,IStructuredSelection initialSelection) throws Exception
- {
- return launchWizard("org.eclipse.jst.ws.internal.consumption.ui",wizardId,objectClassId,initialSelection);
- }
-
- public static IStatus createWebModule(String webProjectName, String moduleName, String serverFactoryId, String j2eeVersion, IEnvironment env, IProgressMonitor monitor ){
-
- IStatus status = Status.OK_STATUS;
- try{
- CreateModuleCommand createWeb = new CreateModuleCommand();
- createWeb.setProjectName(webProjectName);
- createWeb.setModuleName(moduleName);
- createWeb.setModuleType(CreateModuleCommand.WEB);
- createWeb.setJ2eeLevel(j2eeVersion);
- createWeb.setServerFactoryId(serverFactoryId);
- createWeb.setEnvironment( env );
- return createWeb.execute( monitor, null );
- }
- catch (Exception e){
- status = StatusUtils.errorStatus( e );
- }
- return status;
-
- }
-
-} \ No newline at end of file
diff --git a/tests/org.eclipse.jst.ws.tests/tests/org/eclipse/jst/ws/tests/util/ScenarioConstants.java b/tests/org.eclipse.jst.ws.tests/tests/org/eclipse/jst/ws/tests/util/ScenarioConstants.java
deleted file mode 100644
index 015fa39dc..000000000
--- a/tests/org.eclipse.jst.ws.tests/tests/org/eclipse/jst/ws/tests/util/ScenarioConstants.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 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.jst.ws.tests.util;
-
-public class ScenarioConstants {
- // Bottom up Java or EJB to Web Service wizard ID.
- public static final String WIZARDID_BOTTOM_UP = "org.eclipse.jst.ws.creation.ui.wizard.serverwizard";
-
- // Top down WSDL to Skeleton Web Service wizard ID.
- public static final String WIZARDID_TOP_DOWN = "org.eclipse.jst.ws.creation.ui.wizard.serverwizard";
-
- // Web Service client wizard ID.
- public static final String WIZARDID_CLIENT = "org.eclipse.jst.ws.internal.consumption.ui.wizard.client.clientwizard";
-
- // Object class for:
- // 1) Java source (bottom-up)
- // 2) WSDL or WSIL (top-down or client).
- public static final String OBJECT_CLASS_ID_IFILE = "org.eclipse.core.resources.IFile";
-
- // Object class for Java compilation units (i.e. Java classes selected in the Java perspective).
- public static final String OBJECT_CLASS_ID_COMPILATIONUNIT = "org.eclipse.jdt.internal.core.CompilationUnit";
-
- // Object class for a service selected in the J2EE perspective (top-down or client).
- public static final String OBJECT_CLASS_ID_SERVICEIMPL = "org.eclipse.wst.wsdl.Service";
-
- // Object class for a WSDLResourceImpl (top-down or client).
- public static final String OBJECT_CLASS_ID_WSDLSERVICEIMPL = "org.eclipse.wst.wsdl.internal.util.WSDLResourceImpl";
-
- // Object class for a ServiceRef (top-down or client).
- public static final String OBJECT_CLASS_ID_SERVICEREF = "org.eclipse.jst.j2ee.webservice.wsclient.ServiceRef";
-
- // Object class for a ServiceImplBean (bottom-up).
- public static final String OBJECT_CLASS_ID_SERVICEIMPLBEAN = "org.eclipse.jst.j2ee.webservice.wsdd.ServiceImplBean";
-
- // Object class for a BeanLink (bottom-up).
- public static final String OBJECT_CLASS_ID_BEANLINK = "org.eclipse.jst.j2ee.webservice.wsdd.BeanLink";
-} \ No newline at end of file

Back to the top