diff options
Diffstat (limited to 'bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test')
24 files changed, 0 insertions, 3314 deletions
diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/ClientTestDelegateCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/ClientTestDelegateCommand.java deleted file mode 100644 index 271982326..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/ClientTestDelegateCommand.java +++ /dev/null @@ -1,355 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 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 - * -------- -------- ----------------------------------------------------------- - * 20060524 142635 gilberta@ca.ibm.com - Gilbert Andrews - * 20060608 145529 kathy@ca.ibm.com - Kathy Chan - *******************************************************************************/ - -package org.eclipse.jst.ws.internal.consumption.ui.widgets.test; - -import java.util.List; -import java.util.Vector; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jst.ws.internal.context.ScenarioContext; -import org.eclipse.jst.ws.internal.data.TypeRuntimeServer; -import org.eclipse.jst.ws.internal.ext.test.WebServiceTestExtension; -import org.eclipse.jst.ws.internal.ext.test.WebServiceTestRegistry; -import org.eclipse.wst.command.internal.env.core.ICommandFactory; -import org.eclipse.wst.command.internal.env.core.common.StatusUtils; -import org.eclipse.wst.command.internal.env.core.selection.BooleanSelection; -import org.eclipse.wst.command.internal.env.core.selection.SelectionList; -import org.eclipse.wst.common.environment.IEnvironment; -import org.eclipse.wst.common.environment.IStatusHandler; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; -import org.eclipse.wst.server.core.IServer; -import org.eclipse.wst.server.core.ServerCore; -import org.eclipse.wst.ws.internal.wsrt.IWebServiceTester; -import org.eclipse.wst.ws.internal.wsrt.TestInfo; - - -/* -* The JSPGeneration task runs the jsp generation engine found in the -* JBWizard Plugin -* -* -*/ -public class ClientTestDelegateCommand extends AbstractDataModelOperation -{ - private WebServiceTestRegistry testRegistry; - private SelectionList testFacilities; - private String jspFolder; - private BooleanSelection[] methods; - private String sampleServerTypeID; - private IServer sampleExistingServer; - private String proxyBean; - private boolean runTestClient; - private String sampleProject; - private String sampleP; - private String clientProject; - private String clientP; - private String clientC; - private boolean clientNeedEAR; - private String clientEarProjectName; - private String clientEarComponentName; - private TypeRuntimeServer serverIds; - private String serviceProject; - private String serviceP; - private String wsdlServiceURL; - private boolean isTestWidget = false; - private String setEndpointMethod; - private List endpoints; - - public ClientTestDelegateCommand () - { - testRegistry = WebServiceTestRegistry.getInstance(); - } - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - IEnvironment env = getEnvironment(); - IStatus status = Status.OK_STATUS; - String clientTestID = testFacilities.getSelection(); - - //Get the webservice extension - - WebServiceTestExtension wscte = (WebServiceTestExtension)testRegistry.getWebServiceExtensionsByName(clientTestID); - IWebServiceTester iwst = (IWebServiceTester)wscte.getWebServiceExecutableExtension(); - TestInfo testInfo = getTestInfo(); - - status = commandFactoryExecution(iwst.generate(testInfo),env, monitor ); - if(status.getSeverity() == Status.ERROR){ - return status; - } - - testInfo.setRunTestClient(runTestClient); - - status = commandFactoryExecution(iwst.launch(testInfo),env, monitor ); - if(status.getSeverity() == Status.ERROR){ - return status; - } - return status; - } - - private IStatus commandFactoryExecution(ICommandFactory commandFactory,IEnvironment env, IProgressMonitor monitor ) - { - IStatus status = Status.OK_STATUS; - - while(commandFactory.hasNext()) - { - AbstractDataModelOperation operation = commandFactory.getNextCommand(); - operation.setEnvironment( env ); - - try - { - status = operation.execute( monitor, null ); - } - catch( Exception exc ) - { - status = StatusUtils.errorStatus( exc ); - } - - if(status.getSeverity() == Status.ERROR){ - IStatusHandler sHandler = env.getStatusHandler(); - sHandler.reportError(status); - return status; - } - } - return status; - } - - - //Helper method which sets up the TestInfo data structure - private TestInfo getTestInfo() - { - IServer serviceExistingServer = null; - String serviceServerTypeID = null; - - //service server info - if(serverIds != null){ - if (serverIds.getServerInstanceId() != null) - serviceExistingServer = ServerCore.findServer(serverIds.getServerInstanceId()); - } - if (serviceExistingServer != null) - serviceServerTypeID = serviceExistingServer.getServerType().getId(); - - - if(clientProject != null){ - int index = clientProject.indexOf("/"); - if (index!=-1){ - clientP = clientProject.substring(0,index); - clientC = clientProject.substring(index + 1); - } - } - - - if(sampleProject != null){ - int index = sampleProject.indexOf("/"); - if (index!=-1){ - sampleP = sampleProject.substring(0,index); - } - } - - TestInfo testInfo = new TestInfo(); - testInfo.setClientExistingServer(sampleExistingServer); - testInfo.setClientServerTypeID(sampleServerTypeID); - testInfo.setJspFolder(jspFolder); - testInfo.setExternalBrowser(false); - testInfo.setEndpoint(endpoints); - testInfo.setGenerationProject(sampleP); - testInfo.setProxyBean(proxyBean); - testInfo.setSetEndpointMethod(setEndpointMethod); - testInfo.setClientProject(clientP); - testInfo.setClientModule(clientC); - testInfo.setClientNeedEAR(clientNeedEAR); - testInfo.setClientEARProject(clientEarProjectName); - testInfo.setClientEARModule(clientEarComponentName); - testInfo.setMethods(methods); - - //if this is a client scenario the service stuff is empty - if(serviceServerTypeID == null){ - serviceServerTypeID = sampleServerTypeID; - serviceExistingServer = sampleExistingServer; - } - - - testInfo.setServiceServerTypeID(serviceServerTypeID); - testInfo.setServiceExistingServer(serviceExistingServer); - //wsdl stuff - testInfo.setServiceProject(getWSDLProject()); - testInfo.setWsdlServiceURL(wsdlServiceURL); - return testInfo; - } - - - - //The test facilities retrieved from the extension - //plus the default - public void setTestFacility(SelectionList selection) - { - testFacilities = selection; - } - - public void setFolder(String folder) - { - } - - public void setJspFolder(String jspFolder) - { - this.jspFolder = jspFolder; - } - - public void setMethods(BooleanSelection[] methods) - { - this.methods = methods; - } - - public void setRunTestClient(boolean runTestClient) - { - this.runTestClient = runTestClient; - } - - public void setProxyBean(String proxyBean) - { - this.proxyBean = proxyBean; - } - - public void setSampleProject(String sampleProject) - { - this.sampleProject = sampleProject; - } - - public void setClientProject(String clientProject) - { - this.clientProject = clientProject; - } - - public void setScenarioContext(ScenarioContext scenarioContext) - { - } - - public void setClientTestRegistry(WebServiceTestRegistry testRegistry) - { - this.testRegistry = testRegistry; - } - - public void setSampleServerTypeID(String sampleServerTypeID) - { - this.sampleServerTypeID = sampleServerTypeID; - } - - public void setSampleExistingServer(IServer sampleExistingServer) - { - this.sampleExistingServer = sampleExistingServer; - } - - public void setClientTypeRuntimeServer(TypeRuntimeServer ids) - { - } - - public void setServiceTypeRuntimeServer(TypeRuntimeServer ids) - { - serverIds = ids; - } - - public String getSampleServerTypeID() - { - return sampleServerTypeID; - } - - public IServer getSampleExistingServer() - { - return sampleExistingServer; - } - - public void setClientServer(String clientServer) - { - } - - public void setServerProject(String serviceProject) - { - this.serviceProject = serviceProject; - } - - public String getWSDLProject() - { - if(serviceProject != null){ - int index = serviceProject.indexOf("/"); - if (index!=-1) { - serviceP = serviceProject.substring(0,index); - return serviceP; - } - } - - return clientP; - } - - public void setWsdlURI(String wsdlServiceURL) - { - this.wsdlServiceURL = wsdlServiceURL; - } - - public void setGenerateProxy(boolean generateProxy) - { - } - - public boolean getIsTestWidget() - { - return isTestWidget; - } - - public void setClientEarProjectName(String clientEarProjectName) - { - this.clientEarProjectName = clientEarProjectName; - } - - public void setClientEarComponentName(String clientEarComponentName) - { - this.clientEarComponentName = clientEarComponentName; - } - - - - /** - * @param setEndpointMethod The setEndpointMethod to set. - */ - public void setSetEndpointMethod(String setEndpointMethod) - { - this.setEndpointMethod = setEndpointMethod; - } - /** - * @param endpoint The endpoint to set. - */ - public void setEndpoint(String endpoint) - { - if (endpoint != null && endpoint.length() > 0) - { - Vector v = new Vector(); - v.add(endpoint); - setEndpoints(v); - } - } - - public void setEndpoints(List endpoints) - { - this.endpoints = endpoints; - } - - public boolean getClientNeedEAR() { - return clientNeedEAR; - } - - public void setClientNeedEAR(boolean clientNeedEAR) { - this.clientNeedEAR = clientNeedEAR; - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/ClientTestFragment.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/ClientTestFragment.java deleted file mode 100644 index 08638af05..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/ClientTestFragment.java +++ /dev/null @@ -1,85 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 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 - * -------- -------- ----------------------------------------------------------- - * 20060727 144354 kathy@ca.ibm.com - Kathy Chan - * 20070502 180304 gilberta@ca.ibm.com - Gilbert Andrews - *******************************************************************************/ -/** - */ -package org.eclipse.jst.ws.internal.consumption.ui.widgets.test; - -import org.eclipse.wst.command.internal.env.core.common.Condition; -import org.eclipse.wst.command.internal.env.core.fragment.BooleanFragment; -import org.eclipse.wst.command.internal.env.core.fragment.SequenceFragment; -import org.eclipse.wst.command.internal.env.core.fragment.SimpleFragment; - - -public class ClientTestFragment extends BooleanFragment -{ - private boolean testService; - private boolean genProxy; // This actually represent whether client test is requested - private boolean launchedTest = false; - private boolean canGenProxy; - - public ClientTestFragment( String id ) - { - SequenceFragment clientTestRoot = new SequenceFragment(); - Condition condition = new Condition() - { - public boolean evaluate() - { - return testService && genProxy; - } - }; - setCondition( condition ); - - - Condition jspCondition = new Condition() - { - public boolean evaluate() - { - return canGenProxy; - } - }; - - SimpleFragment simpleJSPFragment = new SimpleFragment( new WebServiceClientTestArrivalCommand(), "" ); - BooleanFragment choiceJSPFragment = new BooleanFragment(); - choiceJSPFragment.setTrueFragment(simpleJSPFragment); - choiceJSPFragment.setCondition(jspCondition); - clientTestRoot.add(choiceJSPFragment); - - clientTestRoot.add( new SimpleFragment( id ) ); - setTrueFragment( clientTestRoot ); - - } - - public void setGenerateProxy( boolean genProxy ) - { - this.genProxy = genProxy; - } - - public void setCanGenerateProxy( boolean canGenProxy ) - { - this.canGenProxy = canGenProxy; - } - - public void setTestService( Boolean testService ) - { - this.testService = testService.booleanValue(); - } - - - - public boolean getLaunchedTest() - { - return launchedTest; - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/ClientTestWidget.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/ClientTestWidget.java deleted file mode 100644 index 6b579d3ba..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/ClientTestWidget.java +++ /dev/null @@ -1,480 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 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 - * -------- -------- ----------------------------------------------------------- - * 20060524 142635 gilberta@ca.ibm.com - Gilbert Andrews - * 20060815 104870 makandre@ca.ibm.com - Andrew Mak, enable/disable test page controls base on settings in test facility extension - * 20060815 153903 makandre@ca.ibm.com - Andrew Mak, Browse does not work in generate client test page - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.widgets.test; - -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jst.ws.internal.common.ResourceUtils; -import org.eclipse.jst.ws.internal.consumption.common.FolderResourceFilter; -import org.eclipse.jst.ws.internal.consumption.ui.ConsumptionUIMessages; -import org.eclipse.jst.ws.internal.ext.test.WebServiceTestExtension; -import org.eclipse.jst.ws.internal.ext.test.WebServiceTestRegistry; -import org.eclipse.jst.ws.internal.ui.common.UIUtils; -import org.eclipse.jst.ws.internal.ui.dialog.DialogUtils; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Group; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Listener; -import org.eclipse.swt.widgets.Text; -import org.eclipse.swt.widgets.Tree; -import org.eclipse.swt.widgets.TreeItem; -import org.eclipse.ui.PlatformUI; -import org.eclipse.wst.command.internal.env.core.selection.BooleanSelection; -import org.eclipse.wst.command.internal.env.core.selection.SelectionList; -import org.eclipse.wst.command.internal.env.ui.widgets.SimpleWidgetDataContributor; -import org.eclipse.wst.command.internal.env.ui.widgets.WidgetDataEvents; - - -public class ClientTestWidget extends SimpleWidgetDataContributor -{ - private String pluginId_ = "org.eclipse.jst.ws.consumption.ui"; - - /*CONTEXT_ID PWSM0001 for the Sample Page*/ - private String INFOPOP_PWSM_PAGE = "PWSM0001"; - // - private Button testCheckbox_; - /*CONTEXT_ID PWSM0002 for the Test check box of the Sample Page*/ - private String INFOPOP_PWSM_CHECKBOX_TEST = "PWSM0002"; - - private Combo testTypeCombo_; - /*CONTEXT_ID PWSM0003 for the Test Type Combo box of the Sample Page*/ - private String INFOPOP_PWSM_COMBOBOX_TEST = "PWSM0003"; - - private Text jspFolderText_; - /*CONTEXT_ID PWSM0008 for the JSP Folder field of the Sample Page*/ - private String INFOPOP_PWSM_TEXT_JSP_FOLDER = "PWSM0008"; - - private Button sampleFolderBrowseButton_; - /*CONTEXT_ID PWSM0009 for the JSP Folder Browse button of the Sample Page*/ - private String INFOPOP_PWSM_BUTTON_JSP_FOLDER_BROWSE = "PWSM0009"; - - private Combo projectCombo_; - /*CONTEXT_ID PWSM0010 for the Project combo box of the Sample Page*/ - private String INFOPOP_PWSM_COMBO_PROJECT = "PWSM0010"; - - private Tree methodsTree_; - - private Button selectAllMethodsButton_; - /*CONTEXT_ID PWSM0006 for the Select All button of the Sample Page*/ - private String INFOPOP_PWSM_BUTTON_SELECT_ALL = "PWSM0006"; - - private Button deselectAllMethodsButton_; - /*CONTEXT_ID PWSM0007 for the Deselect All button of the Sample Page*/ - private String INFOPOP_PWSM_BUTTON_DESELECT_ALL = "PWSM0007"; - - private Text sampleFolderText_; - /*CONTEXT_ID PWSM0014 for the Folder field of the Sample Page*/ - private String INFOPOP_PWSM_TEXT_SAMPLE_FOLDER = "PWSM0014"; - // - private Button runTestCheckbox_; - /*CONTEXT_ID PWSM0015 for the run test check box of the Sample Page*/ - private String INFOPOP_PWSM_CHECKBOX_LAUNCH = "PWSM0015"; - // - private Combo earCombo_; - /*CONTEXT_ID PWSM0016 for the EAR combo box of the Sample Page*/ - private String INFOPOP_PWSM_EAR_COMBO = "PWSM0016"; - - private Composite comboGroup_; - private SelectionList testFacilities_; - private FolderResourceFilter folderFilter_ = new FolderResourceFilter(); - private IStructuredSelection initialSelection_; - private boolean isTestWidget = false; - - private IPath webContentPath_; - private IResource webContent_; - - public WidgetDataEvents addControls( Composite parent, Listener statusListener ) - { - isTestWidget = true; - UIUtils uiUtils = new UIUtils( pluginId_ ); - - parent.setToolTipText( ConsumptionUIMessages.TOOLTIP_PWSM_PAGE ); - PlatformUI.getWorkbench().getHelpSystem().setHelp( parent, pluginId_ + "." + INFOPOP_PWSM_PAGE ); - - testCheckbox_ = uiUtils.createCheckbox( parent, ConsumptionUIMessages.BUTTON_TEST, - ConsumptionUIMessages.TOOLTIP_PWSM_CHECKBOX_TEST, - INFOPOP_PWSM_CHECKBOX_TEST ); - testCheckbox_.addSelectionListener( new SelectionAdapter() - { - public void widgetSelected( SelectionEvent evt ) - { - handleTestButton(); - } - }); - - comboGroup_ = uiUtils.createComposite( parent, 3, 5, 0 ); - - testTypeCombo_ = uiUtils.createCombo( comboGroup_, ConsumptionUIMessages.LABEL_TEST_TYPES, - ConsumptionUIMessages.TOOLTIP_PWSM_COMBOBOX_TEST, - INFOPOP_PWSM_COMBOBOX_TEST, - SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY ); - testTypeCombo_.addSelectionListener( - new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - handleTestFacilitySelection(); - } - } - ); - - new Label( comboGroup_, SWT.NONE ); - - projectCombo_ = uiUtils.createCombo( comboGroup_, ConsumptionUIMessages.LABEL_JSP_PROJECT_NAME, - ConsumptionUIMessages.TOOLTIP_PWSM_COMBO_PROJECT, - INFOPOP_PWSM_COMBO_PROJECT, - SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY ); - projectCombo_.setEnabled( false ); - new Label( comboGroup_, SWT.NONE ); - - - earCombo_ = uiUtils.createCombo( comboGroup_, ConsumptionUIMessages.LABEL_EAR_PROJECTS, - ConsumptionUIMessages.TOOLTIP_PWSM_EAR_PROJECT, - INFOPOP_PWSM_EAR_COMBO, - SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY ); - earCombo_.setEnabled( false ); - new Label( comboGroup_, SWT.NONE ); - - - - sampleFolderText_ = uiUtils.createText( comboGroup_, ConsumptionUIMessages.LABEL_FOLDER_NAME, - ConsumptionUIMessages.TOOLTIP_PWSM_TEXT_SAMPLE_FOLDER, - INFOPOP_PWSM_TEXT_SAMPLE_FOLDER, - SWT.SINGLE | SWT.BORDER ); - - sampleFolderText_.addModifyListener( new ModifyListener() - { - public void modifyText( ModifyEvent evt ) - { - handleFolderText(); - } - }); - - - sampleFolderBrowseButton_ = uiUtils.createPushButton( comboGroup_, ConsumptionUIMessages.BUTTON_BROWSE, - ConsumptionUIMessages.TOOLTIP_PWSM_BUTTON_JSP_FOLDER_BROWSE, - INFOPOP_PWSM_BUTTON_JSP_FOLDER_BROWSE ); - sampleFolderBrowseButton_.addSelectionListener( new SelectionAdapter() - { - public void widgetSelected( SelectionEvent evt ) - { - handleSampleBrowse(); - } - }); - - jspFolderText_ = uiUtils.createText( comboGroup_, ConsumptionUIMessages.LABEL_JSP_FOLDER_NAME, - ConsumptionUIMessages.TOOLTIP_PWSM_TEXT_JSP_FOLDER, - INFOPOP_PWSM_TEXT_JSP_FOLDER, - SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY ); - jspFolderText_.setEnabled( false ); - - Group methodsGroup = uiUtils.createGroup( parent, ConsumptionUIMessages.LABEL_METHODS, - ConsumptionUIMessages.TOOLTIP_PWSM_TREE_METHODS, null ); - - methodsGroup.setLayoutData( uiUtils.createFillAll() ); - - GridLayout layout = new GridLayout(); - layout.marginHeight = 0; - layout.marginWidth = 0; - methodsGroup.setLayout( layout ); - - // TODO No infopop for this tree. - methodsTree_ = uiUtils.createTree( methodsGroup, ConsumptionUIMessages.TOOLTIP_PWSM_TREE_METHODS, - null, - SWT.MULTI | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.CHECK ); - - Composite selectButtons = uiUtils.createComposite( methodsGroup, 2 ); - - selectAllMethodsButton_ - = uiUtils.createPushButton( selectButtons, ConsumptionUIMessages.BUTTON_SELECT_ALL, - ConsumptionUIMessages.TOOLTIP_PWSM_BUTTON_SELECT_ALL, - INFOPOP_PWSM_BUTTON_SELECT_ALL ); - selectAllMethodsButton_.addSelectionListener( new SelectionAdapter() - { - public void widgetSelected( SelectionEvent evt ) - { - handleSelectAll( true ); - } - }); - - deselectAllMethodsButton_ - = uiUtils.createPushButton( selectButtons, ConsumptionUIMessages.BUTTON_DESELECT_ALL, - ConsumptionUIMessages.TOOLTIP_PWSM_BUTTON_DESELECT_ALL, - INFOPOP_PWSM_BUTTON_DESELECT_ALL ); - deselectAllMethodsButton_.addSelectionListener( new SelectionAdapter() - { - public void widgetSelected( SelectionEvent evt ) - { - handleSelectAll( false ); - } - }); - - runTestCheckbox_ = uiUtils.createCheckbox( parent, ConsumptionUIMessages.BUTTON_RUN_TEST, - ConsumptionUIMessages.TOOLTIP_PWSM_CHECKBOX_LAUNCH, - INFOPOP_PWSM_CHECKBOX_LAUNCH ); - - return this; - } - - private void handleFolderText() - { - // webContentPath_ is set when jspFolderText_ is set for the first time. Therefore, - // if webContentPath_ is still null, there is no need to touch jspFolderText_ yet. - - if (webContentPath_ == null) - return; - - String folder = sampleFolderText_.getText(); - jspFolderText_.setText(webContentPath_.toString() + IPath.SEPARATOR + folder); - } - - private void handleSampleBrowse() - { - IPath selectedPath = null; - IResource initialResource = null; - - try - { - initialResource = ResourceUtils.getResourceFromSelection( initialSelection_ ); - } - catch( CoreException exc ) - { - } - - if( initialResource == null )initialResource = webContent_; - - IResource resource = DialogUtils.browseResources( comboGroup_.getShell(), - webContent_, - initialResource, - folderFilter_ ); - - if( resource != null ) - { - selectedPath = resource.getFullPath(); - - int webModuleSegments = selectedPath.matchingFirstSegments(webContentPath_); - - if ( webModuleSegments < webContentPath_.segmentCount() ) - { - sampleFolderText_.setText(""); - handleFolderText(); - } - else - { - sampleFolderText_.setText(selectedPath.removeFirstSegments(webModuleSegments).toString()); - handleFolderText(); - } - } - } - - private void handleTestButton() - { - boolean enabled = testCheckbox_.getSelection(); - - testTypeCombo_.setEnabled( enabled ); - - if (enabled && testFacilities_ != null) { - handleTestFacilitySelection(); - return; - } - - sampleFolderText_.setEnabled( enabled ); - methodsTree_.setEnabled( enabled ); - runTestCheckbox_.setEnabled( enabled ); - selectAllMethodsButton_.setEnabled( enabled ); - deselectAllMethodsButton_.setEnabled( enabled ); - sampleFolderBrowseButton_.setEnabled( enabled ); - } - - private void handleTestFacilitySelection() { - - String clientTestID = getTestFacility().getSelection(); - - WebServiceTestExtension testExtension = - (WebServiceTestExtension) WebServiceTestRegistry.getInstance() - .getWebServiceExtensionsByName(clientTestID); - - boolean hasCodeGen = testExtension.isCodeGenNeeded(); - - // folder selection is only applicable for test facilities with codegen - sampleFolderText_.setEnabled( hasCodeGen ); - sampleFolderBrowseButton_.setEnabled( hasCodeGen && webContent_ != null ); - - boolean hasMethods = testExtension.areMethodsNeeded(); - - // method selection is only applicable for test facilities with methods - methodsTree_.setEnabled( hasMethods ); - selectAllMethodsButton_.setEnabled( hasMethods ); - deselectAllMethodsButton_.setEnabled( hasMethods ); - - // run on server only applicable for test facilities that needs launching - runTestCheckbox_.setEnabled( testExtension.isServerNeeded() ); - } - - private void handleSelectAll( boolean value ) - { - TreeItem[] items = methodsTree_.getItems(); - - for( int i = 0; i < items.length; i++ ) - { - items[i].setChecked(value); - } - } - - // Here are the getters and setters for this widget. - public void setTestService( Boolean testService ) - { - testCheckbox_.setSelection( testService.booleanValue() ); - handleTestButton(); - } - - public Boolean getTestService() - { - return new Boolean( testCheckbox_.getSelection() ); - } - - public void setTestFacility( SelectionList testFacilities ) - { - testFacilities_ = testFacilities; - testTypeCombo_.setItems( testFacilities.getList() ); - testTypeCombo_.select( testFacilities.getIndex() ); - handleTestFacilitySelection(); - } - - public SelectionList getTestFacility() - { - testFacilities_.setIndex( testTypeCombo_.getSelectionIndex() ); - return testFacilities_; - } - - public String getTestID() - { - return testTypeCombo_.getText(); - } - - /** - * Given a project name which may be of the (obsolete) format "project/module", - * return only the project part of the name - * - * @param project The project name. - * @return If the name has the format "project/module", returns only "project", - * otherwise returns the name as is. - */ - private String extractProjectName(String project) { - - int index = project.indexOf("/"); - - if (index != -1) - project = project.substring(0, index); - - return project; - } - - public void setSampleProject(String clientProject) - { - projectCombo_.setItems( new String[]{ extractProjectName(clientProject) } ); - projectCombo_.select(0); - } - - public void setSampleProjectEAR(String clientProjectEAR) - { - earCombo_.setItems( new String[]{ extractProjectName(clientProjectEAR) } ); - earCombo_.select(0); - } - - public String getFolder() - { - return sampleFolderText_.getText(); - } - - public void setFolder( String folder ) - { - sampleFolderText_.setText( folder ); - } - - public boolean getIsTestWidget() - { - return isTestWidget; - } - - public void setJspFolder( String folder ) - { - webContentPath_ = (new Path(folder)).removeLastSegments(1); - webContent_ = ResourceUtils.findResource(webContentPath_); - sampleFolderBrowseButton_.setEnabled(webContent_ != null); - - jspFolderText_.setText( folder ); - } - - public String getJspFolder() - { - return jspFolderText_.getText(); - } - - public void setLaunchedServiceTestName (String launchedServiceTestName) - { - } - - public boolean getRunTestClient() - { - return runTestCheckbox_.getSelection(); - } - - public void setRunTestClient( boolean value ) - { - runTestCheckbox_.setSelection( value ); - } - - public BooleanSelection[] getMethods() - { - TreeItem[] items = methodsTree_.getItems(); - BooleanSelection[] methods = new BooleanSelection[items.length]; - - for( int index = 0; index < items.length; index++ ) - { - methods[index] = new BooleanSelection( items[index].getText(), items[index].getChecked() ); - } - - return methods; - } - - public void setMethods( BooleanSelection[] methods ) - { - methodsTree_.removeAll(); - - for( int index = 0; index < methods.length; index++ ) - { - if(methods[index] == null)continue; - TreeItem item = new TreeItem( methodsTree_, SWT.NULL ); - item.setText( methods[index].getValue() ); - item.setChecked( methods[index].isSelected() ); - } - } - - public void setInitialSelection( IStructuredSelection selection ) - { - initialSelection_ = selection; - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/CopyWebServiceUtilsJarCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/CopyWebServiceUtilsJarCommand.java deleted file mode 100644 index b87d2725f..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/CopyWebServiceUtilsJarCommand.java +++ /dev/null @@ -1,137 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 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 - * -------- -------- ----------------------------------------------------------- - * 20060912 157039 makandre@ca.ibm.com - Andrew Mak, new webserviceutils.jar not copied in client generation - * 20061025 161250 makandre@ca.ibm.com - Andrew Mak, Installations or workspace paths with spaces break Sample Gen and Java Editor Launch - *******************************************************************************/ - -package org.eclipse.jst.ws.internal.consumption.ui.widgets.test; - -import java.io.File; -import java.net.URL; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.FileLocator; -import org.eclipse.core.runtime.IAdaptable; -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.Plugin; -import org.eclipse.core.runtime.Status; -import org.eclipse.jem.util.emf.workbench.ProjectUtilities; -import org.eclipse.jst.ws.internal.common.J2EEUtils; -import org.eclipse.jst.ws.internal.consumption.ConsumptionMessages; -import org.eclipse.jst.ws.internal.consumption.plugin.WebServiceConsumptionPlugin; -import org.eclipse.wst.command.internal.env.common.FileResourceUtils; -import org.eclipse.wst.command.internal.env.core.common.ProgressUtils; -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.core.context.TransientResourceContext; -import org.eclipse.wst.common.environment.IEnvironment; -import org.eclipse.wst.common.environment.IStatusHandler; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; -import org.eclipse.wst.ws.internal.common.BundleUtils; - - -public class CopyWebServiceUtilsJarCommand extends AbstractDataModelOperation -{ - private String sampleProject; - -/** - * Default CTOR; - */ - - -public CopyWebServiceUtilsJarCommand() -{ - -} - -/** - * Execute the command - */ -public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) -{ - IEnvironment env = getEnvironment(); - - try - { - ProgressUtils.report( monitor, ConsumptionMessages.PROGRESS_INFO_COPY_WEBSERVICE_UTILS ); - IProject sampleIProject = ProjectUtilities.getProject(sampleProject); - IPath webModulePath = J2EEUtils.getWebContentPath(sampleIProject); - if (webModulePath == null) - return StatusUtils.errorStatus( ConsumptionMessages.MSG_ERROR_PROJECT_NOT_FOUND ); - - IStatus status = copyIFile("webserviceutils.jar",webModulePath,"WEB-INF/lib/webserviceutils.jar", WebServiceConsumptionPlugin.getInstance(),env, monitor); - if(status.getSeverity() == Status.ERROR){ - IStatusHandler sHandler = env.getStatusHandler(); - IStatus errorStatus = StatusUtils.errorStatus( ConsumptionMessages.MSG_ERROR_FILECOPY_WEBSERVICE_UTILS ); - sHandler.reportError(errorStatus); - return status; - } - - - } - catch (Exception e) { - IStatusHandler sHandler = env.getStatusHandler(); - IStatus errorStatus = StatusUtils.errorStatus( ConsumptionMessages.MSG_ERROR_FILECOPY_WEBSERVICE_UTILS ); - sHandler.reportError(errorStatus); - return StatusUtils.errorStatus( ConsumptionMessages.MSG_ERROR_FILECOPY_WEBSERVICE_UTILS, e); - } - return Status.OK_STATUS; -} - -/** - * - */ -private IStatus copyIFile(String source, IPath targetPath, String targetFile, Plugin plugin,IEnvironment env, IProgressMonitor monitor ) -{ - - if (plugin != null) - { - IPath target = targetPath.append(new Path(targetFile)); - - ProgressUtils.report( monitor, ConsumptionMessages.PROGRESS_INFO_COPYING_FILE ); - try - { - ResourceContext context = new TransientResourceContext(); - context.setOverwriteFilesEnabled(true); - context.setCreateFoldersEnabled(true); - context.setCheckoutFilesEnabled(true); - IResource resource = FileResourceUtils.findResource(target); - URL sourceURL = BundleUtils.getURLFromBundle( WebServiceConsumptionPlugin.ID, source ); - if(resource != null) { - File sourceFile = new File(FileLocator.toFileURL(sourceURL).getPath()); - if (resource.getLocation().toFile().length() == sourceFile.length()) - return Status.OK_STATUS; - } - FileResourceUtils.createFile(context, - target, - sourceURL.openStream(), - monitor, - env.getStatusHandler()); - } - catch (Exception e) { - return StatusUtils.errorStatus( ConsumptionMessages.MSG_ERROR_FILECOPY_WEBSERVICE_UTILS ,e); - } - } - return Status.OK_STATUS; -} - -public void setSampleProject(String sampleProject) -{ - this.sampleProject = sampleProject; -} - - -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/FinishDefaultCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/FinishDefaultCommand.java deleted file mode 100644 index 6a73995ac..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/FinishDefaultCommand.java +++ /dev/null @@ -1,73 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2005 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.internal.consumption.ui.widgets.test; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; -import org.eclipse.wst.server.core.IServer; -import org.eclipse.wst.server.core.ServerCore; - - -/* -* The JSPGeneration task runs the jsp generation engine found in the -* JBWizard Plugin -* -* -*/ -public class FinishDefaultCommand extends AbstractDataModelOperation -{ - private String sampleServerTypeID; - private IServer sampleExistingServer; - private String sampleServerInstanceId; - - - public FinishDefaultCommand () - { - } - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - IStatus status = Status.OK_STATUS; - if(sampleServerInstanceId != null){ - sampleExistingServer = ServerCore.findServer(sampleServerInstanceId); - if (sampleExistingServer != null) - sampleServerTypeID = sampleExistingServer.getServerType().getId(); - - } - return status; - - } - - public void setServerInstanceId(String serverInstanceId) - { - this.sampleServerInstanceId = serverInstanceId; - } - - public String getSampleServerTypeID() - { - return sampleServerTypeID; - - } - - public IServer getSampleExistingServer() - { - return sampleExistingServer; - } - - public void setExistingServerId(String existingServerId) - { - } - -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/FinishJavaTestFragment.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/FinishJavaTestFragment.java deleted file mode 100644 index 94ca347e7..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/FinishJavaTestFragment.java +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 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 - *******************************************************************************/ -/* - * Created on May 4, 2004 - * - * TODO To change the template for this generated file go to - * Window - Preferences - Java - Code Style - Code Templates - */ -package org.eclipse.jst.ws.internal.consumption.ui.widgets.test; - -import org.eclipse.jst.ws.internal.consumption.command.common.BuildProjectCommand; -import org.eclipse.wst.command.internal.env.core.common.Condition; -import org.eclipse.wst.command.internal.env.core.fragment.BooleanFragment; -import org.eclipse.wst.command.internal.env.core.fragment.SequenceFragment; -import org.eclipse.wst.command.internal.env.core.fragment.SimpleFragment; - - -/** - * @author gilberta - * - * TODO To change the template for this generated type comment go to - * Window - Preferences - Java - Code Style - Code Templates - */ -public class FinishJavaTestFragment extends BooleanFragment -{ - private boolean generateProxy; - - public FinishJavaTestFragment() - { - SequenceFragment javaTestRoot = new SequenceFragment(); - Condition condition = new Condition() - { - public boolean evaluate() - { - return generateProxy; - } - }; - setCondition(condition); - javaTestRoot.add(new SimpleFragment(new TestClientDepartureInitCommand(), "")); - javaTestRoot.add(new SimpleFragment(new BuildProjectCommand(), "")); - setTrueFragment(javaTestRoot); - } - - public void setGenerateProxy(boolean generateProxy) - { - this.generateProxy = generateProxy; - } - - public void setIsJSPGen(boolean jspGen) - { - - } - - - -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/FinishTestFragment.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/FinishTestFragment.java deleted file mode 100644 index c9eb16fe2..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/FinishTestFragment.java +++ /dev/null @@ -1,109 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 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 - * -------- -------- ----------------------------------------------------------- - * 20060727 144354 kathy@ca.ibm.com - Kathy Chan - * 20070502 180304 gilberta@ca.ibm.com - Gilbert Andrews - *******************************************************************************/ -/* - * Created on May 4, 2004 - * - * TODO To change the template for this generated file go to - * Window - Preferences - Java - Code Style - Code Templates - */ -package org.eclipse.jst.ws.internal.consumption.ui.widgets.test; - -import org.eclipse.jst.ws.internal.context.ScenarioContext; -import org.eclipse.jst.ws.internal.ext.test.WebServiceTestExtension; -import org.eclipse.jst.ws.internal.ext.test.WebServiceTestRegistry; -import org.eclipse.jst.ws.internal.plugin.WebServicePlugin; -import org.eclipse.wst.command.internal.env.core.common.Condition; -import org.eclipse.wst.command.internal.env.core.fragment.BooleanFragment; - - -/** - * @author gilberta - * - * TODO To change the template for this generated type comment go to - * Window - Preferences - Java - Code Style - Code Templates - */ -public class FinishTestFragment extends BooleanFragment{ - - private boolean isTestWidget; - private boolean generateProxy; // This actually represent whether client test is requested - private String launchedServiceTestName; - private boolean testService; - private String testID; - public FinishTestFragment() - { - Condition condition = new Condition() - { - public boolean evaluate() - { - if(!testService) return false; - if(launchedServiceTestName == null) return true; - if(launchedServiceTestName != null) - if((!launchedServiceTestName.equals("") && (!isPreferedAWSDLTest() || (isTestWidget && isClientTestJava())) && generateProxy) || launchedServiceTestName.equals("")) return true; - - return false; - } - }; - - setTrueFragment(new WebServiceTestClientDepartureFragment()); - setCondition(condition); - } - - public void setLaunchedServiceTestName(String launchedServiceTestName) - { - this.launchedServiceTestName = launchedServiceTestName; - } - - public boolean isPreferedAWSDLTest() - { - ScenarioContext scenarioContext = WebServicePlugin.getInstance().getScenarioContext().copy(); - String[] testTypes = scenarioContext.getWebServiceTestTypes(); - WebServiceTestRegistry wsttRegistry = WebServiceTestRegistry.getInstance(); - WebServiceTestExtension wscte = (WebServiceTestExtension)wsttRegistry.getWebServiceExtensionsByName(testTypes[0]); - if(wscte.testWSDL()) - return true; - return false; - } - - public boolean isClientTestJava() - { - if(testID == null) return false; - WebServiceTestRegistry wsttRegistry = WebServiceTestRegistry.getInstance(); - WebServiceTestExtension wscte = (WebServiceTestExtension)wsttRegistry.getWebServiceExtensionsByName(testID); - if(!wscte.testWSDL()) - return true; - return false; - } - - - public void setTestService(boolean testService) - { - this.testService = testService; - } - - public void setCanGenerateProxy(boolean generateProxy) - { - this.generateProxy = generateProxy; - } - - public void setTestID(String testID) - { - this.testID = testID; - } - - public void setIsTestWidget(boolean isTestWidget) - { - this.isTestWidget = isTestWidget; - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/TestClientDepartureInitCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/TestClientDepartureInitCommand.java deleted file mode 100644 index 21f2f7466..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/TestClientDepartureInitCommand.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 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 - *******************************************************************************/ -/* - * Created on Mar 25, 2004 - * - * To change the template for this generated file go to - * Window - Preferences - Java - Code Generation - Code and Comments - */ -package org.eclipse.jst.ws.internal.consumption.ui.widgets.test; - -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; - -/** - * @author gilberta - * - * To change the template for this generated type comment go to - * Window - Preferences - Java - Code Generation - Code and Comments - */ -public class TestClientDepartureInitCommand extends AbstractDataModelOperation -{ - - private boolean forceBuild; - - public TestClientDepartureInitCommand() - { - forceBuild = true; - } - - public boolean getForceBuild() - { - return forceBuild; - } - - public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException - { - return Status.OK_STATUS; - } - -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/TestDefaultingFragment.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/TestDefaultingFragment.java deleted file mode 100644 index a246e7cbc..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/TestDefaultingFragment.java +++ /dev/null @@ -1,135 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 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 - * -------- -------- ----------------------------------------------------------- - * 20060727 144354 kathy@ca.ibm.com - Kathy Chan - * 20060821 153833 makandre@ca.ibm.com - Andrew Mak, Allow the Web Service Test extension point to specify the supported client runtime - * 20060907 156606 makandre@ca.ibm.com - Andrew Mak, no sample JSP in the pop-up action of Generate Sample JSPs - *******************************************************************************/ -/* - * Created on May 4, 2004 - * - * TODO To change the template for this generated file go to - * Window - Preferences - Java - Code Style - Code Templates - */ -package org.eclipse.jst.ws.internal.consumption.ui.widgets.test; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jst.ws.internal.context.ScenarioContext; -import org.eclipse.jst.ws.internal.ext.test.WebServiceTestExtension; -import org.eclipse.jst.ws.internal.ext.test.WebServiceTestRegistry; -import org.eclipse.jst.ws.internal.plugin.WebServicePlugin; -import org.eclipse.wst.command.internal.env.core.selection.SelectionList; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; - - -/** - * @author gilberta - * - * TODO To change the template for this generated type comment go to - * Window - Preferences - Java - Code Style - Code Templates - */ -public class TestDefaultingFragment extends AbstractDataModelOperation -{ - - private SelectionList testFacilities; - private String launchedServiceTestName; - private ScenarioContext scenarioContext; - private boolean generateProxy; // This actually represent whether client test is requested - - private String clientRuntimeId_; - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - IStatus status = Status.OK_STATUS; - - scenarioContext = WebServicePlugin.getInstance().getScenarioContext().copy(); - // test facilities - selectTestFacility(); - return status; - } - - // The test facilities retrieved from the extension - // plus the default - public SelectionList getTestFacility() - { - return testFacilities; - } - - - - // *********************** - // This method uses the preference to - // select the correct test facility - // - //*********************** - private void selectTestFacility() - { - //if we find something we launched earlier - //put it on the bottom - String[] testTypes = scenarioContext.getWebServiceTestTypes(); - List newTestTypes = new ArrayList(); - String[] wsdlCases = scenarioContext.getNonJavaTestService(); - boolean launched = false; - - for(int i = 0;i<testTypes.length;i++){ - - WebServiceTestExtension extension = - (WebServiceTestExtension) WebServiceTestRegistry.getInstance() - .getWebServiceExtensionsByName(testTypes[i]); - - if (clientRuntimeId_ != null && !extension.supportsRuntime(clientRuntimeId_)) - continue; - - if(testTypes[i].equals(launchedServiceTestName)) - launched = true; - else{ - newTestTypes.add(testTypes[i]); - } - } - - if(launched) - newTestTypes.add(launchedServiceTestName); - - - if(!generateProxy) - testFacilities = new SelectionList(wsdlCases,0); - else { - String[] tempArray = new String[newTestTypes.size()]; - testFacilities = new SelectionList((String[]) newTestTypes.toArray(tempArray), 0); - } - } - - public void setLaunchedServiceTestName(String launchedServiceTestName) - { - this.launchedServiceTestName = launchedServiceTestName; - } - - public void setGenerateProxy(boolean generateProxy) - { - this.generateProxy = generateProxy; - } - - /** - * Sets the client runtime ID. - * - * @param clientRuntimeId The client runtime ID. - */ - public void setClientRuntimeId(String clientRuntimeId) { - clientRuntimeId_ = clientRuntimeId; - } - -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/TestWebServiceClient.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/TestWebServiceClient.java deleted file mode 100644 index a4efaabcb..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/TestWebServiceClient.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2005 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.internal.consumption.ui.widgets.test; - -import org.eclipse.wst.command.internal.env.core.ICommandFactory; -import org.eclipse.wst.common.environment.IEnvironment; -import org.eclipse.wst.ws.internal.wsrt.AbstractWebServiceClient; -import org.eclipse.wst.ws.internal.wsrt.IContext; -import org.eclipse.wst.ws.internal.wsrt.ISelection; -import org.eclipse.wst.ws.internal.wsrt.WebServiceClientInfo; - -public class TestWebServiceClient extends AbstractWebServiceClient { - - public TestWebServiceClient(WebServiceClientInfo clientInfo){ - super(clientInfo); - } - - public ICommandFactory assemble(IEnvironment env, IContext ctx, ISelection sel, - String project, String earProject){ - return null; - } - - public ICommandFactory deploy(IEnvironment env, IContext ctx, ISelection sel, - String project, String earProject){ - return null; - } - - - public ICommandFactory develop(IEnvironment env, IContext ctx, ISelection sel, - String project, String earProject){ - return null; - } - - public ICommandFactory install(IEnvironment env, IContext ctx, ISelection sel, - String project, String earProject){ - return null; - } - - - public ICommandFactory run(IEnvironment env, IContext ctx, ISelection sel, - String project, String earProject){ - return null; - } - -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/WSDLFinishFragment.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/WSDLFinishFragment.java deleted file mode 100644 index 74553e5de..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/WSDLFinishFragment.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 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 - *******************************************************************************/ -/* - * Created on May 4, 2004 - * - * TODO To change the template for this generated file go to - * Window - Preferences - Java - Code Style - Code Templates - */ -package org.eclipse.jst.ws.internal.consumption.ui.widgets.test; - -import org.eclipse.wst.command.internal.env.core.fragment.BooleanFragment; - -/** - * @author gilberta - * - * TODO To change the template for this generated type comment go to - * Window - Preferences - Java - Code Style - Code Templates - */ -public class WSDLFinishFragment extends BooleanFragment{ - - -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/WSDLTestLaunchCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/WSDLTestLaunchCommand.java deleted file mode 100644 index 646a72ad5..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/WSDLTestLaunchCommand.java +++ /dev/null @@ -1,189 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 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 - *******************************************************************************/ -/* - * Created on May 4, 2004 - * - * Window - Preferences - Java - Code Style - Code Templates - */ -package org.eclipse.jst.ws.internal.consumption.ui.widgets.test; - -import java.util.List; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jst.ws.internal.consumption.ui.ConsumptionUIMessages; -import org.eclipse.jst.ws.internal.data.TypeRuntimeServer; -import org.eclipse.jst.ws.internal.ext.test.WebServiceTestExtension; -import org.eclipse.jst.ws.internal.ext.test.WebServiceTestRegistry; -import org.eclipse.wst.command.internal.env.core.ICommandFactory; -import org.eclipse.wst.command.internal.env.core.common.StatusUtils; -import org.eclipse.wst.common.environment.IEnvironment; -import org.eclipse.wst.common.environment.IStatusHandler; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; -import org.eclipse.wst.server.core.IServer; -import org.eclipse.wst.server.core.ServerCore; -import org.eclipse.wst.ws.internal.wsrt.IWebServiceTester; -import org.eclipse.wst.ws.internal.wsrt.TestInfo; - -/** - * @author gilberta - * - * Window - Preferences - Java - Code Style - Code Templates - */ -public class WSDLTestLaunchCommand extends AbstractDataModelOperation -{ - private String testID; - private String launchedServiceTestName; - private TypeRuntimeServer serviceids; - private String serverProject; - private String serverModule; - private String wsdlURI; - private boolean externalBrowser; - private List endpoints; - private IServer serviceExistingServer = null; - private String serviceServerTypeID = null; - private String serviceServerInstanceId = null; - - public WSDLTestLaunchCommand() - { - } - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - IEnvironment env = getEnvironment(); - IStatus status = Status.OK_STATUS; - - WebServiceTestRegistry testRegistry = WebServiceTestRegistry.getInstance(); - WebServiceTestExtension wscte = (WebServiceTestExtension)testRegistry.getWebServiceExtensionsByName(testID); - IWebServiceTester iwst = (IWebServiceTester)wscte.getWebServiceExecutableExtension(); - TestInfo testInfo = getTestInfo(); - - - status = commandFactoryExecution(iwst.launch(testInfo),env, monitor); - - //Dont need to shut everything down because the wsdl test doesnt work - if(status.getSeverity() != Status.OK){ - IStatusHandler sHandler = env.getStatusHandler(); - IStatus infoStatus = StatusUtils.infoStatus( ConsumptionUIMessages.MSG_ERROR_UNABLE_TO_LAUNCH_WSDL_TEST ); - sHandler.reportInfo(infoStatus); - return infoStatus; - } - return status; - - } - - private IStatus commandFactoryExecution(ICommandFactory commandFactory,IEnvironment env, IProgressMonitor monitor) - { - IStatus status = Status.OK_STATUS; - while(commandFactory.hasNext()) - { - AbstractDataModelOperation operation = commandFactory.getNextCommand(); - - if (operation != null) - { - try - { - operation.setEnvironment( env ); - status = operation.execute( monitor, null ); - } - catch( Exception exc ) - { - status = StatusUtils.errorStatus( exc ); - } - } - - if(status.getSeverity() == Status.ERROR){ - IStatusHandler sHandler = env.getStatusHandler(); - sHandler.reportError(status); - return status; - } - } - return status; - } - - - private TestInfo getTestInfo() - { - // get the server stuff - if (serviceids.getServerInstanceId() != null) - serviceExistingServer = ServerCore.findServer(serviceids.getServerInstanceId()); - else if (serviceServerInstanceId!=null) - serviceExistingServer = ServerCore.findServer(serviceServerInstanceId); - - if (serviceExistingServer != null) - serviceServerTypeID = serviceExistingServer.getServerType().getId(); - else - serviceServerTypeID = serviceids.getServerId(); - // server will be created in ServerDeployableConfigurationCommand - - TestInfo testInfo = new TestInfo(); - if (serviceExistingServer!=null) - testInfo.setServiceExistingServer(serviceExistingServer); - testInfo.setServiceServerTypeID(serviceServerTypeID); - testInfo.setServiceProject(serverProject); - testInfo.setWsdlServiceURL(wsdlURI); - testInfo.setExternalBrowser(externalBrowser); - testInfo.setEndpoint(endpoints); - return testInfo; - - } - - - public void setTestID(String testID) - { - this.testID = testID; - } - - public String getLaunchedServiceTestName() - { - return launchedServiceTestName; - } - public void setWsdlURI(String wsdlURI) - { - this.wsdlURI = wsdlURI; - } - - public void setServerProject(String serverProject) - { - this.serverProject = serverProject; - } - - - public void setServiceTypeRuntimeServer(TypeRuntimeServer serviceids) - { - this.serviceids = serviceids; - } - - public void setExternalBrowser(boolean externalBrowser) - { - this.externalBrowser = externalBrowser; - } - - public void setEndpoint(List endpoints) - { - this.endpoints = endpoints; - } - -public String getServerModule() { - return serverModule; -} - -public void setServerModule(String serverModule) { - this.serverModule = serverModule; -} - -public void setServiceServerInstanceId(String ssInstanceId){ - this.serviceServerInstanceId = ssInstanceId; -} - -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/WebServiceClientTestArrivalCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/WebServiceClientTestArrivalCommand.java deleted file mode 100644 index 9cd65589a..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/WebServiceClientTestArrivalCommand.java +++ /dev/null @@ -1,276 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - * -------- -------- ----------------------------------------------------------- - * 20060608 144500 mahutch@ca.ibm.com - Mark Hutchinson - * 20060818 153903 makandre@ca.ibm.com - Andrew Mak, Browse does not work in generate client test page - * 20060906 154548 gilberta@ca.ibm.com - Gilbert Andrews, This fixes name collisions when creating a sample project - * 20060922 158177 makandre@ca.ibm.com - Andrew Mak, NPE when creating web service client into existing Java project with test - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.widgets.test; - -import java.util.List; -import java.util.ListIterator; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jem.java.JavaClass; -import org.eclipse.jem.java.JavaHelpers; -import org.eclipse.jem.java.Method; -import org.eclipse.jem.util.emf.workbench.ProjectUtilities; -import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities; -import org.eclipse.jst.ws.internal.common.J2EEUtils; -import org.eclipse.jst.ws.internal.consumption.command.common.JavaMofReflectionCommand; -import org.eclipse.jst.ws.internal.consumption.ui.ConsumptionUIMessages; -import org.eclipse.wst.command.internal.env.core.common.StatusUtils; -import org.eclipse.wst.command.internal.env.core.selection.BooleanSelection; -import org.eclipse.wst.common.environment.IEnvironment; -import org.eclipse.wst.common.environment.IStatusHandler; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; - - -/** -* This task sets up all the defaults for the webservice test -* client page -* -*/ -public class WebServiceClientTestArrivalCommand extends AbstractDataModelOperation -{ - public static final String DEFAULT_WEB_MODULE_ROOT = "WebContent"; - public static final String DEFAULT_SAMPLE_WEB_PROJECT_EXT = "Sample"; - - public static String SAMPLE_DIR = "sample"; - - private String clientProject; - private String clientProjectEAR; - private String clientP; - private String clientC; - private IProject clientIProject; - private String folder; - private String jspFolder; - private BooleanSelection[] methods; - private String proxyBean; - private String sampleProject; - private String sampleP; - private String sampleC; - private String sampleProjectEAR; - - - - /** - * Constructs a new WebServiceClientTestArrivalTask object with the given label and description. - */ - public WebServiceClientTestArrivalCommand () - { - - } - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - IEnvironment env = getEnvironment(); - - IStatus status = Status.OK_STATUS; - - sampleProjectAndEarSetup(env); - IPath webcontentPath = null; - - // *need* to double-check that clientIProject is a web project - if (J2EEUtils.isWebComponent(clientIProject)) - webcontentPath = J2EEUtils.getWebContentPath(clientIProject); - - //Get the sample Folder ready - StringBuffer sb = new StringBuffer(); - - if (webcontentPath != null) - { - String path = webcontentPath.toString(); - sb.append(path).append("/"); - } - else - { //then just use the default - sb.append("/").append(sampleC).append("/").append(DEFAULT_WEB_MODULE_ROOT).append("/"); - } - folder = SAMPLE_DIR + getBean(); - - sb.append(folder); - jspFolder = sb.toString(); - - //get the method names ready - //find the full path of the file in the project - /* - * Getting the method names using javamof introspection - */ - if(proxyBean == null){ - IStatusHandler sHandler = env.getStatusHandler(); - IStatus errorStatus = StatusUtils.errorStatus( ConsumptionUIMessages.MSG_ERROR_JTS_PROXY_NOT_COMPILED ); - sHandler.reportError(errorStatus); - return errorStatus; - - } - - - JavaMofReflectionCommand javamofcommand = new JavaMofReflectionCommand(); - javamofcommand.setProxyBean(proxyBean); - javamofcommand.setClientProject(clientP); - javamofcommand.setEnvironment( env ); - - - - try{ - IStatus mofStatus = javamofcommand.execute( monitor, null); - if(mofStatus.getSeverity() == Status.ERROR) - return mofStatus; - }catch(Exception exc){ - IStatusHandler sHandler = env.getStatusHandler(); - IStatus errorStatus = StatusUtils.errorStatus( ConsumptionUIMessages.MSG_ERROR_JTS_PROXY_NOT_COMPILED ); - sHandler.reportError(errorStatus); - return errorStatus; - } - JavaHelpers javaHelpers = javamofcommand.getJavaClass(); - if (javaHelpers == null) return status; - - JavaClass javaClass = null; - if(javaHelpers instanceof JavaClass) - javaClass = (JavaClass)javaHelpers; - else return status; - List methodList = javaClass.getPublicMethods(); - BooleanSelection[] tempMethods = new BooleanSelection[methodList.size()]; - ListIterator listIterator = methodList.listIterator(); - - int j = 0; - while (listIterator.hasNext()) - { - Method method = (Method)listIterator.next(); - if(method.isConstructor()) continue; - - tempMethods[j] = new BooleanSelection( method.getMethodElementSignature(), true); - j++; - } - methods = tempMethods; - return status; - } - public static final String DEFAULT_SAMPLE_EAR_PROJECT_EXT = "EAR"; - - private void sampleProjectAndEarSetup(IEnvironment env) - { - if(clientProject == null) return; - else{ - int index = clientProject.indexOf("/"); - clientP = clientProject.substring(0,index); - clientC = clientProject.substring(index + 1); - } - - clientIProject = (IProject)ProjectUtilities.getProject(clientP); - - if(J2EEUtils.isWebComponent(clientIProject)){ - sampleProject = clientProject; - sampleP = clientP; - sampleC = clientC; - } - else{ - sampleP = clientP + DEFAULT_SAMPLE_WEB_PROJECT_EXT; - sampleC = clientC + DEFAULT_SAMPLE_WEB_PROJECT_EXT; - sampleProject = sampleP + "/" + sampleC; - - String sampleTemp = sampleP; - - boolean nameFound = false; - int i = 1; - while(!nameFound){ - IProject sampleIProject = (IProject)ProjectUtilities.getProject(sampleTemp); - if(sampleIProject.exists() && !J2EEProjectUtilities.isDynamicWebProject(sampleIProject)){ - sampleTemp = sampleP + Integer.toString(i); - sampleProject = sampleTemp + "/" + sampleC; - - } - else - nameFound = true; - - i++; - } - sampleP = sampleTemp; - - } - - - - - sampleProjectEAR = clientProjectEAR; - if (sampleProjectEAR == null || sampleProjectEAR.length()==0){ - sampleProjectEAR = sampleP + DEFAULT_SAMPLE_EAR_PROJECT_EXT + "/" + sampleC + DEFAULT_SAMPLE_EAR_PROJECT_EXT; - } - - } - - //getters and setters - - private String getBean() - { - int index = proxyBean.lastIndexOf("."); - String end = ""; - if(index != -1){ - end = proxyBean.substring(index + 1); - } - String bean = end.substring(0,end.length()); - - return bean; - } - - - - - public String getFolder() - { - return folder; - } - - public String getJspFolder() - { - return jspFolder; - } - - public BooleanSelection[] getMethods() - { - return methods; - } - - public String getSampleProject() - { - return sampleProject; - } - - public void setClientProject(String clientProject) - { - this.clientProject = clientProject; - } - - - public void setClientProjectEAR(String clientProjectEAR) - { - this.clientProjectEAR = clientProjectEAR; - } - - - public void setProxyBean(String proxyBean) - { - this.proxyBean = proxyBean; - } - - public String getSampleProjectEAR() - { - return sampleProjectEAR; - } - - -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/WebServiceTestClientDepartureFragment.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/WebServiceTestClientDepartureFragment.java deleted file mode 100644 index fd945a71d..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/WebServiceTestClientDepartureFragment.java +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 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 - *******************************************************************************/ -/* - * Created on Mar 25, 2004 - * - * To change the template for this generated file go to - * Window - Preferences - Java - Code Generation - Code and Comments - */ -package org.eclipse.jst.ws.internal.consumption.ui.widgets.test; - -import org.eclipse.jst.ws.internal.consumption.command.common.BuildProjectCommand; -import org.eclipse.jst.ws.internal.consumption.ui.widgets.test.wssample.AddModuleDependenciesCommand; -import org.eclipse.wst.command.internal.env.core.data.DataMappingRegistry; -import org.eclipse.wst.command.internal.env.core.fragment.SequenceFragment; -import org.eclipse.wst.command.internal.env.core.fragment.SimpleFragment; - - -/** - * @author gilberta - * - * To change the template for this generated type comment go to - * Window - Preferences - Java - Code Generation - Code and Comments - */ -public class WebServiceTestClientDepartureFragment extends SequenceFragment -{ - public WebServiceTestClientDepartureFragment() - { - add(new SimpleFragment(new FinishDefaultCommand(),"")); - add(new SimpleFragment(new ClientTestDelegateCommand(),"")); - } - - public void registerDataMappings(DataMappingRegistry dataRegistry) - { - dataRegistry.addMapping(TestClientDepartureInitCommand.class, "ForceBuild",BuildProjectCommand.class); - dataRegistry.addMapping(FinishDefaultCommand.class, "SampleServerTypeID",AddModuleDependenciesCommand.class); - dataRegistry.addMapping(FinishDefaultCommand.class, "SampleExistingServer",AddModuleDependenciesCommand.class); - dataRegistry.addMapping(FinishDefaultCommand.class, "SampleServerTypeID",ClientTestDelegateCommand.class); - dataRegistry.addMapping(FinishDefaultCommand.class, "SampleExistingServer",ClientTestDelegateCommand.class); - - } - -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/explorer/ExplorerServiceTestCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/explorer/ExplorerServiceTestCommand.java deleted file mode 100644 index bee7b6325..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/explorer/ExplorerServiceTestCommand.java +++ /dev/null @@ -1,97 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2005 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.internal.consumption.ui.widgets.test.explorer; - -import java.util.Iterator; -import java.util.List; -import java.util.Vector; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jst.ws.internal.ext.test.WSDLTestFinishCommand; -import org.eclipse.wst.common.environment.IEnvironment; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; -import org.eclipse.wst.server.core.IServer; -import org.eclipse.wst.ws.internal.explorer.LaunchOption; -import org.eclipse.wst.ws.internal.explorer.LaunchOptions; -import org.eclipse.wst.ws.internal.explorer.WSExplorerLauncherCommand; -import org.eclipse.wst.ws.internal.explorer.plugin.ExplorerPlugin; - -public class ExplorerServiceTestCommand extends AbstractDataModelOperation implements WSDLTestFinishCommand -{ - - private boolean externalBrowser = true; - private String wsdlServiceURL; - private List endpoints; - - /** - * Constructs a new WebServiceExplorerLaunch object with the given label and description. - */ - public ExplorerServiceTestCommand () - { - } - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - IEnvironment env = getEnvironment(); - - IStatus status = Status.OK_STATUS; - - WSExplorerLauncherCommand launchCommand = new WSExplorerLauncherCommand(); - launchCommand.setForceLaunchOutsideIDE(externalBrowser); - Vector launchOptionVector = new Vector(); - String stateLocation = ExplorerPlugin.getInstance().getPluginStateLocation(); - String defaultFavoritesLocation = ExplorerPlugin.getInstance().getDefaultFavoritesLocation(); - launchOptionVector.add(new LaunchOption(LaunchOptions.STATE_LOCATION,stateLocation)); - launchOptionVector.add(new LaunchOption(LaunchOptions.DEFAULT_FAVORITES_LOCATION,defaultFavoritesLocation)); - launchOptionVector.add(new LaunchOption(LaunchOptions.WSDL_URL,wsdlServiceURL)); - if (endpoints != null) - for (Iterator it = endpoints.iterator(); it.hasNext();) - launchOptionVector.add(new LaunchOption(LaunchOptions.WEB_SERVICE_ENDPOINT, it.next().toString())); - launchCommand.setLaunchOptions((LaunchOption[])launchOptionVector.toArray(new LaunchOption[0])); - launchCommand.setEnvironment( env ); - status = launchCommand.execute( monitor, null ); - return status; - } - - public void setExternalBrowser(boolean externalBrowser) - { - this.externalBrowser = externalBrowser; - } - - public void setWsdlServiceURL(String wsdlServiceURL) - { - this.wsdlServiceURL = wsdlServiceURL; - } - - public void setServerTypeID(String serviceServerTypeID) - { - //TODO: Type mappings to this property should be removed. - } - - public void setExistingServer(IServer serviceExistingServer) - { - //TODO: Type mappings to this property should be removed. - } - - public void setServiceProject(String serviceProject) - { - //TODO: Type mappings to this property should be removed. - } - - public void setEndpoint(List endpoints) - { - this.endpoints = endpoints; - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/explorer/WSEGenerateCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/explorer/WSEGenerateCommand.java deleted file mode 100644 index 8ad6eeb12..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/explorer/WSEGenerateCommand.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 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.internal.consumption.ui.widgets.test.explorer; - -import java.util.Iterator; -import java.util.Vector; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.wst.common.environment.IEnvironment; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; -import org.eclipse.wst.ws.internal.explorer.LaunchOption; -import org.eclipse.wst.ws.internal.explorer.LaunchOptions; -import org.eclipse.wst.ws.internal.explorer.WSExplorerLauncherCommand; -import org.eclipse.wst.ws.internal.explorer.plugin.ExplorerPlugin; -import org.eclipse.wst.ws.internal.wsrt.TestInfo; - -public class WSEGenerateCommand extends AbstractDataModelOperation -{ - - private TestInfo testInfo; - - public WSEGenerateCommand(TestInfo testInfo){ - this.testInfo = testInfo; - } - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - IEnvironment env = getEnvironment(); - - IStatus status = Status.OK_STATUS; - - WSExplorerLauncherCommand launchCommand = new WSExplorerLauncherCommand(); - launchCommand.setForceLaunchOutsideIDE(testInfo.getExternalBrowser()); - Vector launchOptionVector = new Vector(); - String stateLocation = ExplorerPlugin.getInstance().getPluginStateLocation(); - String defaultFavoritesLocation = ExplorerPlugin.getInstance().getDefaultFavoritesLocation(); - launchOptionVector.add(new LaunchOption(LaunchOptions.STATE_LOCATION,stateLocation)); - launchOptionVector.add(new LaunchOption(LaunchOptions.DEFAULT_FAVORITES_LOCATION,defaultFavoritesLocation)); - launchOptionVector.add(new LaunchOption(LaunchOptions.WSDL_URL,testInfo.getWsdlServiceURL())); - if (testInfo.getEndpoint() != null) - for (Iterator it = testInfo.getEndpoint().iterator(); it.hasNext();) - launchOptionVector.add(new LaunchOption(LaunchOptions.WEB_SERVICE_ENDPOINT, it.next().toString())); - launchCommand.setLaunchOptions((LaunchOption[])launchOptionVector.toArray(new LaunchOption[0])); - launchCommand.setEnvironment( env ); - status = launchCommand.execute( monitor, null ); - return status; - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/explorer/WSEWebServiceTester.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/explorer/WSEWebServiceTester.java deleted file mode 100644 index cfa116d05..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/explorer/WSEWebServiceTester.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 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.internal.consumption.ui.widgets.test.explorer; - -import java.util.Vector; - -import org.eclipse.wst.command.internal.env.core.ICommandFactory; -import org.eclipse.wst.command.internal.env.core.SimpleCommandFactory; -import org.eclipse.wst.ws.internal.wsrt.IWebServiceTester; -import org.eclipse.wst.ws.internal.wsrt.TestInfo; - -public class WSEWebServiceTester implements IWebServiceTester { - - public ICommandFactory generate(TestInfo testInfo){ - Vector commands = new Vector(); - return new SimpleCommandFactory(commands); - } - - public ICommandFactory launch(TestInfo testInfo){ - Vector commands = new Vector(); - commands.add(new WSEGenerateCommand(testInfo)); - return new SimpleCommandFactory(commands); - } - -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/explorer/WebServiceExplorerExecutable.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/explorer/WebServiceExplorerExecutable.java deleted file mode 100644 index dbfc9ae16..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/explorer/WebServiceExplorerExecutable.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2005 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.internal.consumption.ui.widgets.test.explorer; - -import org.eclipse.jst.ws.internal.ext.WebServiceExecutable; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; - -/** -* This is the interface for objects that represent a kind of -* Web Service-Server-Runtime artifact. The primary purpose of a WebServiceServerRuntimeType -* object is to manufacture the wizard pages that support the type, server, and runtime configuration. -*/ -public class WebServiceExplorerExecutable implements WebServiceExecutable -{ - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - - public AbstractDataModelOperation getFinishCommand() - { - return new ExplorerServiceTestCommand(); - } - -} - - diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/wssample/AddModuleDependenciesCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/wssample/AddModuleDependenciesCommand.java deleted file mode 100644 index fcb826b16..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/wssample/AddModuleDependenciesCommand.java +++ /dev/null @@ -1,240 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2008 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 - * -------- -------- ----------------------------------------------------------- - * 20060324 122799 rsinha@ca.ibm.com - Rupam Kuehner - * 20060503 138478 rsinha@ca.ibm.com - Rupam Kuehner - * 20060510 141115 rsinha@ca.ibm.com - Rupam Kuehner - * 20071212 200193 gilberta@ca.ibm.com - Gilbert Andrews - * 20080211 117924 trungha@ca.ibm.com - Trung Ha - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.widgets.test.wssample; - -import java.io.IOException; - -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jdt.core.IClasspathEntry; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jem.util.emf.workbench.ProjectUtilities; -import org.eclipse.jst.j2ee.classpathdep.UpdateClasspathAttributeUtil; -import org.eclipse.jst.j2ee.internal.plugin.IJ2EEModuleConstants; -import org.eclipse.jst.ws.internal.common.J2EEUtils; -import org.eclipse.jst.ws.internal.consumption.command.common.AddModuleToServerCommand; -import org.eclipse.jst.ws.internal.consumption.command.common.AssociateModuleWithEARCommand; -import org.eclipse.jst.ws.internal.consumption.command.common.CreateFacetedProjectCommand; -import org.eclipse.jst.ws.internal.consumption.common.RequiredFacetVersion; -import org.eclipse.jst.ws.internal.consumption.ui.ConsumptionUIMessages; -import org.eclipse.jst.ws.internal.consumption.ui.command.StartServerCommand; -import org.eclipse.jst.ws.internal.consumption.ui.common.ValidationUtils; -import org.eclipse.osgi.util.NLS; -import org.eclipse.wst.command.internal.env.core.common.StatusUtils; -import org.eclipse.wst.common.environment.IEnvironment; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; -import org.eclipse.wst.ws.internal.wsrt.TestInfo; - -public class AddModuleDependenciesCommand extends AbstractDataModelOperation -{ - - private TestInfo testInfo; - - private IProject sampleIProject; - private IProject clientIProject; - private IProject sampleEARIProject; - private String sampleEARProject; - - public AddModuleDependenciesCommand(TestInfo testInfo) - { - this.testInfo = testInfo; - } - - /** - * Execute WebServerDefaultingTask Set the default server name and id given a - * deployable. - */ - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - IEnvironment env = getEnvironment(); - //1. Create a Web project for the sample if one does not already exist. - sampleIProject = ProjectUtilities.getProject(testInfo.getGenerationProject()); - boolean createdSampleProject = false; - if (!sampleIProject.exists()) - { - CreateFacetedProjectCommand command = new CreateFacetedProjectCommand(); - command.setProjectName(testInfo.getGenerationProject()); - command.setTemplateId(IJ2EEModuleConstants.JST_WEB_TEMPLATE); - // RequiredFacetVersions is set to an empty array because we don't need to impose any additional constraints. - // We just want to create the highest level of Web project that the selected server supports. - command.setRequiredFacetVersions(new RequiredFacetVersion[0]); - command.setServerFactoryId(testInfo.getClientServerTypeID()); - command.setServerInstanceId(testInfo.getClientExistingServer().getId()); - IStatus status = command.execute( monitor, adaptable ); - if (status.getSeverity() == Status.ERROR) - { - env.getStatusHandler().reportError( status ); - return status; - } - createdSampleProject = true; - } - - //2. If the selected server requires an EAR and no EAR name - //has been provided, choose an EAR name and create it if it doesn't exist. - ValidationUtils vu = new ValidationUtils(); - boolean serverNeedsEAR = vu.serverNeedsEAR(testInfo.getClientServerTypeID()); - if (serverNeedsEAR) { - if (testInfo.getClientEARProject() == null - || testInfo.getClientEARProject().length() == 0) { - sampleEARProject = testInfo.getGenerationProject() + DEFAULT_SAMPLE_EAR_PROJECT_EXT; - } else { - sampleEARProject = testInfo.getClientEARProject(); - } - sampleEARIProject = ProjectUtilities.getProject(sampleEARProject); - if (sampleEARIProject == null || !sampleEARIProject.exists()) - { - CreateFacetedProjectCommand command = new CreateFacetedProjectCommand(); - command.setProjectName(sampleEARProject); - command.setTemplateId(IJ2EEModuleConstants.JST_EAR_TEMPLATE); - // RequiredFacetVersions is set to an empty array because we don't need to impose any additional constraints. - // We just want to create the highest level of Web project that the selected server supports. - command.setRequiredFacetVersions(new RequiredFacetVersion[0]); - command.setServerFactoryId(testInfo.getClientServerTypeID()); - command.setServerInstanceId(testInfo.getClientExistingServer().getId()); - IStatus status = command.execute( monitor, adaptable ); - if (status.getSeverity() == Status.ERROR) - { - env.getStatusHandler().reportError( status ); - return status; - } - } - - } - - // 3. If the selected server requires an EAR, and the sample project has - // not already been added to the EAR, add it. - if (serverNeedsEAR) - { - AssociateModuleWithEARCommand associateCommand = new AssociateModuleWithEARCommand(); - associateCommand.setProject(testInfo.getGenerationProject()); - associateCommand.setEARProject(sampleEARProject); - associateCommand.setEar(sampleEARProject); - associateCommand.setEnvironment( env ); - IStatus status = associateCommand.execute( monitor, null ); - if (status.getSeverity()==Status.ERROR) - { - env.getStatusHandler().reportError(status); - } - } - - - - - // 4. If server requires an EAR, and the sample EAR has not already been - // added to the server, add it. - // If no EAR is required, and sample project has not been added to the server add it. - if (serverNeedsEAR) - { - //Add sampleEARIProject to the server if needed. - AddModuleToServerCommand modToServer = new AddModuleToServerCommand(); - modToServer.setModule(sampleEARProject); - modToServer.setProject(sampleEARProject); - modToServer.setServerInstanceId(testInfo.getClientExistingServer().getId()); - modToServer.setEnvironment( env ); - IStatus status = modToServer.execute( monitor, null ); - if (status.getSeverity()==Status.ERROR) - { - env.getStatusHandler().reportError(status); - } - } - else - { - //add sampleIProject directly to the server if needed. - AddModuleToServerCommand addToServer = new AddModuleToServerCommand(); - addToServer.setModule(testInfo.getGenerationProject()); - addToServer.setProject(testInfo.getGenerationProject()); - addToServer.setServerInstanceId(testInfo.getClientExistingServer().getId()); - addToServer.setEnvironment( env ); - IStatus status = addToServer.execute( monitor, null ); - if (status.getSeverity()==Status.ERROR) - { - env.getStatusHandler().reportError(status); - } - } - - //5. Call StartServerCommand if this command had to create the sample project. - if (createdSampleProject) - { - StartServerCommand startServer = new StartServerCommand(true); - startServer.setServerInstanceId(testInfo.getClientExistingServer().getId()); - startServer.setEnvironment( env ); - IStatus status = startServer.execute( monitor, null ); - if (status.getSeverity()==Status.ERROR) - { - env.getStatusHandler().reportError(status); - } - } - - - //6. Establish all necessary dependencies between client project, sample project, and EAR - - clientIProject = ProjectUtilities.getProject(testInfo.getClientProject()); - - if (clientIProject != null && !J2EEUtils.isWebComponent(clientIProject)) { - if (J2EEUtils.isJavaComponent(clientIProject)) { - J2EEUtils.addJavaProjectAsUtilityJar(clientIProject, sampleEARIProject, monitor); - J2EEUtils.addJavaProjectAsUtilityJar(clientIProject, sampleIProject,monitor); - } - - try - { - String uri = clientIProject.getName() + ".jar"; - J2EEUtils.addJAROrModuleDependency(sampleIProject, uri); - - // Adding the attribute to the referenced project's classpath entries of 'lib' kind - // so that these libs will be bundled along with the project when exported - IClasspathEntry[] classPath = JavaCore.create(clientIProject).getRawClasspath(); - for (int i = 0; i < classPath.length; i++) { - IClasspathEntry classpathEntry = classPath[i]; - if ( classpathEntry.getEntryKind() == IClasspathEntry.CPE_LIBRARY ){ - UpdateClasspathAttributeUtil.addDependencyAttribute(monitor, clientIProject.getName(), classpathEntry); - } - } - - } catch (CoreException ce) - { - String errorMessage = NLS.bind(ConsumptionUIMessages.MSG_ERROR_MODULE_DEPENDENCY, new String[]{sampleIProject.getName(), clientIProject.getName()}); - IStatus errorStatus = StatusUtils.errorStatus(errorMessage); - env.getStatusHandler().reportError(errorStatus); - } catch (IOException ioe) - { - String errorMessage = NLS.bind(ConsumptionUIMessages.MSG_ERROR_MODULE_DEPENDENCY, new String[]{sampleIProject.getName(), clientIProject.getName()}); - IStatus errorStatus = StatusUtils.errorStatus(errorMessage); - env.getStatusHandler().reportError(errorStatus); - } catch (ExecutionException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - - } - - return Status.OK_STATUS; - } - - - - - public static final String DEFAULT_SAMPLE_EAR_PROJECT_EXT = "EAR"; - -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/wssample/GSTCGenerateCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/wssample/GSTCGenerateCommand.java deleted file mode 100644 index e7d91d9aa..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/wssample/GSTCGenerateCommand.java +++ /dev/null @@ -1,172 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 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.internal.consumption.ui.widgets.test.wssample; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IWorkspaceRoot; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.IAdaptable; -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.Status; -import org.eclipse.jem.util.emf.workbench.ProjectUtilities; -import org.eclipse.jst.ws.internal.common.J2EEUtils; -import org.eclipse.jst.ws.internal.consumption.sampleapp.codegen.InputFileGenerator; -import org.eclipse.jst.ws.internal.consumption.sampleapp.codegen.MethodFileGenerator; -import org.eclipse.jst.ws.internal.consumption.sampleapp.codegen.ResultFileGenerator; -import org.eclipse.jst.ws.internal.consumption.sampleapp.codegen.TestClientFileGenerator; -import org.eclipse.jst.ws.internal.consumption.sampleapp.command.GeneratePageCommand; -import org.eclipse.jst.ws.internal.consumption.sampleapp.command.JavaToModelCommand; -import org.eclipse.jst.ws.internal.consumption.ui.widgets.test.CopyWebServiceUtilsJarCommand; -import org.eclipse.wst.command.internal.env.ui.eclipse.EnvironmentUtils; -import org.eclipse.wst.common.environment.IEnvironment; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; -import org.eclipse.wst.ws.internal.datamodel.Model; -import org.eclipse.wst.ws.internal.wsrt.TestInfo; - -public class GSTCGenerateCommand extends AbstractDataModelOperation -{ - - public static String INPUT = "Input.jsp"; - public static String TEST_CLIENT = "TestClient.jsp"; - public static String RESULT = "Result.jsp"; - public static String METHOD = "Method.jsp"; - - private TestInfo testInfo; - private Model proxyModel; - private String jspfolder; - - public GSTCGenerateCommand(TestInfo testInfo){ - this.testInfo = testInfo; - } - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - IEnvironment env = getEnvironment(); - IStatus status = Status.OK_STATUS; - CopyWebServiceUtilsJarCommand copy = new CopyWebServiceUtilsJarCommand(); - copy.setSampleProject(testInfo.getGenerationProject()); - copy.setEnvironment( env ); - status = copy.execute( monitor, null); - if (status.getSeverity() == Status.ERROR) return status; - setJSPFolder(); - status = createModel(env, monitor); - if (status.getSeverity() == Status.ERROR) return status; - status = generatePages(env); - if (status.getSeverity() == Status.ERROR) return status; - return status; - } - - private void setJSPFolder(){ - //if the client is not a webcomponent then the - //sample must have been created, we must now factor in - //flexible projects - - IProject clientIProject = ProjectUtilities.getProject(testInfo.getClientProject()); - if (clientIProject != null && !J2EEUtils.isWebComponent(clientIProject)){ - IProject project = ProjectUtilities.getProject(testInfo.getGenerationProject()); - IPath path = J2EEUtils.getWebContentPath(project); - int index = testInfo.getJspFolder().lastIndexOf("/"); - String jsp = testInfo.getJspFolder().substring(index + 1); - StringBuffer sb = new StringBuffer(); - sb.append("/").append(path.toString()).append("/").append(jsp); - jspfolder = sb.toString(); - } - else - jspfolder = testInfo.getJspFolder(); - - - } - - //create the model from the resource - private IStatus createModel(IEnvironment env, IProgressMonitor monitor ) { - JavaToModelCommand jtmc = new JavaToModelCommand(); - jtmc.setMethods(testInfo.getMethods()); - jtmc.setClientProject(testInfo.getClientProject()); - jtmc.setProxyBean(testInfo.getProxyBean()); - jtmc.setEnvironment( env ); - IStatus status = jtmc.execute( monitor, null); - if (status.getSeverity() == Status.ERROR) return status; - proxyModel = jtmc.getJavaDataModel(); - return status; - } - - /** - * Generate the four jsps that make up this - * sample app. - */ - private IStatus generatePages(IEnvironment env) - { - IStatus status = Status.OK_STATUS; - IPath fDestinationFolderPath = new Path(jspfolder); - fDestinationFolderPath = fDestinationFolderPath.makeAbsolute(); - IWorkspaceRoot fWorkspace = ResourcesPlugin.getWorkspace().getRoot(); - - IPath pathTest = fDestinationFolderPath.append(TEST_CLIENT); - IFile fileTest = fWorkspace.getFile(pathTest); - GeneratePageCommand gpcTest = new GeneratePageCommand(EnvironmentUtils.getResourceContext(env), proxyModel, - new TestClientFileGenerator(INPUT,METHOD,RESULT),fileTest); - //gpcTest.setStatusMonitor(getStatusMonitor()); - gpcTest.setEnvironment( env ); - status = gpcTest.execute( null, null ); - if (status.getSeverity() == Status.ERROR ) - return status; - - - //input codegen - IPath pathInput = fDestinationFolderPath.append(INPUT); - IFile fileInput = fWorkspace.getFile(pathInput); - InputFileGenerator inputGenerator = new InputFileGenerator(RESULT); - GeneratePageCommand gpcInput = new GeneratePageCommand(EnvironmentUtils.getResourceContext(env), proxyModel, - inputGenerator,fileInput); - //gpcInput.setStatusMonitor(getStatusMonitor()); - gpcInput.setEnvironment( env ); - status = gpcInput.execute( null, null ); - if (status.getSeverity() == Status.ERROR ) - return status; - - //method codegen - IPath pathMethod = fDestinationFolderPath.append(METHOD); - IFile fileMethod = fWorkspace.getFile(pathMethod); - MethodFileGenerator methodGenerator = new MethodFileGenerator(INPUT); - methodGenerator.setClientFolderPath(jspfolder); - GeneratePageCommand gpcMethod = new GeneratePageCommand(EnvironmentUtils.getResourceContext(env), proxyModel, - methodGenerator,fileMethod); - //gpcMethod.setStatusMonitor(getStatusMonitor()); - gpcMethod.setEnvironment( env ); - status = gpcMethod.execute( null, null ); - if (status.getSeverity() == Status.ERROR ) - return status; - - - //result codegen - IPath pathResult = fDestinationFolderPath.append(RESULT); - IFile fileResult = fWorkspace.getFile(pathResult); - ResultFileGenerator rfg = new ResultFileGenerator(); - rfg.setClientFolderPath(jspfolder); - rfg.setSetEndpointMethod(testInfo.getSetEndpointMethod()); - GeneratePageCommand gpcResult = new GeneratePageCommand(EnvironmentUtils.getResourceContext(env), proxyModel, - rfg,fileResult); - gpcResult.setEnvironment( env ); - status = gpcResult.execute( null, null ); - - return status; - } - - - - - -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/wssample/GSTCLaunchCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/wssample/GSTCLaunchCommand.java deleted file mode 100644 index 15bfc8cf3..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/wssample/GSTCLaunchCommand.java +++ /dev/null @@ -1,191 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 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 - * -------- -------- ----------------------------------------------------------- - * 20060418 134322 rsinha@ca.ibm.com - Rupam Kuehner - * 20060424 124368 kathy@ca.ibm.com - Kathy Chan - *******************************************************************************/ - -package org.eclipse.jst.ws.internal.consumption.ui.widgets.test.wssample; - -import java.io.IOException; -import java.io.InputStream; -import java.net.MalformedURLException; -import java.net.URL; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.IAdaptable; -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.jem.util.emf.workbench.ProjectUtilities; -import org.eclipse.jst.ws.internal.common.J2EEUtils; -import org.eclipse.jst.ws.internal.common.ServerUtils; -import org.eclipse.jst.ws.internal.consumption.ui.ConsumptionUIMessages; -import org.eclipse.jst.ws.internal.consumption.ui.command.StartServerCommand; -import org.eclipse.jst.ws.internal.consumption.ui.plugin.WebServiceConsumptionUIPlugin; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.browser.IWebBrowser; -import org.eclipse.ui.browser.IWorkbenchBrowserSupport; -import org.eclipse.wst.command.internal.env.core.common.StatusUtils; -import org.eclipse.wst.common.environment.IEnvironment; -import org.eclipse.wst.common.environment.ILog; -import org.eclipse.wst.common.environment.StatusException; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; -import org.eclipse.wst.ws.internal.wsrt.TestInfo; - -public class GSTCLaunchCommand extends AbstractDataModelOperation -{ - - public static String INPUT = "Input.jsp"; - public static String TEST_CLIENT = "TestClient.jsp"; - public static String RESULT = "Result.jsp"; - public static String METHOD = "Method.jsp"; - - private TestInfo testInfo; - private String jspfolder; - - public GSTCLaunchCommand(TestInfo testInfo){ - this.testInfo = testInfo; - } - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - IEnvironment env = getEnvironment(); - - setJSPFolder(); - - return launchSample(env, monitor); - } - private void setJSPFolder(){ - //if the client is not a webcomponent then the - //sample must have been created, we must now factor in - //flexible projects - - IProject clientIProject = ProjectUtilities.getProject(testInfo.getClientProject()); - if (clientIProject != null && !J2EEUtils.isWebComponent(clientIProject)){ - IProject project = ProjectUtilities.getProject(testInfo.getGenerationProject()); - IPath path = J2EEUtils.getWebContentPath(project); - int index = testInfo.getJspFolder().lastIndexOf("/"); - String jsp = testInfo.getJspFolder().substring(index + 1); - StringBuffer sb = new StringBuffer(); - sb.append("/").append(path.toString()).append("/").append(jsp); - jspfolder = sb.toString(); - } - else - jspfolder = testInfo.getJspFolder(); - - - } - - private IStatus launchSample (IEnvironment env, IProgressMonitor monitor ) { - IStatus status = Status.OK_STATUS; - IPath fDestinationFolderPath = new Path(jspfolder); - fDestinationFolderPath = fDestinationFolderPath.makeAbsolute(); - try - { - Platform.getJobManager().join(ResourcesPlugin.FAMILY_AUTO_BUILD, null); - } - catch( InterruptedException exc ) - { - // UISynchronizer.syncExec seems to interrupt the UI tread when the autobuilder is done. Not sure, why. - // I'm assuming here that the autobuilder has actually completed its stuff. - } - - StartServerCommand serverCommand = new StartServerCommand( true ); - serverCommand.setServerInstanceId( testInfo.getClientExistingServer().getId() ); - serverCommand.setEnvironment( env ); - - status = serverCommand.execute(monitor, null); - if (status.getSeverity() == Status.ERROR) return status; - - IProject sampleProject = ProjectUtilities.getProject(testInfo.getGenerationProject()); - String newPath = ServerUtils.getWebComponentURL(sampleProject, testInfo.getClientServerTypeID(),testInfo.getClientExistingServer()); - int count = J2EEUtils.getWebContentPath(sampleProject).segmentCount(); - - newPath = newPath + "/" + fDestinationFolderPath.removeFirstSegments(count); - StringBuffer urlString = new StringBuffer( newPath + "/" + TEST_CLIENT ); - if (testInfo.getEndpoint() != null && !testInfo.getEndpoint().isEmpty()) - { - urlString.append("?endpoint="); - urlString.append(testInfo.getEndpoint().get(0).toString()); - } - - try{ - URL url; - url = new URL(urlString.toString()); - - InputStream resultStream = null; - InputStream methodStream = null; - InputStream inputStream = null; - InputStream clientStream = null; - - for( int retries = 0; retries < 10; retries++ ) - { - try - { - // Test the URLs - - resultStream = new URL(newPath + "/" + RESULT).openStream(); - methodStream = new URL(newPath + "/" + METHOD).openStream(); - inputStream = new URL(newPath + "/" + INPUT).openStream(); - clientStream = new URL(newPath + "/" + TEST_CLIENT).openStream(); - - // Looks good, exit loop - break; - } - catch( IOException ioe ) - { - try - { - Thread.sleep(1000); - } - catch (InterruptedException ie) {} - } - finally - { - try - { - if( resultStream != null ) resultStream.close(); - if( methodStream != null ) methodStream.close(); - if( inputStream != null ) inputStream.close(); - if( clientStream != null ) clientStream.close(); - } - catch( IOException exc ) - { - } - } - } - - IWorkbenchBrowserSupport browserSupport = WebServiceConsumptionUIPlugin.getInstance().getWorkbench().getBrowserSupport(); - IWebBrowser browser = browserSupport.createBrowser(IWorkbenchBrowserSupport.LOCATION_BAR, null, null, null); - browser.openURL(url); - return status; - }catch(PartInitException exc){ - env.getLog().log(ILog.ERROR, 5048, this, "launchSample", exc); - status = StatusUtils.errorStatus(exc.getMessage(), exc); - env.getStatusHandler().reportError(status); - return status; - }catch(MalformedURLException exc){ - env.getLog().log(ILog.WARNING, 5048, this, "launchSample", exc); - status = StatusUtils.warningStatus( ConsumptionUIMessages.MSG_ERROR_MALFORMED_URL, exc ); - try { - env.getStatusHandler().report(status); - } catch (StatusException e) { - status = StatusUtils.errorStatus( ConsumptionUIMessages.MSG_ERROR_MALFORMED_URL, e ); - } - return status; - } - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/wssample/GSTCWebServiceTester.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/wssample/GSTCWebServiceTester.java deleted file mode 100644 index ea068568d..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/wssample/GSTCWebServiceTester.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 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 - * -------- -------- ----------------------------------------------------------- - * 20060608 145529 kathy@ca.ibm.com - Kathy Chan - *******************************************************************************/ - -package org.eclipse.jst.ws.internal.consumption.ui.widgets.test.wssample; - -import java.util.Vector; - -import org.eclipse.wst.command.internal.env.core.ICommandFactory; -import org.eclipse.wst.command.internal.env.core.SimpleCommandFactory; -import org.eclipse.wst.ws.internal.wsrt.IWebServiceTester; -import org.eclipse.wst.ws.internal.wsrt.TestInfo; - -public class GSTCWebServiceTester implements IWebServiceTester { - - public ICommandFactory generate(TestInfo testInfo){ - Vector commands = new Vector(); - commands.add(new AddModuleDependenciesCommand(testInfo)); - commands.add(new GSTCGenerateCommand(testInfo)); - return new SimpleCommandFactory(commands); - } - - public ICommandFactory launch(TestInfo testInfo){ - Vector commands = new Vector(); - if (testInfo.getRunTestClient()) { - commands.add(new GSTCLaunchCommand(testInfo)); - } - return new SimpleCommandFactory(commands); - } - -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/wssample/WSSampleFinishCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/wssample/WSSampleFinishCommand.java deleted file mode 100644 index 9a7bc7e0d..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/wssample/WSSampleFinishCommand.java +++ /dev/null @@ -1,322 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 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 - * -------- -------- ----------------------------------------------------------- - * 20060424 124368 kathy@ca.ibm.com - Kathy Chan - *******************************************************************************/ - -package org.eclipse.jst.ws.internal.consumption.ui.widgets.test.wssample; - -import java.io.IOException; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.List; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IWorkspaceRoot; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.IAdaptable; -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.Status; -import org.eclipse.jst.ws.internal.common.ResourceUtils; -import org.eclipse.jst.ws.internal.consumption.command.common.StartProjectCommand; -import org.eclipse.jst.ws.internal.consumption.sampleapp.codegen.InputFileGenerator; -import org.eclipse.jst.ws.internal.consumption.sampleapp.codegen.MethodFileGenerator; -import org.eclipse.jst.ws.internal.consumption.sampleapp.codegen.ResultFileGenerator; -import org.eclipse.jst.ws.internal.consumption.sampleapp.codegen.TestClientFileGenerator; -import org.eclipse.jst.ws.internal.consumption.sampleapp.command.GeneratePageCommand; -import org.eclipse.jst.ws.internal.consumption.sampleapp.command.JavaToModelCommand; -import org.eclipse.jst.ws.internal.consumption.ui.ConsumptionUIMessages; -import org.eclipse.jst.ws.internal.consumption.ui.plugin.WebServiceConsumptionUIPlugin; -import org.eclipse.jst.ws.internal.consumption.ui.widgets.test.CopyWebServiceUtilsJarCommand; -import org.eclipse.jst.ws.internal.ext.test.JavaProxyTestCommand; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.browser.IWebBrowser; -import org.eclipse.ui.browser.IWorkbenchBrowserSupport; -import org.eclipse.wst.command.internal.env.core.common.StatusUtils; -import org.eclipse.wst.command.internal.env.core.selection.BooleanSelection; -import org.eclipse.wst.command.internal.env.ui.eclipse.EnvironmentUtils; -import org.eclipse.wst.common.environment.IEnvironment; -import org.eclipse.wst.common.environment.ILog; -import org.eclipse.wst.common.environment.StatusException; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; -import org.eclipse.wst.server.core.IServer; -import org.eclipse.wst.ws.internal.datamodel.Model; - -public class WSSampleFinishCommand extends AbstractDataModelOperation implements JavaProxyTestCommand -{ - - public static String INPUT = "Input.jsp"; - public static String TEST_CLIENT = "TestClient.jsp"; - public static String RESULT = "Result.jsp"; - public static String METHOD = "Method.jsp"; - - private Model proxyModel; - private String sampleServerTypeID; - private IServer sampleExistingServer; - - - private String clientProject; - private String jspFolder; - private boolean runClientTest; - private String sampleProject; - private BooleanSelection[] methods; - private String proxyBean; - private String setEndpointMethod; - private List endpoints; - - /** - * Constructs a new JavaBeanToSampleActiveTask object with the given label and description. - */ - public WSSampleFinishCommand () - { - } - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - IEnvironment env = getEnvironment(); - - IStatus status = Status.OK_STATUS; - //setters and getters to be removed - CopyWebServiceUtilsJarCommand copy = new CopyWebServiceUtilsJarCommand(); - copy.setSampleProject(sampleProject); - copy.setEnvironment( env ); - status = copy.execute( monitor, null ); - if (status.getSeverity() == Status.ERROR) return status; - status = createModel(env, monitor ); - if (status.getSeverity() == Status.ERROR) return status; - status = generatePages(env, monitor ); - if (status.getSeverity() == Status.ERROR) return status; - //if (!isSuccessful()) return; - status = launchSample(env, monitor); - return status; - } - - - /** - * Generate the four jsps that make up this - * sample app. - */ - protected IStatus generatePages(IEnvironment env, IProgressMonitor monitor ) - { - IStatus status = Status.OK_STATUS; - IPath fDestinationFolderPath = new Path(jspFolder); - fDestinationFolderPath = fDestinationFolderPath.makeAbsolute(); - IWorkspaceRoot fWorkspace = ResourcesPlugin.getWorkspace().getRoot(); - - IPath pathTest = fDestinationFolderPath.append(TEST_CLIENT); - IFile fileTest = fWorkspace.getFile(pathTest); - GeneratePageCommand gpcTest = new GeneratePageCommand(EnvironmentUtils.getResourceContext(env), proxyModel, - new TestClientFileGenerator(INPUT,METHOD,RESULT),fileTest); - //gpcTest.setStatusMonitor(getStatusMonitor()); - gpcTest.setEnvironment( env ); - status = gpcTest.execute( monitor, null ); - if (status.getSeverity() == Status.ERROR ) - return status; - - - //input codegen - IPath pathInput = fDestinationFolderPath.append(INPUT); - IFile fileInput = fWorkspace.getFile(pathInput); - InputFileGenerator inputGenerator = new InputFileGenerator(RESULT); - GeneratePageCommand gpcInput = new GeneratePageCommand(EnvironmentUtils.getResourceContext(env), proxyModel, - inputGenerator,fileInput); - //gpcInput.setStatusMonitor(getStatusMonitor()); - gpcInput.setEnvironment( env ); - status = gpcInput.execute( monitor, null ); - if (status.getSeverity() == Status.ERROR ) - return status; - - //method codegen - IPath pathMethod = fDestinationFolderPath.append(METHOD); - IFile fileMethod = fWorkspace.getFile(pathMethod); - MethodFileGenerator methodGenerator = new MethodFileGenerator(INPUT); - methodGenerator.setClientFolderPath(jspFolder); - GeneratePageCommand gpcMethod = new GeneratePageCommand(EnvironmentUtils.getResourceContext(env), proxyModel, - methodGenerator,fileMethod); - //gpcMethod.setStatusMonitor(getStatusMonitor()); - gpcMethod.setEnvironment( env ); - status = gpcMethod.execute( monitor, null ); - if (status.getSeverity() == Status.ERROR ) - return status; - - - //result codegen - IPath pathResult = fDestinationFolderPath.append(RESULT); - IFile fileResult = fWorkspace.getFile(pathResult); - ResultFileGenerator rfg = new ResultFileGenerator(); - rfg.setClientFolderPath(jspFolder); - rfg.setSetEndpointMethod(setEndpointMethod); - GeneratePageCommand gpcResult = new GeneratePageCommand(EnvironmentUtils.getResourceContext(env), proxyModel, - rfg,fileResult); - //gpcResult.setStatusMonitor(getStatusMonitor()); - gpcResult.setEnvironment( env ); - status = gpcResult.execute( monitor, null ); - - return status; - } - - - protected IStatus launchSample (IEnvironment env, IProgressMonitor monitor ) { - - IStatus status = Status.OK_STATUS; - if (!runClientTest) return status; - - - IPath fDestinationFolderPath = new Path(jspFolder); - fDestinationFolderPath = fDestinationFolderPath.makeAbsolute(); - - StartProjectCommand spc = new StartProjectCommand(false ); - spc.setServiceServerTypeID(sampleServerTypeID); - spc.setSampleExistingServer(sampleExistingServer); - IProject project = (IProject) ResourceUtils.findResource(sampleProject); - spc.setSampleProject(project); - spc.setIsWebProjectStartupRequested(true); - spc.setEnvironment( env ); - - status = spc.execute( monitor, null ); - if (status.getSeverity() == Status.ERROR) return status; - - IPath newPath = new Path(ResourceUtils.getWebProjectURL(ResourceUtils.getProjectOf(fDestinationFolderPath),sampleServerTypeID,sampleExistingServer)); - newPath = newPath.append(fDestinationFolderPath.removeFirstSegments(2).makeAbsolute()); - StringBuffer urlString = new StringBuffer(newPath.append(TEST_CLIENT).toString()); - if (endpoints != null && !endpoints.isEmpty()) - { - urlString.append("?endpoint="); - urlString.append(endpoints.get(0).toString()); - } - - try{ - URL url; - url = new URL(urlString.toString()); - - for( int retries = 0; retries < 10; retries++ ) - { - try - { - // Test the URLs - (new URL(newPath.append(RESULT).toString())).openStream(); - (new URL(newPath.append(METHOD).toString())).openStream(); - (new URL(newPath.append(INPUT).toString())).openStream(); - (new URL(newPath.append(TEST_CLIENT).toString())).openStream(); - // Looks good, exit loop - break; - } - catch( IOException ioe ) - { - try - { - Thread.sleep(1000); - } - catch (InterruptedException ie) {} - } - } - - IWorkbenchBrowserSupport browserSupport = WebServiceConsumptionUIPlugin.getInstance().getWorkbench().getBrowserSupport(); - IWebBrowser browser = browserSupport.createBrowser(IWorkbenchBrowserSupport.LOCATION_BAR | IWorkbenchBrowserSupport.NAVIGATION_BAR, null, null, null); - browser.openURL(url); - return status; - }catch(PartInitException exc){ - //TODO: change error message - env.getLog().log(ILog.WARNING, 5048, this, "launchSample", exc); - status = StatusUtils.warningStatus( ConsumptionUIMessages.MSG_ERROR_MALFORMED_URL, exc ); - try { - env.getStatusHandler().report(status); - } catch (StatusException e) { - status = StatusUtils.errorStatus( ConsumptionUIMessages.MSG_ERROR_MALFORMED_URL, e ); - } - return status; - }catch(MalformedURLException exc){ - env.getLog().log(ILog.WARNING, 5048, this, "launchSample", exc); - status = StatusUtils.warningStatus( ConsumptionUIMessages.MSG_ERROR_MALFORMED_URL, exc ); - try { - env.getStatusHandler().report(status); - } catch (StatusException e) { - status = StatusUtils.errorStatus( ConsumptionUIMessages.MSG_ERROR_MALFORMED_URL, e ); - } - return status; - } - } - - - - protected IStatus createModel(IEnvironment env, IProgressMonitor monitor ) { - - //create the model from the resource - JavaToModelCommand jtmc = new JavaToModelCommand(); - jtmc.setMethods(methods); - jtmc.setClientProject(clientProject); - jtmc.setProxyBean(proxyBean); - jtmc.setEnvironment( env ); - //jtmc.setStatusMonitor(getStatusMonitor()); - IStatus status = jtmc.execute( monitor, null); - if (status.getSeverity() == Status.ERROR) return status; - - proxyModel = jtmc.getJavaDataModel(); - return status; - } - - public void setServerTypeID(String sampleServerTypeID) - { - this.sampleServerTypeID = sampleServerTypeID; - } - - public void setExistingServer(IServer sampleExistingServer) - { - this.sampleExistingServer = sampleExistingServer; - } - - public void setJspFolder(String jspFolder) - { - this.jspFolder = jspFolder; - } - - public void setRunClientTest(boolean runClientTest) - { - this.runClientTest = runClientTest; - } - - public void setSampleProject(String sampleProject) - { - this.sampleProject = sampleProject; - } - - public void setClientProject(String clientProject) - { - this.clientProject = clientProject; - } - - public void setMethods(BooleanSelection[] methods) - { - this.methods = methods; - } - - public void setProxyBean(String proxyBean) - { - this.proxyBean = proxyBean; - } - - /** - * @param setEndpointMethod The setEndpointMethod to set. - */ - public void setSetEndpointMethod(String setEndpointMethod) - { - this.setEndpointMethod = setEndpointMethod; - } - - public void setEndpoint(List endpoints) - { - this.endpoints = endpoints; - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/wssample/WebServiceWSSampleExecutable.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/wssample/WebServiceWSSampleExecutable.java deleted file mode 100644 index f14dd8dea..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/wssample/WebServiceWSSampleExecutable.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2005 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.internal.consumption.ui.widgets.test.wssample; - -import org.eclipse.jst.ws.internal.ext.WebServiceExecutable; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; - -/** -* This is the interface for objects that represent a kind of -* Web Service-Server-Runtime artifact. The primary purpose of a WebServiceServerRuntimeType -* object is to manufacture the wizard pages that support the type, server, and runtime configuration. -*/ -public class WebServiceWSSampleExecutable implements WebServiceExecutable -{ - - - public AbstractDataModelOperation getFinishCommand() - { - return new WSSampleFinishCommand(); - } - -} - - |