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
diff options
context:
space:
mode:
authorkchan2007-01-10 15:14:43 +0000
committerkchan2007-01-10 15:14:43 +0000
commit71bd3e6539e2a2eae78cc737212c06cf6b6bace5 (patch)
treee728c33b90fa15f2a95ed64b964d5bc2bd0eee21 /tests/org.eclipse.jst.ws.tests
parent7114e47d1ee01050e23a296038e1968f256529cc (diff)
downloadwebtools.webservices-71bd3e6539e2a2eae78cc737212c06cf6b6bace5.tar.gz
webtools.webservices-71bd3e6539e2a2eae78cc737212c06cf6b6bace5.tar.xz
webtools.webservices-71bd3e6539e2a2eae78cc737212c06cf6b6bace5.zip
[114835] Add BU, TD, and Client scenarios to the JUnit tests.
Diffstat (limited to 'tests/org.eclipse.jst.ws.tests')
-rw-r--r--tests/org.eclipse.jst.ws.tests/tests/org/eclipse/jst/ws/tests/WSWizardTest.java10
-rw-r--r--tests/org.eclipse.jst.ws.tests/tests/org/eclipse/jst/ws/tests/unittest/AllWSJUnitTests.java18
-rw-r--r--tests/org.eclipse.jst.ws.tests/tests/org/eclipse/jst/ws/tests/unittest/BUJavaAxisTC50.java163
-rw-r--r--tests/org.eclipse.jst.ws.tests/tests/org/eclipse/jst/ws/tests/unittest/ClientAxisTC50.java154
-rw-r--r--tests/org.eclipse.jst.ws.tests/tests/org/eclipse/jst/ws/tests/unittest/ComponentCreationTests.java51
-rw-r--r--tests/org.eclipse.jst.ws.tests/tests/org/eclipse/jst/ws/tests/unittest/J2EEUtilsTests.java16
-rw-r--r--tests/org.eclipse.jst.ws.tests/tests/org/eclipse/jst/ws/tests/unittest/ServerCreationTests.java31
-rw-r--r--tests/org.eclipse.jst.ws.tests/tests/org/eclipse/jst/ws/tests/unittest/TDJavaAxisTC50.java148
-rw-r--r--tests/org.eclipse.jst.ws.tests/tests/org/eclipse/jst/ws/tests/util/JUnitUtils.java48
9 files changed, 589 insertions, 50 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
index 3d8402a94..13013834c 100644
--- 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
@@ -6,13 +6,15 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * IBM Corporation - initial API and implementation
+ * IBM Corporation - initial API and implementation
+ * yyyymmdd bug Email and other contact information
+ * -------- -------- -----------------------------------------------------------
+ * 2007104 114835 sengpl@ca.ibm.com - Seng Phung-Lu
*******************************************************************************/
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;
@@ -58,7 +60,7 @@ public abstract class WSWizardTest extends TestCase implements WSJUnitConstants
installServer();
// unzip pre-configured workspace projects
- if (!ProjectUtilities.getProject(WSJUnitConstants.BU_PROJECT_NAME).exists())
+ //if (!ProjectUtilities.getProject(WSJUnitConstants.BU_PROJECT_NAME).exists())
createProjects();
installInputData();
@@ -147,7 +149,7 @@ public abstract class WSWizardTest extends TestCase implements WSJUnitConstants
protected void tearDown() throws Exception
{
stopServer();
-// deleteServer();
+ deleteServer();
// deleteInputData();
// deleteServerRuntime();
}
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
index edd8b1cb1..4e5438c19 100644
--- 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
@@ -1,3 +1,16 @@
+/*******************************************************************************
+ * 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
+ * yyyymmdd bug Email and other contact information
+ * -------- -------- -----------------------------------------------------------
+ * 2007104 114835 sengpl@ca.ibm.com - Seng Phung-Lu
+ *******************************************************************************/
package org.eclipse.jst.ws.tests.unittest;
import junit.framework.Test;
@@ -64,10 +77,13 @@ public class AllWSJUnitTests extends TestCase implements WSJUnitConstants
String s = System.getProperty("org.eclipse.jst.server.tomcat.50");
if (s != null && s.length() > 0) {
testSuite.addTest( ServerCreationTests.suite());
+ testSuite.addTest( BUJavaAxisTC50.suite() );
+ testSuite.addTest( TDJavaAxisTC50.suite() );
+ testSuite.addTest( ClientAxisTC50.suite() );
+
}
testSuite.addTest( ResourceUtilsTests.suite() );
-
return testSuite;
}
diff --git a/tests/org.eclipse.jst.ws.tests/tests/org/eclipse/jst/ws/tests/unittest/BUJavaAxisTC50.java b/tests/org.eclipse.jst.ws.tests/tests/org/eclipse/jst/ws/tests/unittest/BUJavaAxisTC50.java
new file mode 100644
index 000000000..d5e357df7
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.tests/tests/org/eclipse/jst/ws/tests/unittest/BUJavaAxisTC50.java
@@ -0,0 +1,163 @@
+/*******************************************************************************
+ * 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
+ * yyyymmdd bug Email and other contact information
+ * -------- -------- -----------------------------------------------------------
+ * 2007104 114835 sengpl@ca.ibm.com - Seng Phung-Lu
+ *******************************************************************************/
+package org.eclipse.jst.ws.tests.unittest;
+
+import junit.framework.Test;
+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.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
+import org.eclipse.jface.viewers.StructuredSelection;
+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.CreateModuleCommand;
+import org.eclipse.jst.ws.tests.axis.tomcat.v50.WSWizardTomcat50Test;
+import org.eclipse.jst.ws.tests.util.JUnitUtils;
+import org.eclipse.jst.ws.tests.util.ScenarioConstants;
+
+/**
+ * Bottom up performance scenario with Axis and Tomcat v5.0
+ */
+public final class BUJavaAxisTC50 extends WSWizardTomcat50Test {
+ // Constants
+ private final String WS_RUNTIMEID_AXIS = WSJUnitConstants.WS_RUNTIMEID_AXIS;
+ private String PROJECT_NAME = WSJUnitConstants.BU_PROJECT_NAME;
+
+ private IFile sourceFile_;
+
+
+ public static Test suite(){
+ return new TestSuite(BUJavaAxisTC50.class);
+ }
+
+ /**
+ * Sets up the input data;
+ * - create project(s),
+ * - copy resources to workspace
+ */
+ protected void installInputData() throws Exception
+ {
+
+ IProject webProject = ProjectUtilities.getProject(PROJECT_NAME);
+ IPath destPath = ResourceUtils.getJavaSourceLocation(webProject);
+ IFolder folder = (IFolder)ResourceUtils.findResource(destPath);
+ JUnitUtils.copyTestData("BUJava/src",folder,env_, null);
+ sourceFile_ = folder.getFile(new Path("foo/Echo.java"));
+ // Ensure that Echo.class is built in:
+ // <Web Project>/WebContent/WEB-INF/classes/foo/Echo.class
+ JUnitUtils.syncBuildProject(webProject,env_, null);
+ //assertTrue(JUnitUtils.getClassesFolderForWebProject(WEB_PROJECT_NAME).getFile(new Path("foo/Echo.class")).exists());
+
+
+ }
+
+ protected void createProjects() throws Exception{
+ IProject webProject = ProjectUtilities.getProject(PROJECT_NAME);
+ if (webProject==null || !webProject.exists()){
+ createWebModule(PROJECT_NAME, PROJECT_NAME,J2EEVersionConstants.J2EE_1_4_ID);
+ }
+ }
+
+ private void createWebModule(String projectNm, String componentName, int j2eeVersion){
+
+ CreateModuleCommand cmc = new CreateModuleCommand();
+ cmc.setJ2eeLevel(new Integer(j2eeVersion).toString());
+ cmc.setModuleName(componentName);
+ cmc.setModuleType(CreateModuleCommand.WEB);
+ cmc.setProjectName(projectNm);
+ cmc.setServerFactoryId(SERVERTYPEID_TC50);
+ cmc.setServerInstanceId(server_.getId());
+ cmc.execute(null, null );
+
+ System.out.println("Done creating Web Project, "+projectNm);
+
+ }
+
+
+ /**
+ * Set the persistent server runtime context preferences
+ */
+ protected void initJ2EEWSRuntimeServerDefaults() throws Exception
+ {
+ // Set default preferences for Axis and Tomcat 5.0
+ JUnitUtils.setWSRuntimeServer(WS_RUNTIMEID_AXIS, SERVERTYPEID_TC50);
+ }
+
+ /**
+ * Set the initial selection
+ */
+ protected void initInitialSelection() throws Exception
+ {
+ initialSelection_ = new StructuredSelection(sourceFile_);
+ }
+
+ /**
+ * Launches the pop-up command to initiate the scenario
+ * @throws Exception
+ */
+ public void testBUJavaAxisTC50() throws Exception
+ {
+ IStatus status = Status.OK_STATUS;
+ IProject webProject = ProjectUtilities.getProject(PROJECT_NAME);
+ JUnitUtils.disableWSIDialog(webProject);
+
+ status = JUnitUtils.launchCreationWizard(ScenarioConstants.WIZARDID_BOTTOM_UP,ScenarioConstants.OBJECT_CLASS_ID_IFILE,initialSelection_);
+
+ if (status.getSeverity() == Status.OK)
+ verifyOutput();
+ else
+ throw new Exception(status.getException());
+
+ }
+
+ /**
+ * Verify the scenario completed successfully
+ * @throws Exception
+ */
+ private final void verifyOutput() throws Exception
+ {
+ IProject webProject = ProjectUtilities.getProject(PROJECT_NAME);
+ IFolder webContentFolder = (IFolder)J2EEUtils.getWebContentContainer(webProject);
+
+ IFolder wsdlFolder = webContentFolder.getFolder("wsdl");
+ assertTrue(wsdlFolder.exists());
+ assertTrue(wsdlFolder.members().length > 0);
+ assertTrue(webContentFolder.getFolder("wsdl").members().length > 0);
+
+ //TODO Check if wsdd contains new Web service
+ //TODO Check if Web serivce can be invoked by a client
+ }
+
+ /**
+ * Clear workspace if necessary
+ */
+ protected void deleteInputData() throws Exception
+ {
+ // Remove the EAR from the server.
+ IProject webProject = ProjectUtilities.getProject(PROJECT_NAME);
+ //JUnitUtils.removeModuleFromServer(server_,webProject,env_);
+
+ // Delete the Web project.
+ webProject.delete(true,true, null);
+ assertFalse(webProject.exists());
+
+ }
+}
diff --git a/tests/org.eclipse.jst.ws.tests/tests/org/eclipse/jst/ws/tests/unittest/ClientAxisTC50.java b/tests/org.eclipse.jst.ws.tests/tests/org/eclipse/jst/ws/tests/unittest/ClientAxisTC50.java
new file mode 100644
index 000000000..b5862cdbe
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.tests/tests/org/eclipse/jst/ws/tests/unittest/ClientAxisTC50.java
@@ -0,0 +1,154 @@
+/*******************************************************************************
+ * 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
+ * yyyymmdd bug Email and other contact information
+ * -------- -------- -----------------------------------------------------------
+ * 2007104 114835 sengpl@ca.ibm.com - Seng Phung-Lu
+ *******************************************************************************/
+package org.eclipse.jst.ws.tests.unittest;
+
+import junit.framework.Test;
+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.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
+import org.eclipse.jface.viewers.StructuredSelection;
+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.CreateModuleCommand;
+import org.eclipse.jst.ws.tests.axis.tomcat.v50.WSWizardTomcat50Test;
+import org.eclipse.jst.ws.tests.util.JUnitUtils;
+import org.eclipse.jst.ws.tests.util.ScenarioConstants;
+
+/**
+ * Client performance scenario with Axis and Tomcat v5.0
+ */
+public class ClientAxisTC50 extends WSWizardTomcat50Test {
+
+ private final String WS_RUNTIMEID_AXIS = WSJUnitConstants.WS_RUNTIMEID_AXIS;
+
+ private String CLIENT_PROJECT_NAME = WSJUnitConstants.CLIENT_PROJECT_NAME;
+
+ private IFile sourceFile_;
+
+
+ public static Test suite(){
+ return new TestSuite(ClientAxisTC50.class);
+ }
+
+ protected void createProjects() throws Exception{
+ IProject webProject = ProjectUtilities.getProject(CLIENT_PROJECT_NAME);
+ if (!webProject.exists()){
+ createWebModule(CLIENT_PROJECT_NAME, CLIENT_PROJECT_NAME,J2EEVersionConstants.J2EE_1_4_ID);
+ }
+ }
+
+ private void createWebModule(String projectNm, String componentName, int j2eeVersion){
+
+ CreateModuleCommand cmc = new CreateModuleCommand();
+ cmc.setJ2eeLevel(new Integer(j2eeVersion).toString());
+ cmc.setModuleName(componentName);
+ cmc.setModuleType(CreateModuleCommand.WEB);
+ cmc.setProjectName(projectNm);
+ cmc.setServerFactoryId(SERVERTYPEID_TC50);
+ cmc.setServerInstanceId(server_.getId());
+ cmc.execute(null, null );
+
+ }
+
+ /**
+ * Sets up the input data;
+ * - create project(s),
+ * - copy resources to workspace
+ */
+ protected void installInputData() throws Exception {
+
+ IProject webProject = ProjectUtilities.getProject(CLIENT_PROJECT_NAME);
+ IFolder destFolder = (IFolder)J2EEUtils.getWebContentContainer(webProject);
+ JUnitUtils.copyTestData("TDJava",destFolder,env_, null);
+ sourceFile_ = destFolder.getFile(new Path("Echo.wsdl"));
+ JUnitUtils.syncBuildProject(webProject,env_, null);
+
+ }
+
+ /**
+ * Set the persistent server runtime context preferences
+ */
+ protected void initJ2EEWSRuntimeServerDefaults() throws Exception {
+ // Set default preferences for Axis and Tomcat 5.0
+ JUnitUtils.setWSRuntimeServer(WS_RUNTIMEID_AXIS, SERVERTYPEID_TC50);
+ }
+
+ /**
+ * Set the initial selection
+ */
+ protected void initInitialSelection() throws Exception {
+ initialSelection_ = new StructuredSelection(sourceFile_);
+ }
+
+ /**
+ * Launches the pop-up command to initiate the scenario
+ * @throws Exception
+ */
+ public void testClientAxisTC50() throws Exception
+ {
+ IStatus status = Status.OK_STATUS;
+
+ JUnitUtils.enableProxyGeneration(true);
+ JUnitUtils.enableOverwrite(true);
+
+ status = JUnitUtils.launchCreationWizard(ScenarioConstants.WIZARDID_CLIENT,ScenarioConstants.OBJECT_CLASS_ID_IFILE,initialSelection_);
+
+
+ if (status.getSeverity() == Status.OK) {
+ verifyOutput();
+ } else {
+ throw new Exception(status.getException());
+ }
+
+ }
+
+ /**
+ * Verify the scenario completed succesfully
+ * @throws Exception
+ */
+ private final void verifyOutput() throws Exception {
+ IProject webProject = ProjectUtilities.getProject(CLIENT_PROJECT_NAME);
+
+ IPath destPath = ResourceUtils.getJavaSourceLocation(webProject);
+ IFolder srcFolder = (IFolder)ResourceUtils.findResource(destPath);
+
+ //IFolder srcFolder = JUnitUtils.getSourceFolderForWebProject(CLIENT_PROJECT_NAME);
+ IFolder folder = srcFolder.getFolder("foo");
+ assertTrue(folder.exists());
+ assertTrue(folder.members().length > 0);
+
+ //TODO Check that the client runs
+
+ }
+
+ /**
+ * Remove workspace if necessary
+ */
+ protected void deleteInputData() throws Exception {
+
+ // Delete the Web project.
+ IProject webProject = ProjectUtilities.getProject(CLIENT_PROJECT_NAME);
+ webProject.delete(true,true, null);
+
+ }
+
+}
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
index f4780b14d..bf0331b0f 100644
--- 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
@@ -1,6 +1,16 @@
-/**
+/*******************************************************************************
+ * 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
+ * yyyymmdd bug Email and other contact information
+ * -------- -------- -----------------------------------------------------------
+ * 2007104 114835 sengpl@ca.ibm.com - Seng Phung-Lu
+ *******************************************************************************/
package org.eclipse.jst.ws.tests.unittest;
import java.io.IOException;
@@ -20,8 +30,6 @@ 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
@@ -35,7 +43,8 @@ public class ComponentCreationTests extends TestCase implements WSJUnitConstants
public void testWebComponentCreation(){
createServerRuntime();
- createProjects();
+ createDynamicWebModule(projectNames);
+ //createProjects();
//createWebModule(projectName, projectName, J2EEVersionConstants.J2EE_1_4_ID);
//createWebModule(project2Name, project2Name, J2EEVersionConstants.J2EE_1_3_ID);
@@ -48,6 +57,7 @@ public class ComponentCreationTests extends TestCase implements WSJUnitConstants
return util.createProjects();
}
+
private static IPath getLocalPath() {
URL url = TestsPlugin.getDefault().find(zipFilePath);
try {
@@ -68,11 +78,27 @@ public class ComponentCreationTests extends TestCase implements WSJUnitConstants
}
}
+
+ public void createDynamicWebModule(String[] projectNames){
+
+ for (int i=0;i<projectNames.length;i++) {
+ CreateModuleCommand command = new CreateModuleCommand();
+ command.setProjectName(projectNames[i]);
+ command.setModuleName(projectNames[i]);
+ command.setModuleType(CreateModuleCommand.WEB);
+ command.setServerFactoryId(SERVERTYPEID_TC50);
+ command.setJ2eeLevel(new Integer(J2EEVersionConstants.J2EE_1_4_ID).toString());
+ command.execute( null, null ) ;
+
+ IProject p = ResourceUtils.getWorkspaceRoot().getProject(projectNames[i]);
+ assertTrue(p.exists());
+ }
+ }
public void dtestCreateEJBModule(){
CreateModuleCommand cmc = new CreateModuleCommand();
- cmc.setJ2eeLevel(new Integer(J2EEVersionConstants.J2EE_1_3_ID).toString());
+ cmc.setJ2eeLevel(new Integer(J2EEVersionConstants.J2EE_1_4_ID).toString());
cmc.setModuleName(ejbComponentName);
cmc.setModuleType(CreateModuleCommand.EJB);
cmc.setProjectName(ejbProjectName);
@@ -81,13 +107,12 @@ public class ComponentCreationTests extends TestCase implements WSJUnitConstants
System.out.println("Done creating EJB component.");
IProject p = ResourceUtils.getWorkspaceRoot().getProject(ejbProjectName);
- IVirtualComponent vc = ComponentCore.createComponent(p);
- assertTrue(vc.exists());
+ assertTrue(p.exists());
}
public void dtestCreateAppClientModule(){
CreateModuleCommand cmc = new CreateModuleCommand();
- cmc.setJ2eeLevel(new Integer(J2EEVersionConstants.J2EE_1_3_ID).toString());
+ cmc.setJ2eeLevel(new Integer(J2EEVersionConstants.J2EE_1_4_ID).toString());
cmc.setModuleName(appClientCompName);
cmc.setModuleType(CreateModuleCommand.APPCLIENT);
cmc.setProjectName(appClientProjectName);
@@ -96,13 +121,12 @@ public class ComponentCreationTests extends TestCase implements WSJUnitConstants
System.out.println("Done creating App client component.");
IProject p = ResourceUtils.getWorkspaceRoot().getProject(appClientProjectName);
- IVirtualComponent vc = ComponentCore.createComponent(p);
- assertTrue(vc.exists());
+ assertTrue(p.exists());
}
public void dtestCreateEARModule(){
CreateModuleCommand cmc = new CreateModuleCommand();
- cmc.setJ2eeLevel(new Integer(J2EEVersionConstants.J2EE_1_3_ID).toString());
+ cmc.setJ2eeLevel(new Integer(J2EEVersionConstants.J2EE_1_4_ID).toString());
cmc.setModuleName(earCompName);
cmc.setModuleType(CreateModuleCommand.EAR);
cmc.setProjectName(projectName);
@@ -111,7 +135,6 @@ public class ComponentCreationTests extends TestCase implements WSJUnitConstants
System.out.println("Done creating EAR component.");
IProject p = ResourceUtils.getWorkspaceRoot().getProject(projectName);
- IVirtualComponent vc = ComponentCore.createComponent(p);
- assertTrue(vc.exists());
+ assertTrue(p.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
index 18a135465..6fa77a3f0 100644
--- 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
@@ -1,6 +1,16 @@
-/**
+/*******************************************************************************
+ * 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
+ * yyyymmdd bug Email and other contact information
+ * -------- -------- -----------------------------------------------------------
+ * 2007104 114835 sengpl@ca.ibm.com - Seng Phung-Lu
+ *******************************************************************************/
package org.eclipse.jst.ws.tests.unittest;
import junit.framework.Test;
@@ -108,7 +118,7 @@ public class J2EEUtilsTests extends TestCase implements WSJUnitConstants{
IVirtualComponent vc2 = J2EEUtils.getVirtualComponent(project2);
int j2 = J2EEUtils.getJ2EEVersion(vc2);
System.out.println("J2EEVersions p1: "+j2);
- assertEquals(J2EEVersionConstants.SERVLET_2_3, j2);
+ assertEquals(J2EEVersionConstants.SERVLET_2_4, j2);
System.out.println("< END: testJ2EEVersionMethods ...");
}
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
index 12041b6ee..046d04a8a 100644
--- 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
@@ -1,12 +1,24 @@
-/**
+/*******************************************************************************
+ * 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
+ * yyyymmdd bug Email and other contact information
+ * -------- -------- -----------------------------------------------------------
+ * 2007104 114835 sengpl@ca.ibm.com - Seng Phung-Lu
+ *******************************************************************************/
package org.eclipse.jst.ws.tests.unittest;
+import junit.framework.AssertionFailedError;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
+import org.eclipse.core.runtime.CoreException;
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;
@@ -45,6 +57,13 @@ public class ServerCreationTests extends TestCase implements WSJUnitConstants{
}
assertNotNull(server);
+ try {
+ server.delete();
+ }
+ catch (CoreException ce){
+ new AssertionFailedError();
+ }
+
System.out.println("Done creating Tomcat v5 server.");
}
@@ -61,6 +80,14 @@ public class ServerCreationTests extends TestCase implements WSJUnitConstants{
}
assertNotNull(server);
+ try {
+ server.delete();
+ }
+ catch (CoreException ce){
+ new AssertionFailedError();
+ }
+
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/TDJavaAxisTC50.java b/tests/org.eclipse.jst.ws.tests/tests/org/eclipse/jst/ws/tests/unittest/TDJavaAxisTC50.java
new file mode 100644
index 000000000..936c6c615
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.tests/tests/org/eclipse/jst/ws/tests/unittest/TDJavaAxisTC50.java
@@ -0,0 +1,148 @@
+/*******************************************************************************
+ * 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
+ * yyyymmdd bug Email and other contact information
+ * -------- -------- -----------------------------------------------------------
+ * 2007104 114835 sengpl@ca.ibm.com - Seng Phung-Lu
+ *******************************************************************************/
+package org.eclipse.jst.ws.tests.unittest;
+
+import junit.framework.Test;
+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.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jst.j2ee.internal.J2EEVersionConstants;
+import org.eclipse.jst.ws.internal.common.J2EEUtils;
+import org.eclipse.jst.ws.internal.consumption.command.common.CreateModuleCommand;
+import org.eclipse.jst.ws.tests.axis.tomcat.v50.WSWizardTomcat50Test;
+import org.eclipse.jst.ws.tests.util.JUnitUtils;
+import org.eclipse.jst.ws.tests.util.ScenarioConstants;
+
+/**
+ * Top down performance scenario with Axis and Tomcat v5.0
+ */
+public class TDJavaAxisTC50 extends WSWizardTomcat50Test {
+
+ private final String WS_RUNTIMEID_AXIS = WSJUnitConstants.WS_RUNTIMEID_AXIS;
+
+ private String PROJECT_NAME = WSJUnitConstants.TD_PROJECT_NAME;
+
+ private IFile sourceFile_;
+
+
+ public static Test suite(){
+ return new TestSuite(TDJavaAxisTC50.class);
+ }
+
+ protected void createProjects() throws Exception{
+ IProject webProject = ProjectUtilities.getProject(PROJECT_NAME);
+ if (!webProject.exists()){
+ createWebModule(PROJECT_NAME, PROJECT_NAME,J2EEVersionConstants.J2EE_1_4_ID);
+ }
+ }
+
+ private void createWebModule(String projectNm, String componentName, int j2eeVersion){
+
+ CreateModuleCommand cmc = new CreateModuleCommand();
+ cmc.setJ2eeLevel(new Integer(j2eeVersion).toString());
+ cmc.setModuleName(componentName);
+ cmc.setModuleType(CreateModuleCommand.WEB);
+ cmc.setProjectName(projectNm);
+ cmc.setServerFactoryId(SERVERTYPEID_TC50);
+ cmc.setServerInstanceId(server_.getId());
+ cmc.execute(null, null );
+
+ System.out.println("Done creating Web Project, "+projectNm);
+
+ }
+
+ /**
+ * Sets up the input data;
+ * - create project(s),
+ * - copy resources to workspace
+ */
+ protected void installInputData() throws Exception {
+
+ IProject webProject = ProjectUtilities.getProject(PROJECT_NAME);
+ IFolder destFolder = (IFolder)J2EEUtils.getWebContentContainer(webProject);
+ JUnitUtils.copyTestData("TDJava",destFolder,env_, null);
+ sourceFile_ = destFolder.getFile(new Path("Echo.wsdl"));
+ JUnitUtils.syncBuildProject(webProject,env_, null);
+ }
+
+ /**
+ * Set the persistent server runtime context preferences
+ */
+ protected void initJ2EEWSRuntimeServerDefaults() throws Exception {
+ // Set default preferences for Axis and Tomcat v5.0 server
+ JUnitUtils.setWSRuntimeServer(WS_RUNTIMEID_AXIS, SERVERTYPEID_TC50);
+ }
+
+ /**
+ * Set the initial selection
+ */
+ protected void initInitialSelection() throws Exception {
+ initialSelection_ = new StructuredSelection(sourceFile_);
+
+ }
+
+ /**
+ * Launches the pop-up command to initiate the scenario
+ * @throws Exception
+ */
+ public void testTDJavaAxisTC50() throws Exception {
+
+ IStatus status = Status.OK_STATUS;
+
+ status = JUnitUtils.launchCreationWizard(ScenarioConstants.WIZARDID_TOP_DOWN,ScenarioConstants.OBJECT_CLASS_ID_IFILE,initialSelection_);
+
+ if (status.getSeverity() == Status.OK)
+ verifyOutput();
+ else {
+ System.err.println(status.getMessage());
+ throw new Exception(status.getException());
+ }
+ }
+
+ /**
+ * Verify the scenario completed successfully
+ * @throws Exception
+ */
+ private final void verifyOutput() throws Exception
+ {
+ IProject webProject = ProjectUtilities.getProject(PROJECT_NAME);
+ IFolder webContentFolder = (IFolder)J2EEUtils.getWebContentContainer(webProject);
+
+
+ IFolder wsdlFolder = webContentFolder.getFolder("wsdl");
+ assertTrue(wsdlFolder.exists());
+ assertTrue(wsdlFolder.members().length > 0);
+
+ //TODO Verify that wsdd contains this Web service
+ //TODO Verify that the service can be invoked by a client
+ }
+
+ /**
+ * Clear workspace if required
+ */
+ protected void deleteInputData() throws Exception {
+ // Delete the Web project.
+ IProject webProject = ProjectUtilities.getProject(PROJECT_NAME);
+ webProject.delete(true,true,null);
+
+ }
+
+}
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
index 1ec8b4aee..287e6c450 100644
--- 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
@@ -6,7 +6,10 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * IBM Corporation - initial API and implementation
+ * IBM Corporation - initial API and implementation
+ * yyyymmdd bug Email and other contact information
+ * -------- -------- -----------------------------------------------------------
+ * 2007104 114835 sengpl@ca.ibm.com - Seng Phung-Lu
*******************************************************************************/
package org.eclipse.jst.ws.tests.util;
@@ -17,15 +20,13 @@ 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.dialogs.ProgressMonitorDialog;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jst.ws.internal.common.ServerUtils;
@@ -42,8 +43,10 @@ import org.eclipse.wst.command.internal.env.context.PersistentActionDialogsConte
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.EclipseStatusHandler;
import org.eclipse.wst.command.internal.env.ui.eclipse.EnvironmentUtils;
import org.eclipse.wst.common.environment.IEnvironment;
+import org.eclipse.wst.common.environment.IStatusHandler;
import org.eclipse.wst.server.core.IModule;
import org.eclipse.wst.server.core.IRuntime;
import org.eclipse.wst.server.core.IRuntimeType;
@@ -299,30 +302,23 @@ public class JUnitUtils {
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: " );
+ IStatusHandler statusHandler = new EclipseStatusHandler();
+
+ DynamicPopupJUnitWizard wizard = new DynamicPopupJUnitWizard(statusHandler);
+ wizard.setInitialData(wizardId);
+ ProgressMonitorDialog monitor = new ProgressMonitorDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
+ try {
+ wizard.runHeadLess(initialSelection, monitor);
+ }
+ catch (Exception e){
+ e.printStackTrace();
+ return StatusUtils.errorStatus(e);
+ }
+ return Status.OK_STATUS;
+
}
public static IStatus launchCreationWizard(String wizardId,String objectClassId,IStructuredSelection initialSelection) throws Exception

Back to the top