JBoss Tools SVN: r26768 - in trunk/ws/tests/org.jboss.tools.ws.ui.bot.test: resources/jbossws and 5 other directories.
by jbosstools-commits@lists.jboss.org
Author: jlukas(a)redhat.com
Date: 2010-11-19 09:40:46 -0500 (Fri, 19 Nov 2010)
New Revision: 26768
Added:
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/jbt/
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/jbt/SampleWSTest.java
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/jbt/WsTesterTest.java
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/uiutils/wizards/WebServiceWizard.java
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/utils/
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/utils/WSClient.java
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/wtp/
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/wtp/BottomUpWSTest.java
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/wtp/TopDownWSTest.java
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/wtp/WSTestBase.java
Removed:
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/BottomUpWebService.java
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/JbossWSTest.java
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/SampleWebService.java
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/TopDownWebService.java
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/TwoBUWSInOneProject.java
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/WSClient.java
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/WsTesterTest.java
Modified:
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/META-INF/MANIFEST.MF
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/resources/jbossws/ClassA.java.ws
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/resources/jbossws/ClassB.wsdl
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/WSAllBotTests.java
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/uiutils/wizards/Wizard.java
Log:
improving tests reliability and speed (work in progress)
Modified: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/META-INF/MANIFEST.MF 2010-11-19 14:32:37 UTC (rev 26767)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/META-INF/MANIFEST.MF 2010-11-19 14:40:46 UTC (rev 26768)
@@ -20,9 +20,18 @@
org.jboss.tools.ws.ui;bundle-version="1.1.0",
org.eclipse.core.resources,
org.jboss.tools.tests,
- org.eclipse.wst.common.project.facet.core
+ org.eclipse.wst.common.project.facet.core,
+ org.hamcrest;bundle-version="1.1.0"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Eclipse-RegisterBuddy: org.apache.log4j
Bundle-ClassPath: .
-Export-Package: org.jboss.tools.ws.ui.bot.test
+Export-Package: org.jboss.tools.ws.ui.bot.test;
+ uses:="org.eclipse.ui.plugin,
+ org.eclipse.swtbot.eclipse.finder,
+ javax.xml.namespace,
+ junit.framework,
+ org.eclipse.core.resources,
+ org.jboss.tools.ui.bot.ext,
+ org.osgi.framework,
+ org.jboss.tools.ws.ui.bot.test.uiutils.wizards"
Modified: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/resources/jbossws/ClassA.java.ws
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/resources/jbossws/ClassA.java.ws 2010-11-19 14:32:37 UTC (rev 26767)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/resources/jbossws/ClassA.java.ws 2010-11-19 14:40:46 UTC (rev 26768)
@@ -1,14 +1,14 @@
-package jbossws;
+package {0};
import javax.jws.WebMethod;
import javax.jws.WebService;
@WebService()
-public class ClassA {
+public class {1} '{'
@WebMethod()
- public int method() {
- System.out.println("JbossWS Service : method() was called");
- return 1234567890;
- }
-}
+ public String method() '{'
+ System.out.println({1}.class.getName() + " Service: method() was called");
+ return "{0}.{1}";
+ '}'
+'}'
Modified: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/resources/jbossws/ClassB.wsdl
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/resources/jbossws/ClassB.wsdl 2010-11-19 14:32:37 UTC (rev 26767)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/resources/jbossws/ClassB.wsdl 2010-11-19 14:40:46 UTC (rev 26768)
@@ -1,45 +1,45 @@
-<definitions name='ClassBService' targetNamespace='http://jbossws/' xmlns='http://schemas.xmlsoap.org/wsdl/' xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/' xmlns:tns='http://jbossws/' xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
+<definitions name="{1}Service" targetNamespace="http://{0}/" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://{0}/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<types>
- <xs:schema targetNamespace='http://jbossws/' version='1.0' xmlns:tns='http://jbossws/' xmlns:xs='http://www.w3.org/2001/XMLSchema'>
- <xs:element name='method' type='tns:method'/>
- <xs:element name='methodResponse' type='tns:methodResponse'/>
- <xs:complexType name='method'>
+ <xs:schema targetNamespace="http://{0}/" version="1.0" xmlns:tns="http://{0}/" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <xs:element name="method" type="tns:method"/>
+ <xs:element name="methodResponse" type="tns:methodResponse"/>
+ <xs:complexType name="method">
<xs:sequence/>
</xs:complexType>
- <xs:complexType name='methodResponse'>
+ <xs:complexType name="methodResponse">
<xs:sequence>
- <xs:element name='return' type='xs:int'/>
+ <xs:element name="return" type="xs:int"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
</types>
- <message name='ClassB_methodResponse'>
- <part element='tns:methodResponse' name='methodResponse'></part>
+ <message name="{1}_methodResponse">
+ <part element="tns:methodResponse" name="methodResponse"></part>
</message>
- <message name='ClassB_method'>
- <part element='tns:method' name='method'></part>
+ <message name="{1}_method">
+ <part element="tns:method" name="method"></part>
</message>
- <portType name='ClassB'>
- <operation name='method' parameterOrder='method'>
- <input message='tns:ClassB_method'></input>
- <output message='tns:ClassB_methodResponse'></output>
+ <portType name="{1}">
+ <operation name="method" parameterOrder="method">
+ <input message="tns:{1}_method"></input>
+ <output message="tns:{1}_methodResponse"></output>
</operation>
</portType>
- <binding name='ClassBBinding' type='tns:ClassB'>
- <soap:binding style='document' transport='http://schemas.xmlsoap.org/soap/http'/>
- <operation name='method'>
- <soap:operation soapAction=''/>
+ <binding name="{1}Binding" type="tns:{1}">
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <operation name="method">
+ <soap:operation soapAction=""/>
<input>
- <soap:body use='literal'/>
+ <soap:body use="literal"/>
</input>
<output>
- <soap:body use='literal'/>
+ <soap:body use="literal"/>
</output>
</operation>
</binding>
- <service name='ClassBService'>
- <port binding='tns:ClassBBinding' name='ClassBPort'>
- <soap:address location='http://localhost:8080/JbossWS/ClassB'/>
+ <service name="{1}Service">
+ <port binding="tns:{1}Binding" name="{1}Port">
+ <soap:address location="http://localhost:8080/JbossWS/{1}"/>
</port>
</service>
</definitions>
\ No newline at end of file
Deleted: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/BottomUpWebService.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/BottomUpWebService.java 2010-11-19 14:32:37 UTC (rev 26767)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/BottomUpWebService.java 2010-11-19 14:40:46 UTC (rev 26768)
@@ -1,73 +0,0 @@
-package org.jboss.tools.ws.ui.bot.test;
-
-import org.jboss.tools.ui.bot.ext.config.Annotations.*;
-import org.junit.Test;
-
-
-@SWTBotTestRequires(server=@Server(),perspective="Java EE")
-public class BottomUpWebService extends JbossWSTest {
-
- @Test
- public void bottomUpJbossWS1() {
- int testlevel=4;
- for (int j=0;j<testlevel;j++) {
- bottomUpJbossWebService(0, j);
- }
- }
-
- @Test
- public void bottomUpJbossWS2() {
- int testlevel=4;
- for (int j=0;j<testlevel;j++) {
- bottomUpJbossWebService(1, j);
- }
- }
-
- @Test
- public void bottomUpJbossWS3() {
- int testlevel=4;
- for (int j=0;j<testlevel;j++) {
- bottomUpJbossWebService(2, j);
- }
- }
-
- @Test
- public void bottomUpJbossWS4() {
- int testlevel=4;
- for (int j=0;j<testlevel;j++) {
- bottomUpJbossWebService(3, j);
- }
- }
-
- protected void bottomUpJbossWebService(int serverType, int clientType) {
- log.info(" * Running test ServiceType: '"+wizardConfigTexts.get(serverType)+"', ClientType: '"+wizardConfigTexts.get(clientType)+"'");
- createEARProject(EAR_PROJECT_NAME);
- createProject(BOTTOMUP_WS_PROJ_NAME);
- bottomUpService(BOTTOMUP_WS_PROJ_NAME, CLASS_A,serverType);
- assertServiceDeployed(BOTTOMUP_WS_WSDL_URL);
- // generate client stubs
- createClient(BOTTOMUP_WS_CLIENT_PROJ_NAME, BOTTOMUP_WS_CLIENT_SERVLET_NAME, BOTTOMUP_WS_WSDL_URL, clientType);
- servers.removeAllProjectsFromServer(configuredState.getServer().name);
- if (serverType >= SERVICE_SCALE_ASSEMBLE) {
- // service was not assembled into EAR
- projectExplorer.runOnServer(BOTTOMUP_WS_PROJ_NAME);
- } else {
- projectExplorer.runOnServer(EAR_PROJECT_NAME);
- }
- if (clientType >= CLIENT_SCALE_ASSEMBLE) {
- // client was not assembled into EAR
- projectExplorer.runOnServer(BOTTOMUP_WS_CLIENT_PROJ_NAME);
-
- } else {
- projectExplorer.runOnServer(EAR_PROJECT_NAME);
- }
- // but we need to run any of wars on server (to get browser)
- projectExplorer.runOnServer(BOTTOMUP_WS_PROJ_NAME);
- assertServiceResponseToClient(BOTTOMUP_WS_CLIENT_SERVLET_URL,
- "1234567890");
- servers.removeAllProjectsFromServer(configuredState.getServer().name);
- assertServiceNotDeployed(BOTTOMUP_WS_WSDL_URL);
- servers.removeAllProjectsFromServer();
- projectExplorer.deleteAllProjects();
- }
-}
Deleted: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/JbossWSTest.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/JbossWSTest.java 2010-11-19 14:32:37 UTC (rev 26767)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/JbossWSTest.java 2010-11-19 14:40:46 UTC (rev 26768)
@@ -1,293 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.ws.ui.bot.test;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.Reader;
-import java.io.StringWriter;
-import java.io.Writer;
-import java.net.HttpURLConnection;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.text.MessageFormat;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import org.eclipse.swtbot.swt.finder.SWTBot;
-import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotCombo;
-import org.jboss.tools.ui.bot.ext.SWTTestExt;
-import org.jboss.tools.ui.bot.ext.gen.ActionItem;
-import org.jboss.tools.ui.bot.ext.gen.ActionItem.NewObject.Class;
-import org.jboss.tools.ui.bot.ext.gen.ActionItem.NewObject.JavaEEEnterpriseApplicationProject;
-import org.jboss.tools.ui.bot.ext.gen.ActionItem.NewObject.WebServicesWebService;
-import org.jboss.tools.ui.bot.ext.gen.ActionItem.NewObject.WebServicesWebServiceClient;
-import org.jboss.tools.ui.bot.ext.gen.ActionItem.NewObject.WebServlet;
-import org.jboss.tools.ui.bot.ext.parts.SWTBotHyperlinkExt;
-import org.jboss.tools.ui.bot.ext.parts.SWTBotScaleExt;
-import org.jboss.tools.ui.bot.ext.types.IDELabel;
-import org.jboss.tools.ws.ui.bot.test.uiutils.actions.NewFileWizardAction;
-import org.jboss.tools.ws.ui.bot.test.uiutils.wizards.DynamicWebProjectWizard;
-import org.junit.runner.RunWith;
-
-(a)RunWith(SWTBotJunit4ClassRunner.class)
-public class JbossWSTest extends SWTTestExt {
-
- public static final String EAR_PROJECT_NAME="EAR";
- public static final String PKG_NAME="jbossws";
-
- public static final String CLASS_A="ClassA";
- public static final String CLASS_B="ClassB";
- public static final String CLASS_C="ClassC";
- public static final String BOTTOMUP_WS_PROJ_NAME="BottomUpJbossWS";
- public static final String BOTTOMUP_WS_WSDL_URL="http://localhost:8080/"+BOTTOMUP_WS_PROJ_NAME+"/"+CLASS_A+"?wsdl";
- public static final String BOTTOMUP_WS_CLIENT_PROJ_NAME = "BottomUpJbossWSClient";
- public static final String BOTTOMUP_WS_CLIENT_SERVLET_NAME = "BottomUpJbossWStest";
- public static final String BOTTOMUP_WS_CLIENT_SERVLET_URL = "http://localhost:8080/"+BOTTOMUP_WS_CLIENT_PROJ_NAME+"/"+BOTTOMUP_WS_CLIENT_SERVLET_NAME;
- public static final String TWO_SERVICES_CLIENT_SERVLET_NAME="TwoServicesJbossWStest";
- public static final String TWO_SERVICES_CLIENT_SERVLET_URL = "http://localhost:8080/"+BOTTOMUP_WS_CLIENT_PROJ_NAME+"/"+TWO_SERVICES_CLIENT_SERVLET_NAME;
- public static final String TOPDOWN_WS_PROJ_NAME="TopDownJbossWS";
- public static final String TOPDOWN_WS_WSDL_URL="http://localhost:8080/"+TOPDOWN_WS_PROJ_NAME+"/"+CLASS_B+"?wsdl";
- public static final String TOPDOWN_WS_CLIENT_PROJ_NAME = "TopDownJbossWSClient";
- public static final String TOPDOWN_WS_CLIENT_SERVLET_NAME = "TopDownJbossWStest";
- public static final String TOPDOWN_WS_CLIENT_SERVLET_URL = "http://localhost:8080/"+TOPDOWN_WS_CLIENT_PROJ_NAME+"/"+TOPDOWN_WS_CLIENT_SERVLET_NAME;
- public static final String JBOSSWS_CRED_LOGIN="admin";
- public static final String JBOSSWS_CRED_PASS="admin";
- public static final int CLIENT_SCALE_DEVELOP=5;
- public static final int CLIENT_SCALE_ASSEMBLE=4;
- public static final int CLIENT_SCALE_DEPLOY=3;
- public static final int CLIENT_SCALE_INSTALL=2;
- public static final int CLIENT_SCALE_START=1;
- public static final int CLIENT_SCALE_TEST=0;
- public static final int SERVICE_SCALE_DEVELOP=5;
- public static final int SERVICE_SCALE_ASSEMBLE=4;
- public static final int SERVICE_SCALE_DEPLOY=3;
- public static final int SERVICE_SCALE_INSTALL=2;
- public static final int SERVICE_SCALE_START=1;
- public static final int SERVICE_SCALE_TEST=0;
- protected static Map<Integer,String> wizardConfigTexts = new HashMap<Integer, String>();
-
- private static final String SOAP_REQUEST_TEMPLATE = "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\" ?>" +
- "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"" +
- " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"" +
- " xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">" +
- "<soap:Body>{0}</soap:Body>" +
- "</soap:Envelope>";;
-
- private static final Logger L = Logger.getLogger(JbossWSTest.class.getName());
- public JbossWSTest() {
-
- }
-
- static {
- wizardConfigTexts.put(0, "Test");
- wizardConfigTexts.put(1, "Start");
- wizardConfigTexts.put(2, "Install");
- wizardConfigTexts.put(3, "Deploy");
- wizardConfigTexts.put(4, "Assemble");
- wizardConfigTexts.put(5, "Develop");
- }
-
- protected void createClient(String projectName, String servletName,String wsdlDef, int type) {
- createProject(projectName);
- SWTBot wiz = open.newObject(WebServicesWebServiceClient.LABEL);
- wiz.comboBoxWithLabel(
- WebServicesWebServiceClient.TEXT_SERVICE_DEFINITION).setText(
- wsdlDef);
- SWTBotScaleExt slider = bot.scale();
- slider.setSelection(type);
- selectJbossWSRuntime();
- bot.sleep(TIME_1S); // wait for wizard to validate wsdl url and
- // enable Finish button
- open.finish(wiz);
- projectExplorer.selectProject(projectName);
- // create servlet which will invoke service
- createInvokingServlet(servletName);
- }
-
- /**
- * checks if 'Web Service Runtime' is set to 'JbossWS' and possibly sets it correctly
- * @param wiz wizard page of new Web Service
- */
- protected void selectJbossWSRuntime() {
- SWTBotHyperlinkExt link = bot.hyperlink(1);
- String linkText = link.getText();
- if (!linkText.contains("JBossWS")) {
- link.click();
- SWTBot dBot = bot.activeShell().bot();
- dBot.tree().select("JBossWS");
- open.finish(dBot,IDELabel.Button.OK);
- }
- }
-
- protected void bottomUpService(String projName, String serviceClass, int serverType) {
- SWTBot wiz = open.newObject(Class.LABEL);
- wiz.textWithLabel(Class.TEXT_PACKAGE).setText(PKG_NAME);
- wiz.textWithLabel(Class.TEXT_NAME).setText(serviceClass);
- open.finish(wiz);
- eclipse.setClassContentFromResource(bot.editorByTitle(serviceClass
- + ".java"), true,
- org.jboss.tools.ws.ui.bot.test.Activator.PLUGIN_ID,
- PKG_NAME, serviceClass + ".java.ws");
- wiz = open.newObject(ActionItem.NewObject.WebServicesWebService.LABEL);
- wiz.textWithLabel(WebServicesWebService.TEXT_SERVICE_IMPLEMENTATION)
- .setText(PKG_NAME + "." + serviceClass);
- SWTBotScaleExt slider = bot.scale();
- slider.setSelection(serverType);
- selectJbossWSRuntime();
- open.finish(wiz);
- projectExplorer.runOnServer(projName);
- }
-
- protected void createInvokingServlet(String servletName) {
- SWTBot wiz = open.newObject(WebServlet.LABEL);
- wiz.textWithLabel(WebServlet.TEXT_JAVA_PACKAGE).setText(
- PKG_NAME);
- wiz.textWithLabel(WebServlet.TEXT_CLASS_NAME).setText(
- servletName);
- open.finish(wiz);
- eclipse.setClassContentFromResource(bot
- .editorByTitle(servletName
- + ".java"), true,
- org.jboss.tools.ws.ui.bot.test.Activator.PLUGIN_ID,
- PKG_NAME, servletName
- + ".java.servlet");
- }
-
- protected void createProject(String name) {
- new NewFileWizardAction().run().selectTemplate("Web", "Dynamic Web Project").next();
- new DynamicWebProjectWizard().setProjectName(name).finish();
- util.waitForNonIgnoredJobs();
- assertTrue(projectExplorer.existsResource(name));
- projectExplorer.selectProject(name);
- }
-
- protected void createEARProject(String name) {
- SWTBot wiz = open.newObject(JavaEEEnterpriseApplicationProject.LABEL);
- wiz.textWithLabel(JavaEEEnterpriseApplicationProject.TEXT_PROJECT_NAME).setText(name);
- // set EAR version
- SWTBotCombo combo = wiz.comboBox(1);
- combo.setSelection(combo.itemCount()-1);
- wiz.button(IDELabel.Button.NEXT).click();
- wiz.checkBox("Generate application.xml deployment descriptor").click();
- open.finish(wiz);
- assertTrue(projectExplorer.existsResource(name));
- projectExplorer.selectProject(name);
- }
-
- protected void assertServiceDeployed(String wsdlURL) {
- HttpURLConnection connection = null;
- try {
- URL u = new URL(wsdlURL);
- connection = (HttpURLConnection) u.openConnection();
- assertEquals("Service was not sucessfully deployed, WSDL '" + wsdlURL + "' was not found",
- HttpURLConnection.HTTP_OK, connection.getResponseCode());
- } catch (MalformedURLException e1) {
- // TODO Auto-generated catch block
- e1.printStackTrace();
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } finally {
- if (connection != null) {
- connection.disconnect();
- }
- }
- }
-
- protected void assertServiceNotDeployed(String wsdlURL) {
- HttpURLConnection connection = null;
- try {
- URL u = new URL(wsdlURL);
- connection = (HttpURLConnection) u.openConnection();
- assertEquals("Project was not sucessfully undeployed, WSDL '" + wsdlURL + "' is still available",
- HttpURLConnection.HTTP_NOT_FOUND, connection.getResponseCode());
- } catch (MalformedURLException e1) {
- // TODO Auto-generated catch block
- e1.printStackTrace();
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } finally {
- if (connection != null) {
- connection.disconnect();
- }
- }
- }
-
- protected void assertServiceResponseToClient(String startServlet, String response) {
- InputStream is = null;
- try {
- URL u = new URL(startServlet);
- is = u.openStream();
- String rsp = readStream(is);
- assertContains(response, rsp);
- } catch (MalformedURLException e1) {
- // TODO Auto-generated catch block
- e1.printStackTrace();
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } finally {
- if (is != null) {
- try {
- is.close();
- } catch (IOException e) {
- //ignore
- e.printStackTrace();
- }
- }
- }
- }
-
- public static String getSoapRequest(String body) {
- return MessageFormat.format(SOAP_REQUEST_TEMPLATE, body);
- }
-
- protected String readStream(InputStream is) {
- Reader r = null;
- Writer w = null;
- try {
- char[] buffer = new char[1024];
- r = new BufferedReader(new InputStreamReader(is, "UTF-8"));
- w = new StringWriter();
- int n;
- while ((n = r.read(buffer)) != -1) {
- w.write(buffer, 0, n);
- }
- } catch (IOException e) {
- L.log(Level.WARNING, e.getMessage(), e);
- } finally {
- if (r != null) {
- try {
- r.close();
- } catch (IOException e) {
- //ignore
- L.log(Level.WARNING, e.getMessage(), e);
- }
- }
- if (w != null) {
- try {
- w.close();
- } catch (IOException e) {
- //ignore
- L.log(Level.WARNING, e.getMessage(), e);
- }
- }
- }
- return w != null ? w.toString() : "";
- }
-}
Deleted: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/SampleWebService.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/SampleWebService.java 2010-11-19 14:32:37 UTC (rev 26767)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/SampleWebService.java 2010-11-19 14:40:46 UTC (rev 26768)
@@ -1,188 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.ws.ui.bot.test;
-
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.text.MessageFormat;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import javax.xml.namespace.QName;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
-import org.jboss.tools.ui.bot.ext.config.Annotations.SWTBotTestRequires;
-import org.jboss.tools.ui.bot.ext.config.Annotations.Server;
-import org.jboss.tools.ui.bot.ext.gen.ActionItem;
-import org.jboss.tools.ws.ui.bot.test.uiutils.actions.NewSampleWSWizardAction;
-import org.jboss.tools.ws.ui.bot.test.uiutils.actions.TreeItemAction;
-import org.jboss.tools.ws.ui.bot.test.uiutils.wizards.SampleWSWizard;
-import org.jboss.tools.ws.ui.bot.test.uiutils.wizards.SampleWSWizard.Type;
-import org.junit.AfterClass;
-import org.junit.Test;
-
-
-@SWTBotTestRequires(server=@Server(),perspective="Java EE")
-public class SampleWebService extends JbossWSTest {
-
- private static final String SOAP_REQUEST = getSoapRequest("<ns1:sayHello xmlns:ns1=\"http://{0}/\"><arg0>{1}</arg0></ns1:sayHello>");
- private static final String SERVER_URL = "localhost:8080";
- private static final Logger L = Logger.getLogger(SampleWebService.class.getName());
-
- @AfterClass
- public static void cleanup() {
- servers.removeAllProjectsFromServer();
- projectExplorer.deleteAllProjects();
- }
-
- @Test
- public void testSampleSoapWS() {
- String project = "SampleSOAPWS";
- createProject(project);
- IFile dd = getDD(project);
- if (!dd.exists()) {
- createDD(project);
- }
- assertTrue(dd.exists());
- createSampleSOAPWS(project, "HelloService", "sample", "SampleService");
- checkSOAPService(project, "HelloService", "sample", "SampleService", "You");
-
- createSampleSOAPWS(project, "GreetService", "greeter", "Greeter");
- checkSOAPService(project, "GreetService", "greeter", "Greeter", "Tester");
- }
-
- @Test
- public void testSampleRestWS() {
- if ("JBOSS_AS".equals(configuredState.getServer().type)) {
- fail("This test requires RESTEasy jars in the server");
- }
- String project = "SampleRESTWS";
- createProject(project);
- IFile dd = getDD(project);
- if (!dd.exists()) {
- createDD(project);
- }
- assertTrue(dd.exists());
- createSampleRESTWS(project, "RESTSample", "rest.sample", "Sample", "RESTApp");
- checkRESTService(project, "RESTSample", "rest.sample", "Sample", "Hello World!", "RESTApp");
- }
-
- private void createDD(String project) {
- SWTBotTree tree = projectExplorer.tree();
- SWTBotTreeItem ti = tree.expandNode(project);
- bot.sleep(500);
- ti = ti.getNode("Deployment Descriptor: " + project);
- new TreeItemAction(ti, "Generate Deployment Descriptor Stub").run();
- util.waitForNonIgnoredJobs();
- }
-
- private void createSampleSOAPWS(String project, String name, String pkg, String cls) {
- createSampleService(Type.SOAP, project, name, pkg, cls, null);
- }
-
- private void checkSOAPService(String project, String svcName, String svcPkg, String svcClass, String msgContent) {
- checkService(Type.SOAP, project, svcName, svcPkg, svcClass, msgContent, null);
- }
-
- private void checkRESTService(String project, String svcName, String svcPkg, String svcClass, String msgContent, String appCls) {
- checkService(Type.REST, project, svcName, svcPkg, svcClass, msgContent, appCls);
- }
-
- private void createSampleRESTWS(String project, String name, String pkg, String cls, String appCls) {
- createSampleService(Type.REST, project, name, pkg, cls, appCls);
- }
-
- private void createSampleService(Type type, String project, String name, String pkg, String cls, String appCls) {
- SampleWSWizard w = new NewSampleWSWizardAction(type).run();
- w.setProjectName(project).setServiceName(name);
- w.setPackageName(pkg).setClassName(cls);
- if (type == Type.REST) {
- w.setApplicationClassName(appCls);
- }
- w.finish();
- util.waitForNonIgnoredJobs();
- }
-
- private void runProject(String project) {
- open.viewOpen(ActionItem.View.ServerServers.LABEL);
- projectExplorer.runOnServer(project);
- bot.sleep(5000);
- }
-
- private void checkService(Type type, String project, String svcName, String svcPkg, String svcClass, String msgContent, String appCls) {
- SWTBotEditor ed = bot.activeEditor();
- assertEquals(svcClass + ".java", ed.getTitle());
- String code = ed.toTextEditor().getText();
- assertContains("package " + svcPkg + ";", code);
- String dd = readFile(getDD(project));
- switch (type) {
- case REST:
- assertContains("@Path(\"/" + svcName + "\")", code);
- assertContains("@GET()", code);
- assertContains("@Produces(\"text/plain\")", code);
- assertContains("<servlet-name>Resteasy</servlet-name>", dd);
- assertContains("<param-value>" + svcPkg + "." + appCls + "</param-value>", dd);
- break;
- case SOAP:
- assertContains("<servlet-name>" + svcName + "</servlet-name>", dd);
- break;
- }
- runProject(project);
- switch (type) {
- case REST:
- try {
- URL u = new URL("http://" + SERVER_URL + "/" + project + "/" + svcName);
- String s = readStream(u.openConnection().getInputStream());
- assertEquals(msgContent, s);
- } catch (MalformedURLException e) {
- L.log(Level.WARNING, e.getMessage(), e);
- } catch (IOException e) {
- L.log(Level.WARNING, e.getMessage(), e);
- }
- break;
- case SOAP:
- try {
- WSClient c = new WSClient(new URL("http://" + SERVER_URL + "/" + project + "/" + svcName),
- new QName("http://" + svcPkg + "/", svcClass + "Service"),
- new QName("http://" + svcPkg + "/", svcClass + "Port"));
- assertContains("Hello " + msgContent + "!", c.callService(MessageFormat.format(SOAP_REQUEST, svcPkg, msgContent)));
- } catch (MalformedURLException e) {
- L.log(Level.WARNING, e.getMessage(), e);
- }
- break;
- }
- }
-
- private IProject getProject(String project) {
- return ResourcesPlugin.getWorkspace().getRoot().getProject(project);
- }
-
- private IFile getDD(String project) {
- return getProject(project).getFile("WebContent/WEB-INF/web.xml");
- }
-
- private String readFile(IFile file) {
- try {
- return readStream(file.getContents());
- } catch (CoreException e) {
- L.log(Level.WARNING, e.getMessage(), e);
- }
- return "";
- }
-
-}
Deleted: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/TopDownWebService.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/TopDownWebService.java 2010-11-19 14:32:37 UTC (rev 26767)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/TopDownWebService.java 2010-11-19 14:40:46 UTC (rev 26768)
@@ -1,81 +0,0 @@
-package org.jboss.tools.ws.ui.bot.test;
-
-import org.eclipse.swtbot.swt.finder.SWTBot;
-import org.jboss.tools.ui.bot.ext.config.Annotations.*;
-import org.jboss.tools.ui.bot.ext.gen.ActionItem.NewObject.WebServicesWSDL;
-import org.jboss.tools.ui.bot.ext.gen.ActionItem.NewObject.WebServicesWebService;
-import org.jboss.tools.ui.bot.ext.parts.SWTBotScaleExt;
-import org.jboss.tools.ui.bot.ext.types.IDELabel;
-import org.junit.Test;
-
-@SWTBotTestRequires(server=@Server(),perspective="Java EE")
-public class TopDownWebService extends JbossWSTest {
-
- @Test
- public void topDownJbossWS1() {
- int testLevel = 3;
- for (int j=0;j<testLevel;j++) {
- topDownJbossWebService(0, j);
- }
- }
-
- @Test
- public void topDownJbossWS2() {
- int testLevel = 3;
- for (int j=0;j<testLevel;j++) {
- topDownJbossWebService(1, j);
- }
- }
-
- @Test
- public void topDownJbossWS3() {
- int testLevel = 3;
- for (int j=0;j<testLevel;j++) {
- topDownJbossWebService(2, j);
- }
- }
-
- private void topDownJbossWebService(int serverType, int clientType) {
- log.info(" * Running test ServiceType: '"+wizardConfigTexts.get(serverType)+"', ClientType: '"+wizardConfigTexts.get(clientType)+"'");
- createEARProject(EAR_PROJECT_NAME);
- createProject(TOPDOWN_WS_PROJ_NAME);
- SWTBot wiz = open.newObject(WebServicesWSDL.LABEL);
- wiz.textWithLabel(WebServicesWSDL.TEXT_FILE_NAME).setText(
- CLASS_B + ".wsdl");
- wiz.textWithLabel(
- WebServicesWSDL.TEXT_ENTER_OR_SELECT_THE_PARENT_FOLDER)
- .setText(TOPDOWN_WS_PROJ_NAME + "/src");
- wiz.button(IDELabel.Button.NEXT).click();
- open.finish(wiz);
- eclipse.setClassContentFromResource(bot.editorByTitle(CLASS_B
- + ".wsdl"), true,
- org.jboss.tools.ws.ui.bot.test.Activator.PLUGIN_ID,
- PKG_NAME, CLASS_B + ".wsdl");
- wiz = open.newObject(WebServicesWebService.LABEL);
- wiz.comboBoxWithLabel(WebServicesWebService.TEXT_WEB_SERVICE_TYPE)
- .setSelection(1);
- wiz.comboBoxWithLabel("Service definition:").setText(
- "/" + TOPDOWN_WS_PROJ_NAME + "/src/"
- + CLASS_B + ".wsdl");
- SWTBotScaleExt slider = bot.scale();
- slider.setSelection(serverType);
- selectJbossWSRuntime();
- open.finish(wiz);
- servers.removeProjectFromServers(EAR_PROJECT_NAME);
- projectExplorer.runOnServer(TOPDOWN_WS_PROJ_NAME);
- assertServiceDeployed(TOPDOWN_WS_WSDL_URL);
- // create and run client
-
- createClient(TOPDOWN_WS_CLIENT_PROJ_NAME, TOPDOWN_WS_CLIENT_SERVLET_NAME, TOPDOWN_WS_WSDL_URL, clientType);
-
- servers.removeProjectFromServers(EAR_PROJECT_NAME);
- projectExplorer.runOnServer(TOPDOWN_WS_PROJ_NAME);
- projectExplorer.runOnServer(TOPDOWN_WS_CLIENT_PROJ_NAME);
-
- assertServiceResponseToClient(TOPDOWN_WS_CLIENT_SERVLET_URL, "0");
- servers.removeAllProjectsFromServer(configuredState.getServer().name);
- assertServiceNotDeployed(TOPDOWN_WS_WSDL_URL);
- servers.removeAllProjectsFromServer();
- projectExplorer.deleteAllProjects();
- }
-}
Deleted: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/TwoBUWSInOneProject.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/TwoBUWSInOneProject.java 2010-11-19 14:32:37 UTC (rev 26767)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/TwoBUWSInOneProject.java 2010-11-19 14:40:46 UTC (rev 26768)
@@ -1,53 +0,0 @@
-package org.jboss.tools.ws.ui.bot.test;
-
-import org.eclipse.swtbot.swt.finder.SWTBot;
-import org.jboss.tools.ui.bot.ext.config.Annotations.SWTBotTestRequires;
-import org.jboss.tools.ui.bot.ext.config.Annotations.Server;
-import org.jboss.tools.ui.bot.ext.gen.ActionItem.NewObject.WebServicesWebServiceClient;
-import org.junit.AfterClass;
-import org.junit.Test;
-
-@SWTBotTestRequires(server=@Server(),perspective="Java EE")
-public class TwoBUWSInOneProject extends JbossWSTest {
-
- @Test
- public void twoServices() {
- createEARProject(EAR_PROJECT_NAME);
- createProject(BOTTOMUP_WS_PROJ_NAME);
- // service A
- bottomUpService(BOTTOMUP_WS_PROJ_NAME, CLASS_A,SERVICE_SCALE_START);
- // service B
- bottomUpService(BOTTOMUP_WS_PROJ_NAME, CLASS_B,SERVICE_SCALE_START);
-
- assertServiceDeployed(BOTTOMUP_WS_WSDL_URL);
- assertServiceDeployed(BOTTOMUP_WS_WSDL_URL.replace(CLASS_A, CLASS_B));
-
- // generate client stubs
- createClient(BOTTOMUP_WS_CLIENT_PROJ_NAME, TWO_SERVICES_CLIENT_SERVLET_NAME, BOTTOMUP_WS_WSDL_URL, CLIENT_SCALE_START);
- util.waitForAll(TIME_5S);
- // service B client
- SWTBot wiz = open.newObject(WebServicesWebServiceClient.LABEL);
- wiz.comboBoxWithLabel(
- WebServicesWebServiceClient.TEXT_SERVICE_DEFINITION).setText(
- BOTTOMUP_WS_WSDL_URL.replace(CLASS_A, CLASS_B));
- bot.sleep(TIME_1S);// wait for wizard to validate wsdl url and enable 'Finish' button
- selectJbossWSRuntime();
- open.finish(wiz);
- util.waitForAll(TIME_5S);
- // create servlet which will inovke service
- createInvokingServlet(TWO_SERVICES_CLIENT_SERVLET_NAME);
-
- // we need to undeploy auto-created EAR and deploy service and client
- // wars again
- servers.removeAllProjectsFromServer(configuredState.getServer().name);
- projectExplorer.runOnServer(BOTTOMUP_WS_PROJ_NAME);
- projectExplorer.runOnServer(BOTTOMUP_WS_CLIENT_PROJ_NAME);
- assertServiceResponseToClient(TWO_SERVICES_CLIENT_SERVLET_URL,
- "1234567890");
- assertServiceResponseToClient(TWO_SERVICES_CLIENT_SERVLET_URL,
- "11111");
- servers.removeAllProjectsFromServer(configuredState.getServer().name);
- assertServiceNotDeployed(BOTTOMUP_WS_WSDL_URL);
-
- }
-}
Modified: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/WSAllBotTests.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/WSAllBotTests.java 2010-11-19 14:32:37 UTC (rev 26767)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/WSAllBotTests.java 2010-11-19 14:40:46 UTC (rev 26768)
@@ -11,14 +11,16 @@
package org.jboss.tools.ws.ui.bot.test;
import org.jboss.tools.ui.bot.ext.RequirementAwareSuite;
+import org.jboss.tools.ws.ui.bot.test.jbt.SampleWSTest;
+import org.jboss.tools.ws.ui.bot.test.wtp.BottomUpWSTest;
+import org.jboss.tools.ws.ui.bot.test.wtp.TopDownWSTest;
import org.junit.runner.RunWith;
import org.junit.runners.Suite.SuiteClasses;
@SuiteClasses({
- //SampleWebService.class,
- TwoBUWSInOneProject.class,
- //BottomUpWebService.class,
- //TopDownWebService.class
+ SampleWSTest.class,
+ BottomUpWSTest.class,
+ TopDownWSTest.class
})
@RunWith(RequirementAwareSuite.class)
public class WSAllBotTests {
Deleted: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/WSClient.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/WSClient.java 2010-11-19 14:32:37 UTC (rev 26767)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/WSClient.java 2010-11-19 14:40:46 UTC (rev 26768)
@@ -1,76 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.ws.ui.bot.test;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.net.URL;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import javax.xml.namespace.QName;
-import javax.xml.soap.MessageFactory;
-import javax.xml.soap.SOAPException;
-import javax.xml.soap.SOAPMessage;
-import javax.xml.ws.Dispatch;
-import javax.xml.ws.Service;
-import javax.xml.ws.Service.Mode;
-
-public class WSClient {
-
- private static final Logger L = Logger.getLogger(WSClient.class.getName());
- private Dispatch<SOAPMessage> d;
-
- public WSClient(URL location, QName serviceName, QName portName) {
- Service s = Service.create(location, serviceName);
- d = s.createDispatch(portName, SOAPMessage.class, Mode.MESSAGE);
- }
-
- public String callService(String message) {
- SOAPMessage result = null;
- try {
- SOAPMessage msg = MessageFactory.newInstance().createMessage( null, new ByteArrayInputStream(message.getBytes()));
- msg.saveChanges();
- result = d.invoke(msg);
- } catch (SOAPException e) {
- L.log(Level.WARNING, e.getMessage(), e);
- } catch (IOException e) {
- L.log(Level.WARNING, e.getMessage(), e);
- }
- String s = msgToString(result);
- L.fine("SOAP Request :\n" + message);
- L.fine("SOAP Response:\n" + s);
- return s;
- }
-
- private String msgToString(SOAPMessage msg) {
- if (msg == null) {
- return "";
- }
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- try {
- msg.writeTo(out);
- } catch (SOAPException e) {
- L.log(Level.WARNING, e.getMessage(), e);
- } catch (IOException e) {
- L.log(Level.WARNING, e.getMessage(), e);
- } finally {
- try {
- out.close();
- } catch (IOException e) {
- //ignore
- L.log(Level.WARNING, e.getMessage(), e);
- }
- }
- return out.toString();
- }
-}
Deleted: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/WsTesterTest.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/WsTesterTest.java 2010-11-19 14:32:37 UTC (rev 26767)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/WsTesterTest.java 2010-11-19 14:40:46 UTC (rev 26768)
@@ -1,381 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.ws.ui.bot.test;
-
-import java.io.BufferedOutputStream;
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.util.Arrays;
-import java.util.List;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
-import org.jboss.tools.ui.bot.ext.SWTTestExt;
-import org.jboss.tools.ws.ui.bot.test.widgets.SelectWSDLDialog;
-import org.jboss.tools.ws.ui.bot.test.widgets.WsTesterView;
-import org.jboss.tools.ws.ui.bot.test.widgets.WsTesterView.Request_Arg_Type;
-import org.jboss.tools.ws.ui.bot.test.widgets.WsTesterView.Request_Type;
-import org.jboss.tools.ws.ui.messages.JBossWSUIMessages;
-import org.junit.Assert;
-import org.junit.Test;
-
-/**
- * Tests for Web Service Tester
- *
- * @author jlukas
- */
-public class WsTesterTest extends SWTTestExt {
-
- private static final Logger L = Logger.getLogger(WsTesterTest.class.getName());
- private static final String SERVICE_URL = "http://www.webservicex.net/BibleWebservice.asmx";
-
- /**
- * Test behavior of UI
- */
- @Test
- public void testUI() {
- WsTesterView wstv = new WsTesterView();
- SWTBotView viewBot = wstv.show();
- Assert.assertTrue("Tester View is not active", viewBot.isActive());
- wstv.setRequestType(Request_Type.PUT);
- Assert.assertEquals(Request_Type.PUT, wstv.getRequestType());
- wstv.setRequestType(Request_Type.JAX_WS);
- Assert.assertEquals(Request_Type.JAX_WS, wstv.getRequestType());
-
- wstv.setRequestType(Request_Type.DELETE);
- Assert.assertEquals(Request_Type.DELETE, wstv.getRequestType());
- wstv.expandSection(Request_Arg_Type.HEADER.toString());
- wstv.addRequestArg(Request_Arg_Type.HEADER, "a", "1");
- wstv.addRequestArg(Request_Arg_Type.HEADER, "b", "2");
- wstv.addRequestArg(Request_Arg_Type.HEADER, "c", "3");
- Assert.assertEquals(3, wstv.getRequestArgs(Request_Arg_Type.HEADER).keySet().size());
- Assert.assertTrue(wstv.getRequestArgs(Request_Arg_Type.HEADER).containsKey("b"));
- wstv.addRequestArg(Request_Arg_Type.HEADER, "d", "4");
- Assert.assertEquals(4, wstv.getRequestArgs(Request_Arg_Type.HEADER).keySet().size());
- Assert.assertTrue(wstv.getRequestArgs(Request_Arg_Type.HEADER).containsKey("d"));
- Assert.assertEquals(4, wstv.getRequestArgs(Request_Arg_Type.HEADER).keySet().size());
- wstv.removeRequestArg(Request_Arg_Type.HEADER, "a", "1");
- wstv.removeRequestArg(Request_Arg_Type.HEADER, "c", "3");
- Assert.assertEquals(2, wstv.getRequestArgs(Request_Arg_Type.HEADER).keySet().size());
- wstv.clearRequestArgs(Request_Arg_Type.HEADER);
- Assert.assertEquals(0, wstv.getRequestArgs(Request_Arg_Type.HEADER).keySet().size());
-
- wstv.setRequestType(Request_Type.JAX_WS);
- selectPort(wstv, "BibleWebserviceSoap");
- Assert.assertTrue(wstv.getRequestBody().contains("http://schemas.xmlsoap.org/soap/envelope/"));
- selectPort(wstv, "BibleWebserviceSoap12");
- Assert.assertTrue("Got: " + wstv.getRequestBody(), wstv.getRequestBody().contains("http://www.w3.org/2003/05/soap-envelope"));
- viewBot.close();
- }
-
- /**
- * Test refreshing body requests in the UI
- */
- @Test
- public void testNamespaces() {
- String uri = new File(prepareWsdl(), "original.wsdl").toURI().toString();
- WsTesterView wstv = new WsTesterView();
- SWTBotView viewBot = wstv.show();
- Assert.assertTrue("Tester View is not active", viewBot.isActive());
- SelectWSDLDialog dlg = wstv.getFromWSDL();
- dlg.setURI(uri);
- bot.sleep(1000);
- List<String> items = dlg.getServices();
- L.log(Level.FINE, "Services: {0}", items);
- Assert.assertEquals(2, items.size());
- Assert.assertTrue(items.contains("EchoService"));
- items = dlg.getPorts();
- L.log(Level.FINE, "Ports: {0}", items);
- Assert.assertEquals(1, items.size());
- Assert.assertTrue(items.contains("EchoPort"));
- items = dlg.getOperations();
- L.log(Level.FINE, "Operations: {0}", items);
- Assert.assertEquals(1, items.size());
- Assert.assertTrue(items.contains("echo"));
- dlg.ok();
- L.log(Level.INFO, "Request: {0}", wstv.getRequestBody());
- Assert.assertTrue(wstv.getRequestBody().contains(
- "<echo xmlns = \"http://test.jboss.org/ns\">"));
-
- dlg = wstv.getFromWSDL();
- dlg.setURI(uri);
- bot.sleep(1000);
- items = dlg.getServices();
- L.log(Level.FINE, "Services: {0}", items);
- Assert.assertEquals(2, items.size());
- Assert.assertTrue(items.contains("gsearch_rss"));
- dlg.selectService("gsearch_rss");
- items = dlg.getPorts();
- L.log(Level.FINE, "Ports: {0}", items);
- Assert.assertEquals(1, items.size());
- Assert.assertTrue(items.contains("gsearch_rssSoap"));
- items = dlg.getOperations();
- L.log(Level.FINE, "Operations: {0}", items);
- Assert.assertEquals(1, items.size());
- Assert.assertTrue(items.contains("GetSearchResults"));
- dlg.ok();
- L.log(Level.INFO, "Request: {0}", wstv.getRequestBody());
- Assert.assertTrue(wstv.getRequestBody().contains(
- "<GetSearchResults xmlns = \"http://www.ecubicle.net/webservices\">"));
- }
-
- /**
- * Test SOAP service invocation
- */
- @Test
- public void testSOAPService() {
- WsTesterView wstv = new WsTesterView();
- wstv.show();
- wstv.setRequestType(Request_Type.JAX_WS);
- Assert.assertEquals(Request_Type.JAX_WS, wstv.getRequestType());
- wstv.setServiceURL(SERVICE_URL + "?WSDL");
- InputStream is = WsTesterTest.class.getResourceAsStream("/resources/jbossws/message_soap_out.xml");
- wstv.setRequestBody(readResource(is));
- wstv.invoke();
- String rsp = wstv.getResponseBody();
- L.log(Level.FINE, "SOAP response: {0}", rsp);
- Assert.assertTrue(rsp.trim().length() > 0);
- checkResponse(rsp, "<BookTitle>Mark</BookTitle>");
- }
-
- /**
- * Test SOAP 1.2 service invocation
- */
- @Test
- public void testSOAP12Service() {
- WsTesterView wstv = new WsTesterView();
- wstv.show();
- wstv.setRequestType(Request_Type.JAX_WS);
- Assert.assertEquals(Request_Type.JAX_WS, wstv.getRequestType());
- SelectWSDLDialog dlg = wstv.getFromWSDL();
- try {
- dlg.openURL();
- SWTBotShell sh = bot.activeShell();
- sh.bot().text().typeText(SERVICE_URL + "?WSDL");
- sh.bot().button("OK").click();
- bot.sleep(1000);
- Assert.assertEquals(SERVICE_URL + "?WSDL", dlg.getURI());
- dlg.selectPort("BibleWebserviceSoap12");
- dlg.ok();
- } finally {
- if (dlg.isOpen()) {
- dlg.close();
- }
- }
- Assert.assertEquals(SERVICE_URL + "?WSDL", wstv.getServiceURL());
- InputStream is = WsTesterTest.class.getResourceAsStream("/resources/jbossws/message_soap12_out.xml");
- wstv.setRequestBody(readResource(is));
- wstv.invoke();
- String rsp = wstv.getResponseBody();
- L.log(Level.FINE, "SOAP response: {0}", rsp);
- Assert.assertTrue(rsp.trim().length() > 0);
- checkResponse(rsp, "<BookTitle>Mark</BookTitle>");
- }
-
- /**
- * Test REST service invocation (GET request)
- */
- @Test
- public void testRESTGETService() {
- WsTesterView wstv = new WsTesterView();
- wstv.show();
- wstv.setRequestType(Request_Type.GET);
- wstv.setServiceURL(SERVICE_URL + "/GetBibleWordsByChapterAndVerse");
- wstv.expandSection(Request_Arg_Type.PARAMETER.toString());
- wstv.addRequestArg(Request_Arg_Type.PARAMETER, "BookTitle", "Luke");
- wstv.addRequestArg(Request_Arg_Type.PARAMETER, "chapter", "2");
- wstv.addRequestArg(Request_Arg_Type.PARAMETER, "Verse", "2");
- wstv.editRequestArg(Request_Arg_Type.PARAMETER, "chapter", "2", "chapter", "1");
- try {
- wstv.invoke();
- String rsp = wstv.getResponseBody();
- String[] rspHeaders = wstv.getResponseHeaders();
- L.log(Level.FINE, "REST response: {0}", rsp);
- L.log(Level.FINE, "Response headers: {0}", Arrays.asList(rspHeaders));
- Assert.assertTrue(rsp.trim().length() > 0);
- checkResponse(rsp, "<Chapter>1</Chapter>");
- checkResponse(rsp, "ministers of the word");
- } finally {
- wstv.clearRequestArgs(Request_Arg_Type.PARAMETER);
- }
- }
-
- /**
- * Test REST service invocation (POST request)
- */
- @Test
- public void testRESTPOSTService() {
- WsTesterView wstv = new WsTesterView();
- wstv.show();
- wstv.setRequestType(WsTesterView.Request_Type.POST);
- wstv.setServiceURL(SERVICE_URL + "/GetBibleWordsByChapterAndVerse");
- String requestBody = "BookTitle=John&chapter=3&Verse=1\r";
- wstv.setRequestBody(requestBody);
- wstv.expandSection(JBossWSUIMessages.JAXRSWSTestView2_ResponseHeaders_Section);
- wstv.addRequestArg(Request_Arg_Type.HEADER, "Content-Type", "application/x-www-form-urlencoded");
- wstv.addRequestArg(Request_Arg_Type.HEADER, "Content-Length", String.valueOf(requestBody.length()));
- try {
- wstv.invoke();
- String rsp = wstv.getResponseBody();
- String[] rspHeaders = wstv.getResponseHeaders();
- L.log(Level.FINE, "REST response: {0}", rsp);
- L.log(Level.FINE, "Response headers: {0}", Arrays.asList(rspHeaders));
- Assert.assertTrue(rsp.trim().length() > 0);
- checkResponse(rsp, "<Chapter>3</Chapter>");
- checkResponse(rsp, "There was a man of the Pharisees, named Nicodemus, a ruler of the Jews");
- } finally {
- wstv.clearRequestArgs(Request_Arg_Type.HEADER);
- }
- }
-
- @Test
- public void testErrorResponse() {
- WsTesterView wstv = new WsTesterView();
- wstv.show();
- wstv.setRequestType(Request_Type.GET);
- wstv.setServiceURL("http://www.zvents.com/rest/event_update");
- wstv.invoke();
- Assert.assertEquals(0, wstv.getRequestArgs(Request_Arg_Type.PARAMETER).size());
- String rsp = wstv.getResponseBody();
- String[] rspHeaders = wstv.getResponseHeaders();
- L.log(Level.FINE, "REST response: {0}", rsp);
- L.log(Level.FINE, "Response headers: {0}", Arrays.asList(rspHeaders));
- Assert.assertTrue(rsp.trim().length() > 0);
- checkResponse(rsp, "Invalid API Key.");
- }
-
- private String readResource(InputStream is) {
- StringBuilder sb = new StringBuilder();
- BufferedReader br = null;
- try {
- br = new BufferedReader(new InputStreamReader(is));
- String s;
- while ((s = br.readLine()) != null) {
- sb.append(s);
- sb.append('\n');
- }
- } catch (IOException e) {
- L.log(Level.WARNING, e.getMessage(), e);
- } finally {
- if (br != null) {
- try {
- br.close();
- } catch (IOException e) {
- L.log(Level.FINEST, e.getMessage(), e);
- }
- }
- }
- return sb.toString();
- }
-
- private void checkResponse(String rsp, String expContent) {
- try {
- Assert.assertTrue(rsp, rsp.contains(expContent));
- } catch (AssertionError t) {
- if (rsp.contains("503")) {
- L.log(Level.WARNING, "Service Unavailable: {0}", SERVICE_URL);
- } else {
- throw t;
- }
- }
- }
-
- private File prepareWsdl() {
- String[] files = { "imported.wsdl", "original.wsdl", "schema.xsd" };
- File targetFolder = new File(System.getProperty("java.io.tmpdir"),
- "WsTesterTest");
- targetFolder.mkdirs();
- for (String file : files) {
- InputStream is = WsTesterTest.class.getResourceAsStream("/wsdl/"
- + file);
- File target = new File(targetFolder, file);
- if (target.exists()) {
- target.delete();
- }
- try {
- OutputStream os = new BufferedOutputStream(
- new FileOutputStream(target));
- copy(is, os);
- } catch (FileNotFoundException fnfe) {
- throw new RuntimeException(fnfe);
- }
- }
- return targetFolder;
- }
-
- private void copy(InputStream in, OutputStream out) {
- byte[] buf = new byte[1024];
- int len;
- try {
- while ((len = in.read(buf)) > 0) {
- out.write(buf, 0, len);
- }
- } catch (IOException ioe) {
- throw new RuntimeException(ioe);
- } finally {
- if (in != null) {
- try {
- in.close();
- } catch (IOException ioe2) {
- L.log(Level.WARNING, ioe2.getMessage(), ioe2);
- }
- }
- if (out != null) {
- try {
- out.close();
- } catch (IOException ioe2) {
- L.log(Level.WARNING, ioe2.getMessage(), ioe2);
- }
- }
- }
- }
-
- private void selectPort(WsTesterView wstv, String portName) {
- SelectWSDLDialog dlg = wstv.getFromWSDL();
- try {
- dlg.openURL();
- SWTBotShell sh = bot.activeShell();
- sh.bot().text().typeText(SERVICE_URL + "?WSDL");
- sh.bot().button("OK").click();
- bot.sleep(1000);
- Assert.assertEquals(SERVICE_URL + "?WSDL", dlg.getURI());
- List<String> items = dlg.getServices();
- L.log(Level.FINE, "Services: {0}", items);
- Assert.assertEquals(1, items.size());
- Assert.assertTrue(items.contains("BibleWebservice"));
- items = dlg.getPorts();
- L.log(Level.FINE, "Ports: {0}", items);
- Assert.assertEquals(2, items.size());
- Assert.assertTrue(items.contains("BibleWebserviceSoap"));
- Assert.assertTrue(items.contains("BibleWebserviceSoap12"));
- dlg.selectPort(portName);
- items = dlg.getOperations();
- L.log(Level.FINE, "Operations: {0}", items);
- Assert.assertEquals(4, items.size());
- Assert.assertTrue(items.contains("GetBookTitles"));
- Assert.assertTrue(items.contains("GetBibleWordsByChapterAndVerse"));
- dlg.selectOperation("GetBibleWordsbyKeyWord");
- dlg.ok();
- Assert.assertEquals("http://www.webservicex.net/BibleWebservice.asmx?WSDL", wstv.getServiceURL());
- } finally {
- if (dlg.isOpen()) {
- dlg.close();
- }
- } }
-}
Copied: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/jbt/SampleWSTest.java (from rev 26699, trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/SampleWebService.java)
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/jbt/SampleWSTest.java (rev 0)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/jbt/SampleWSTest.java 2010-11-19 14:40:46 UTC (rev 26768)
@@ -0,0 +1,197 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.ws.ui.bot.test.jbt;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.text.MessageFormat;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.xml.namespace.QName;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
+import org.jboss.tools.ui.bot.ext.config.Annotations.SWTBotTestRequires;
+import org.jboss.tools.ui.bot.ext.config.Annotations.Server;
+import org.jboss.tools.ws.ui.bot.test.uiutils.actions.NewSampleWSWizardAction;
+import org.jboss.tools.ws.ui.bot.test.uiutils.actions.TreeItemAction;
+import org.jboss.tools.ws.ui.bot.test.uiutils.wizards.SampleWSWizard;
+import org.jboss.tools.ws.ui.bot.test.uiutils.wizards.SampleWSWizard.Type;
+import org.jboss.tools.ws.ui.bot.test.utils.WSClient;
+import org.jboss.tools.ws.ui.bot.test.wtp.WSTestBase;
+import org.junit.AfterClass;
+import org.junit.Test;
+
+
+@SWTBotTestRequires(server=@Server(),perspective="Java EE")
+public class SampleWSTest extends WSTestBase {
+
+ private static final String SOAP_REQUEST = getSoapRequest("<ns1:sayHello xmlns:ns1=\"http://{0}/\"><arg0>{1}</arg0></ns1:sayHello>");
+ private static final String SERVER_URL = "localhost:8080";
+ private static final Logger L = Logger.getLogger(SampleWSTest.class.getName());
+
+ @AfterClass
+ public static void clean() {
+ servers.removeAllProjectsFromServer();
+ projectExplorer.deleteAllProjects();
+ }
+
+ @Override
+ protected String getWsProjectName() {
+ return "SampleSOAPWS";
+ }
+
+ @Test
+ public void testSampleSoapWS() {
+ IFile dd = getDD(getWsProjectName());
+ if (!dd.exists()) {
+ createDD(getWsProjectName());
+ }
+ assertTrue(dd.exists());
+ createSampleSOAPWS(getWsProjectName(), "HelloService", "sample", "SampleService");
+ checkSOAPService(getWsProjectName(), "HelloService", "sample", "SampleService", "You");
+
+ createSampleSOAPWS(getWsProjectName(), "GreetService", "greeter", "Greeter");
+ checkSOAPService(getWsProjectName(), "GreetService", "greeter", "Greeter", "Tester");
+ }
+
+ @Test
+ public void testSampleRestWS() {
+ if ("JBOSS_AS".equals(configuredState.getServer().type)) {
+ fail("This test requires RESTEasy jars in the server");
+ }
+ String project = "SampleRESTWS";
+ createProject(project);
+ IFile dd = getDD(project);
+ if (!dd.exists()) {
+ createDD(project);
+ }
+ assertTrue(dd.exists());
+ createSampleRESTWS(project, "RESTSample", "rest.sample", "Sample", "RESTApp");
+ checkRESTService(project, "RESTSample", "rest.sample", "Sample", "Hello World!", "RESTApp");
+ }
+
+ private void createDD(String project) {
+ SWTBotTree tree = projectExplorer.tree();
+ SWTBotTreeItem ti = tree.expandNode(project);
+ bot.sleep(500);
+ ti = ti.getNode("Deployment Descriptor: " + project);
+ new TreeItemAction(ti, "Generate Deployment Descriptor Stub").run();
+ util.waitForNonIgnoredJobs();
+ }
+
+ private void createSampleSOAPWS(String project, String name, String pkg, String cls) {
+ createSampleService(Type.SOAP, project, name, pkg, cls, null);
+ }
+
+ private void checkSOAPService(String project, String svcName, String svcPkg, String svcClass, String msgContent) {
+ checkService(Type.SOAP, project, svcName, svcPkg, svcClass, msgContent, null);
+ }
+
+ private void checkRESTService(String project, String svcName, String svcPkg, String svcClass, String msgContent, String appCls) {
+ checkService(Type.REST, project, svcName, svcPkg, svcClass, msgContent, appCls);
+ }
+
+ private void createSampleRESTWS(String project, String name, String pkg, String cls, String appCls) {
+ createSampleService(Type.REST, project, name, pkg, cls, appCls);
+ }
+
+ private void createSampleService(Type type, String project, String name, String pkg, String cls, String appCls) {
+ SampleWSWizard w = new NewSampleWSWizardAction(type).run();
+ w.setProjectName(project).setServiceName(name);
+ w.setPackageName(pkg).setClassName(cls);
+ if (type == Type.REST) {
+ w.setApplicationClassName(appCls);
+ }
+ w.finish();
+ util.waitForNonIgnoredJobs();
+ }
+
+ private void checkService(Type type, String project, String svcName, String svcPkg, String svcClass, String msgContent, String appCls) {
+ SWTBotEditor ed = bot.activeEditor();
+ assertEquals(svcClass + ".java", ed.getTitle());
+ String code = ed.toTextEditor().getText();
+ assertContains("package " + svcPkg + ";", code);
+ String dd = readFile(getDD(project));
+ switch (type) {
+ case REST:
+ assertContains("@Path(\"/" + svcName + "\")", code);
+ assertContains("@GET()", code);
+ assertContains("@Produces(\"text/plain\")", code);
+ assertContains("<servlet-name>Resteasy</servlet-name>", dd);
+ assertContains("<param-value>" + svcPkg + "." + appCls + "</param-value>", dd);
+ break;
+ case SOAP:
+ assertContains("<servlet-name>" + svcName + "</servlet-name>", dd);
+ break;
+ }
+ runProject(project);
+ switch (type) {
+ case REST:
+ try {
+ URL u = new URL("http://" + SERVER_URL + "/" + project + "/" + svcName);
+ String s = readStream(u.openConnection().getInputStream());
+ assertEquals(msgContent, s);
+ } catch (MalformedURLException e) {
+ L.log(Level.WARNING, e.getMessage(), e);
+ } catch (IOException e) {
+ L.log(Level.WARNING, e.getMessage(), e);
+ }
+ break;
+ case SOAP:
+ try {
+ WSClient c = new WSClient(new URL("http://" + SERVER_URL + "/" + project + "/" + svcName),
+ new QName("http://" + svcPkg + "/", svcClass + "Service"),
+ new QName("http://" + svcPkg + "/", svcClass + "Port"));
+ assertContains("Hello " + msgContent + "!", c.callService(MessageFormat.format(SOAP_REQUEST, svcPkg, msgContent)));
+ } catch (MalformedURLException e) {
+ L.log(Level.WARNING, e.getMessage(), e);
+ }
+ break;
+ }
+ }
+
+ private IProject getProject(String project) {
+ return ResourcesPlugin.getWorkspace().getRoot().getProject(project);
+ }
+
+ private IFile getDD(String project) {
+ return getProject(project).getFile("WebContent/WEB-INF/web.xml");
+ }
+
+ private String readFile(IFile file) {
+ try {
+ return readStream(file.getContents());
+ } catch (CoreException e) {
+ L.log(Level.WARNING, e.getMessage(), e);
+ }
+ return "";
+ }
+
+ @Override
+ protected String getWsPackage() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ protected String getWsName() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+}
Copied: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/jbt/WsTesterTest.java (from rev 26699, trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/WsTesterTest.java)
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/jbt/WsTesterTest.java (rev 0)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/jbt/WsTesterTest.java 2010-11-19 14:40:46 UTC (rev 26768)
@@ -0,0 +1,381 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.ws.ui.bot.test.jbt;
+
+import java.io.BufferedOutputStream;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.util.Arrays;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
+import org.jboss.tools.ui.bot.ext.SWTTestExt;
+import org.jboss.tools.ws.ui.bot.test.widgets.SelectWSDLDialog;
+import org.jboss.tools.ws.ui.bot.test.widgets.WsTesterView;
+import org.jboss.tools.ws.ui.bot.test.widgets.WsTesterView.Request_Arg_Type;
+import org.jboss.tools.ws.ui.bot.test.widgets.WsTesterView.Request_Type;
+import org.jboss.tools.ws.ui.messages.JBossWSUIMessages;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * Tests for Web Service Tester
+ *
+ * @author jlukas
+ */
+public class WsTesterTest extends SWTTestExt {
+
+ private static final Logger L = Logger.getLogger(WsTesterTest.class.getName());
+ private static final String SERVICE_URL = "http://www.webservicex.net/BibleWebservice.asmx";
+
+ /**
+ * Test behavior of UI
+ */
+ @Test
+ public void testUI() {
+ WsTesterView wstv = new WsTesterView();
+ SWTBotView viewBot = wstv.show();
+ Assert.assertTrue("Tester View is not active", viewBot.isActive());
+ wstv.setRequestType(Request_Type.PUT);
+ Assert.assertEquals(Request_Type.PUT, wstv.getRequestType());
+ wstv.setRequestType(Request_Type.JAX_WS);
+ Assert.assertEquals(Request_Type.JAX_WS, wstv.getRequestType());
+
+ wstv.setRequestType(Request_Type.DELETE);
+ Assert.assertEquals(Request_Type.DELETE, wstv.getRequestType());
+ wstv.expandSection(Request_Arg_Type.HEADER.toString());
+ wstv.addRequestArg(Request_Arg_Type.HEADER, "a", "1");
+ wstv.addRequestArg(Request_Arg_Type.HEADER, "b", "2");
+ wstv.addRequestArg(Request_Arg_Type.HEADER, "c", "3");
+ Assert.assertEquals(3, wstv.getRequestArgs(Request_Arg_Type.HEADER).keySet().size());
+ Assert.assertTrue(wstv.getRequestArgs(Request_Arg_Type.HEADER).containsKey("b"));
+ wstv.addRequestArg(Request_Arg_Type.HEADER, "d", "4");
+ Assert.assertEquals(4, wstv.getRequestArgs(Request_Arg_Type.HEADER).keySet().size());
+ Assert.assertTrue(wstv.getRequestArgs(Request_Arg_Type.HEADER).containsKey("d"));
+ Assert.assertEquals(4, wstv.getRequestArgs(Request_Arg_Type.HEADER).keySet().size());
+ wstv.removeRequestArg(Request_Arg_Type.HEADER, "a", "1");
+ wstv.removeRequestArg(Request_Arg_Type.HEADER, "c", "3");
+ Assert.assertEquals(2, wstv.getRequestArgs(Request_Arg_Type.HEADER).keySet().size());
+ wstv.clearRequestArgs(Request_Arg_Type.HEADER);
+ Assert.assertEquals(0, wstv.getRequestArgs(Request_Arg_Type.HEADER).keySet().size());
+
+ wstv.setRequestType(Request_Type.JAX_WS);
+ selectPort(wstv, "BibleWebserviceSoap");
+ Assert.assertTrue(wstv.getRequestBody().contains("http://schemas.xmlsoap.org/soap/envelope/"));
+ selectPort(wstv, "BibleWebserviceSoap12");
+ Assert.assertTrue("Got: " + wstv.getRequestBody(), wstv.getRequestBody().contains("http://www.w3.org/2003/05/soap-envelope"));
+ viewBot.close();
+ }
+
+ /**
+ * Test refreshing body requests in the UI
+ */
+ @Test
+ public void testNamespaces() {
+ String uri = new File(prepareWsdl(), "original.wsdl").toURI().toString();
+ WsTesterView wstv = new WsTesterView();
+ SWTBotView viewBot = wstv.show();
+ Assert.assertTrue("Tester View is not active", viewBot.isActive());
+ SelectWSDLDialog dlg = wstv.getFromWSDL();
+ dlg.setURI(uri);
+ bot.sleep(1000);
+ List<String> items = dlg.getServices();
+ L.log(Level.FINE, "Services: {0}", items);
+ Assert.assertEquals(2, items.size());
+ Assert.assertTrue(items.contains("EchoService"));
+ items = dlg.getPorts();
+ L.log(Level.FINE, "Ports: {0}", items);
+ Assert.assertEquals(1, items.size());
+ Assert.assertTrue(items.contains("EchoPort"));
+ items = dlg.getOperations();
+ L.log(Level.FINE, "Operations: {0}", items);
+ Assert.assertEquals(1, items.size());
+ Assert.assertTrue(items.contains("echo"));
+ dlg.ok();
+ L.log(Level.INFO, "Request: {0}", wstv.getRequestBody());
+ Assert.assertTrue(wstv.getRequestBody().contains(
+ "<echo xmlns = \"http://test.jboss.org/ns\">"));
+
+ dlg = wstv.getFromWSDL();
+ dlg.setURI(uri);
+ bot.sleep(1000);
+ items = dlg.getServices();
+ L.log(Level.FINE, "Services: {0}", items);
+ Assert.assertEquals(2, items.size());
+ Assert.assertTrue(items.contains("gsearch_rss"));
+ dlg.selectService("gsearch_rss");
+ items = dlg.getPorts();
+ L.log(Level.FINE, "Ports: {0}", items);
+ Assert.assertEquals(1, items.size());
+ Assert.assertTrue(items.contains("gsearch_rssSoap"));
+ items = dlg.getOperations();
+ L.log(Level.FINE, "Operations: {0}", items);
+ Assert.assertEquals(1, items.size());
+ Assert.assertTrue(items.contains("GetSearchResults"));
+ dlg.ok();
+ L.log(Level.INFO, "Request: {0}", wstv.getRequestBody());
+ Assert.assertTrue(wstv.getRequestBody().contains(
+ "<GetSearchResults xmlns = \"http://www.ecubicle.net/webservices\">"));
+ }
+
+ /**
+ * Test SOAP service invocation
+ */
+ @Test
+ public void testSOAPService() {
+ WsTesterView wstv = new WsTesterView();
+ wstv.show();
+ wstv.setRequestType(Request_Type.JAX_WS);
+ Assert.assertEquals(Request_Type.JAX_WS, wstv.getRequestType());
+ wstv.setServiceURL(SERVICE_URL + "?WSDL");
+ InputStream is = WsTesterTest.class.getResourceAsStream("/resources/jbossws/message_soap_out.xml");
+ wstv.setRequestBody(readResource(is));
+ wstv.invoke();
+ String rsp = wstv.getResponseBody();
+ L.log(Level.FINE, "SOAP response: {0}", rsp);
+ Assert.assertTrue(rsp.trim().length() > 0);
+ checkResponse(rsp, "<BookTitle>Mark</BookTitle>");
+ }
+
+ /**
+ * Test SOAP 1.2 service invocation
+ */
+ @Test
+ public void testSOAP12Service() {
+ WsTesterView wstv = new WsTesterView();
+ wstv.show();
+ wstv.setRequestType(Request_Type.JAX_WS);
+ Assert.assertEquals(Request_Type.JAX_WS, wstv.getRequestType());
+ SelectWSDLDialog dlg = wstv.getFromWSDL();
+ try {
+ dlg.openURL();
+ SWTBotShell sh = bot.activeShell();
+ sh.bot().text().typeText(SERVICE_URL + "?WSDL");
+ sh.bot().button("OK").click();
+ bot.sleep(1000);
+ Assert.assertEquals(SERVICE_URL + "?WSDL", dlg.getURI());
+ dlg.selectPort("BibleWebserviceSoap12");
+ dlg.ok();
+ } finally {
+ if (dlg.isOpen()) {
+ dlg.close();
+ }
+ }
+ Assert.assertEquals(SERVICE_URL + "?WSDL", wstv.getServiceURL());
+ InputStream is = WsTesterTest.class.getResourceAsStream("/resources/jbossws/message_soap12_out.xml");
+ wstv.setRequestBody(readResource(is));
+ wstv.invoke();
+ String rsp = wstv.getResponseBody();
+ L.log(Level.FINE, "SOAP response: {0}", rsp);
+ Assert.assertTrue(rsp.trim().length() > 0);
+ checkResponse(rsp, "<BookTitle>Mark</BookTitle>");
+ }
+
+ /**
+ * Test REST service invocation (GET request)
+ */
+ @Test
+ public void testRESTGETService() {
+ WsTesterView wstv = new WsTesterView();
+ wstv.show();
+ wstv.setRequestType(Request_Type.GET);
+ wstv.setServiceURL(SERVICE_URL + "/GetBibleWordsByChapterAndVerse");
+ wstv.expandSection(Request_Arg_Type.PARAMETER.toString());
+ wstv.addRequestArg(Request_Arg_Type.PARAMETER, "BookTitle", "Luke");
+ wstv.addRequestArg(Request_Arg_Type.PARAMETER, "chapter", "2");
+ wstv.addRequestArg(Request_Arg_Type.PARAMETER, "Verse", "2");
+ wstv.editRequestArg(Request_Arg_Type.PARAMETER, "chapter", "2", "chapter", "1");
+ try {
+ wstv.invoke();
+ String rsp = wstv.getResponseBody();
+ String[] rspHeaders = wstv.getResponseHeaders();
+ L.log(Level.FINE, "REST response: {0}", rsp);
+ L.log(Level.FINE, "Response headers: {0}", Arrays.asList(rspHeaders));
+ Assert.assertTrue(rsp.trim().length() > 0);
+ checkResponse(rsp, "<Chapter>1</Chapter>");
+ checkResponse(rsp, "ministers of the word");
+ } finally {
+ wstv.clearRequestArgs(Request_Arg_Type.PARAMETER);
+ }
+ }
+
+ /**
+ * Test REST service invocation (POST request)
+ */
+ @Test
+ public void testRESTPOSTService() {
+ WsTesterView wstv = new WsTesterView();
+ wstv.show();
+ wstv.setRequestType(WsTesterView.Request_Type.POST);
+ wstv.setServiceURL(SERVICE_URL + "/GetBibleWordsByChapterAndVerse");
+ String requestBody = "BookTitle=John&chapter=3&Verse=1\r";
+ wstv.setRequestBody(requestBody);
+ wstv.expandSection(JBossWSUIMessages.JAXRSWSTestView2_ResponseHeaders_Section);
+ wstv.addRequestArg(Request_Arg_Type.HEADER, "Content-Type", "application/x-www-form-urlencoded");
+ wstv.addRequestArg(Request_Arg_Type.HEADER, "Content-Length", String.valueOf(requestBody.length()));
+ try {
+ wstv.invoke();
+ String rsp = wstv.getResponseBody();
+ String[] rspHeaders = wstv.getResponseHeaders();
+ L.log(Level.FINE, "REST response: {0}", rsp);
+ L.log(Level.FINE, "Response headers: {0}", Arrays.asList(rspHeaders));
+ Assert.assertTrue(rsp.trim().length() > 0);
+ checkResponse(rsp, "<Chapter>3</Chapter>");
+ checkResponse(rsp, "There was a man of the Pharisees, named Nicodemus, a ruler of the Jews");
+ } finally {
+ wstv.clearRequestArgs(Request_Arg_Type.HEADER);
+ }
+ }
+
+ @Test
+ public void testErrorResponse() {
+ WsTesterView wstv = new WsTesterView();
+ wstv.show();
+ wstv.setRequestType(Request_Type.GET);
+ wstv.setServiceURL("http://www.zvents.com/rest/event_update");
+ wstv.invoke();
+ Assert.assertEquals(0, wstv.getRequestArgs(Request_Arg_Type.PARAMETER).size());
+ String rsp = wstv.getResponseBody();
+ String[] rspHeaders = wstv.getResponseHeaders();
+ L.log(Level.FINE, "REST response: {0}", rsp);
+ L.log(Level.FINE, "Response headers: {0}", Arrays.asList(rspHeaders));
+ Assert.assertTrue(rsp.trim().length() > 0);
+ checkResponse(rsp, "Invalid API Key.");
+ }
+
+ private String readResource(InputStream is) {
+ StringBuilder sb = new StringBuilder();
+ BufferedReader br = null;
+ try {
+ br = new BufferedReader(new InputStreamReader(is));
+ String s;
+ while ((s = br.readLine()) != null) {
+ sb.append(s);
+ sb.append('\n');
+ }
+ } catch (IOException e) {
+ L.log(Level.WARNING, e.getMessage(), e);
+ } finally {
+ if (br != null) {
+ try {
+ br.close();
+ } catch (IOException e) {
+ L.log(Level.FINEST, e.getMessage(), e);
+ }
+ }
+ }
+ return sb.toString();
+ }
+
+ private void checkResponse(String rsp, String expContent) {
+ try {
+ Assert.assertTrue(rsp, rsp.contains(expContent));
+ } catch (AssertionError t) {
+ if (rsp.contains("503")) {
+ L.log(Level.WARNING, "Service Unavailable: {0}", SERVICE_URL);
+ } else {
+ throw t;
+ }
+ }
+ }
+
+ private File prepareWsdl() {
+ String[] files = { "imported.wsdl", "original.wsdl", "schema.xsd" };
+ File targetFolder = new File(System.getProperty("java.io.tmpdir"),
+ "WsTesterTest");
+ targetFolder.mkdirs();
+ for (String file : files) {
+ InputStream is = WsTesterTest.class.getResourceAsStream("/wsdl/"
+ + file);
+ File target = new File(targetFolder, file);
+ if (target.exists()) {
+ target.delete();
+ }
+ try {
+ OutputStream os = new BufferedOutputStream(
+ new FileOutputStream(target));
+ copy(is, os);
+ } catch (FileNotFoundException fnfe) {
+ throw new RuntimeException(fnfe);
+ }
+ }
+ return targetFolder;
+ }
+
+ private void copy(InputStream in, OutputStream out) {
+ byte[] buf = new byte[1024];
+ int len;
+ try {
+ while ((len = in.read(buf)) > 0) {
+ out.write(buf, 0, len);
+ }
+ } catch (IOException ioe) {
+ throw new RuntimeException(ioe);
+ } finally {
+ if (in != null) {
+ try {
+ in.close();
+ } catch (IOException ioe2) {
+ L.log(Level.WARNING, ioe2.getMessage(), ioe2);
+ }
+ }
+ if (out != null) {
+ try {
+ out.close();
+ } catch (IOException ioe2) {
+ L.log(Level.WARNING, ioe2.getMessage(), ioe2);
+ }
+ }
+ }
+ }
+
+ private void selectPort(WsTesterView wstv, String portName) {
+ SelectWSDLDialog dlg = wstv.getFromWSDL();
+ try {
+ dlg.openURL();
+ SWTBotShell sh = bot.activeShell();
+ sh.bot().text().typeText(SERVICE_URL + "?WSDL");
+ sh.bot().button("OK").click();
+ bot.sleep(1000);
+ Assert.assertEquals(SERVICE_URL + "?WSDL", dlg.getURI());
+ List<String> items = dlg.getServices();
+ L.log(Level.FINE, "Services: {0}", items);
+ Assert.assertEquals(1, items.size());
+ Assert.assertTrue(items.contains("BibleWebservice"));
+ items = dlg.getPorts();
+ L.log(Level.FINE, "Ports: {0}", items);
+ Assert.assertEquals(2, items.size());
+ Assert.assertTrue(items.contains("BibleWebserviceSoap"));
+ Assert.assertTrue(items.contains("BibleWebserviceSoap12"));
+ dlg.selectPort(portName);
+ items = dlg.getOperations();
+ L.log(Level.FINE, "Operations: {0}", items);
+ Assert.assertEquals(4, items.size());
+ Assert.assertTrue(items.contains("GetBookTitles"));
+ Assert.assertTrue(items.contains("GetBibleWordsByChapterAndVerse"));
+ dlg.selectOperation("GetBibleWordsbyKeyWord");
+ dlg.ok();
+ Assert.assertEquals("http://www.webservicex.net/BibleWebservice.asmx?WSDL", wstv.getServiceURL());
+ } finally {
+ if (dlg.isOpen()) {
+ dlg.close();
+ }
+ } }
+}
Added: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/uiutils/wizards/WebServiceWizard.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/uiutils/wizards/WebServiceWizard.java (rev 0)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/uiutils/wizards/WebServiceWizard.java 2010-11-19 14:40:46 UTC (rev 26768)
@@ -0,0 +1,164 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.ws.ui.bot.test.uiutils.wizards;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.swt.widgets.Scale;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swtbot.swt.finder.matchers.WidgetMatcherFactory;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotCombo;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
+import org.eclipse.ui.forms.widgets.Hyperlink;
+import org.jboss.tools.ui.bot.ext.parts.SWTBotHyperlinkExt;
+import org.jboss.tools.ui.bot.ext.parts.SWTBotScaleExt;
+
+public class WebServiceWizard extends Wizard {
+
+ public enum Service_Type {
+ BOTTOM_UP, TOP_DOWN;
+
+ String getDescription() {
+ String prefix = "";
+ switch (this) {
+ case BOTTOM_UP:
+ prefix += "Bottom up";
+ break;
+ case TOP_DOWN:
+ prefix += "Top down";
+ break;
+ default:
+ throw new IllegalArgumentException("Unknown type: " + this);
+ }
+ return prefix + " Java bean Web Service";
+ }
+ }
+
+ public enum Slider_Level {
+ TEST, START, INSTALL, DEPLOY, ASSEMBLE, DEVELOP, NO_CLIENT;
+
+ @Override
+ public String toString() {
+ return name().charAt(0) + name().substring(1).toLowerCase();
+ }
+ }
+
+ public WebServiceWizard() {
+ super();
+ }
+
+ public WebServiceWizard(Shell shell) {
+ super(shell);
+ }
+
+ public WebServiceWizard setServiceType(Service_Type type) {
+ bot().comboBoxWithLabel("Web service type:").setSelection(type.getDescription());
+ return this;
+ }
+
+ public Service_Type getServiceType() {
+ String s = bot().comboBoxWithLabel("Web service type:").getText();
+ return s.startsWith("Bottom up") ? Service_Type.BOTTOM_UP : Service_Type.TOP_DOWN;
+ }
+
+ public WebServiceWizard setServiceSource(String s) {
+ SWTBotCombo c = null;
+ switch (getServiceType()) {
+ case BOTTOM_UP:
+ c = bot().comboBoxWithLabel("Service implementation:");
+ break;
+ case TOP_DOWN:
+ c = bot().comboBoxWithLabel("Service definition:");
+ break;
+ default:
+ throw new IllegalArgumentException("Unknown type: " + this);
+ }
+ c.typeText(s);
+ return this;
+ }
+
+ public WebServiceWizard setServerRuntime(String name) {
+ findLink("Server runtime:").get(0).click();
+ SWTBotShell sh = bot().activeShell();
+ SWTBotTree tree = sh.bot().treeInGroup("Server runtime:");
+ tree.expandNode("Existing Servers", name).select();
+ sh.bot().button("OK").click();
+ sleep(50);
+ return this;
+ }
+
+ public WebServiceWizard setWebServiceRuntime(String name) {
+ findLink("Web service runtime:").get(0).click();
+ SWTBotShell sh = bot().activeShell();
+ SWTBotTree tree = sh.bot().treeInGroup("Web service runtime:");
+ tree.select(name);
+ sh.bot().button("OK").click();
+ sleep(50);
+ return this;
+ }
+
+ public WebServiceWizard setServiceProject(String name) {
+ findLink("Service project:").get(0).click();
+ SWTBotShell sh = bot().activeShell();
+ sh.bot().comboBoxWithLabel("Service project:").setSelection(name);
+ sh.bot().button("OK").click();
+ sleep(50);
+ return this;
+ }
+
+ public WebServiceWizard setServiceEARProject(String name) {
+ findLink("Service EAR project:").get(0).click();
+ SWTBotShell sh = bot().activeShell();
+ sh.bot().comboBoxWithLabel("Service EAR project:").setSelection(name);
+ sh.bot().button("OK").click();
+ sleep(50);
+ return this;
+ }
+
+ public WebServiceWizard setServiceSlider(Slider_Level level) {
+ if (Slider_Level.NO_CLIENT == level) {
+ throw new UnsupportedOperationException("Unsupported level: " + level);
+ }
+ scale(0).setSelection(level.ordinal());
+ return this;
+ }
+
+ public WebServiceWizard setClientSlider(Slider_Level level) {
+ scale(1).setSelection(level.ordinal());
+ return this;
+ }
+
+ public boolean isClientEnabled() {
+ return scale(1).isEnabled();
+ }
+
+ private List<SWTBotHyperlinkExt> findLink(String text) {
+ List<? extends Hyperlink> widgets = bot().widgets(WidgetMatcherFactory.widgetOfType(Hyperlink.class));
+ List<SWTBotHyperlinkExt> ret = new ArrayList<SWTBotHyperlinkExt>();
+ for (Hyperlink h: widgets) {
+ if (h.getText().indexOf(text) > -1) {
+ ret.add(new SWTBotHyperlinkExt(h));
+ }
+ }
+ return ret;
+ }
+
+ private SWTBotScaleExt scale(int i) {
+ List<? extends Scale> widgets = bot().widgets(WidgetMatcherFactory.widgetOfType(Scale.class));
+ List<SWTBotScaleExt> ret = new ArrayList<SWTBotScaleExt>();
+ for (Scale s: widgets) {
+ ret.add(new SWTBotScaleExt(s));
+ }
+ return ret.get(i);
+ }
+}
Modified: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/uiutils/wizards/Wizard.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/uiutils/wizards/Wizard.java 2010-11-19 14:32:37 UTC (rev 26767)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/uiutils/wizards/Wizard.java 2010-11-19 14:40:46 UTC (rev 26768)
@@ -11,13 +11,21 @@
package org.jboss.tools.ws.ui.bot.test.uiutils.wizards;
import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.TreeItem;
+import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;
+import org.eclipse.swtbot.swt.finder.results.VoidResult;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotText;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
+import org.jboss.tools.ui.bot.ext.SWTBotExt;
public class Wizard extends SWTBotShell {
+ public Wizard() {
+ this(new SWTBotExt().activeShell().widget);
+ }
+
public Wizard(Shell shell) {
super(shell);
assert getText().contains("New ");
@@ -25,10 +33,21 @@
public Wizard selectTemplate(String... item) {
assert item.length > 0;
- SWTBotTree tree = bot().tree();
+ final SWTBotTree tree = bot().tree();
SWTBotTreeItem ti = null;
for (int i = 0; i < item.length - 1; i++) {
ti = ti != null ? ti.expandNode(item[i]).select() : tree.expandNode(item[i]).select();
+ //make sure ti is visible
+ final TreeItem t = ti.widget;
+ UIThreadRunnable.syncExec(new VoidResult() {
+
+ @Override
+ public void run() {
+ tree.widget.showItem(t);
+ }
+ });
+ ti.click();
+ sleep(50);
}
sleep(100);
if (ti != null) {
Copied: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/utils/WSClient.java (from rev 26699, trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/WSClient.java)
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/utils/WSClient.java (rev 0)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/utils/WSClient.java 2010-11-19 14:40:46 UTC (rev 26768)
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.ws.ui.bot.test.utils;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.net.URL;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.MessageFactory;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.ws.Dispatch;
+import javax.xml.ws.Service;
+import javax.xml.ws.Service.Mode;
+
+public class WSClient {
+
+ private static final Logger L = Logger.getLogger(WSClient.class.getName());
+ private Dispatch<SOAPMessage> d;
+
+ public WSClient(URL location, QName serviceName, QName portName) {
+ Service s = Service.create(location, serviceName);
+ d = s.createDispatch(portName, SOAPMessage.class, Mode.MESSAGE);
+ }
+
+ public String callService(String message) {
+ SOAPMessage result = null;
+ try {
+ SOAPMessage msg = MessageFactory.newInstance().createMessage( null, new ByteArrayInputStream(message.getBytes()));
+ msg.saveChanges();
+ result = d.invoke(msg);
+ } catch (SOAPException e) {
+ L.log(Level.WARNING, e.getMessage(), e);
+ } catch (IOException e) {
+ L.log(Level.WARNING, e.getMessage(), e);
+ }
+ String s = msgToString(result);
+ L.fine("SOAP Request :\n" + message);
+ L.fine("SOAP Response:\n" + s);
+ return s;
+ }
+
+ private String msgToString(SOAPMessage msg) {
+ if (msg == null) {
+ return "";
+ }
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ try {
+ msg.writeTo(out);
+ } catch (SOAPException e) {
+ L.log(Level.WARNING, e.getMessage(), e);
+ } catch (IOException e) {
+ L.log(Level.WARNING, e.getMessage(), e);
+ } finally {
+ try {
+ out.close();
+ } catch (IOException e) {
+ //ignore
+ L.log(Level.WARNING, e.getMessage(), e);
+ }
+ }
+ return out.toString();
+ }
+}
Copied: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/wtp/BottomUpWSTest.java (from rev 26699, trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/BottomUpWebService.java)
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/wtp/BottomUpWSTest.java (rev 0)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/wtp/BottomUpWSTest.java 2010-11-19 14:40:46 UTC (rev 26768)
@@ -0,0 +1,112 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.ws.ui.bot.test.wtp;
+
+import java.text.MessageFormat;
+
+import org.jboss.tools.ui.bot.ext.config.Annotations.SWTBotTestRequires;
+import org.jboss.tools.ui.bot.ext.config.Annotations.Server;
+import org.jboss.tools.ws.ui.bot.test.uiutils.wizards.WebServiceWizard.Service_Type;
+import org.jboss.tools.ws.ui.bot.test.uiutils.wizards.WebServiceWizard.Slider_Level;
+import org.junit.Test;
+
+
+@SWTBotTestRequires(server=@Server(),perspective="Java EE")
+public class BottomUpWSTest extends WSTestBase {
+
+ //http://localhost:8080/BottomUpWS/ClassA?wsdl
+ /*
+ <soap:Body>
+<method xmlns = "http://jbossws/">
+</method>
+</soap:Body>
+
+<soap:Body>
+<ns2:methodResponse xmlns:ns2="http://jbossws/">
+<return>1234567890</return>
+</ns2:methodResponse>
+</soap:Body>
+ */
+
+ @Override
+ protected String getWsPackage() {
+ return "jbossws." + getLevel().toString().toLowerCase();
+ }
+
+ @Override
+ protected String getWsName() {
+ return "JavaWs_" + getLevel();
+ }
+
+ protected String getWsProjectName() {
+ return "BottomUpWS-web";
+ }
+
+ @Override
+ protected String getEarProjectName() {
+ return "BottomUpWS-ear";
+ }
+
+ @Test
+ public void testDevelopService() {
+ setLevel(Slider_Level.DEVELOP);
+ bottomUpJbossWebService();
+ }
+
+ @Test
+ public void testAssembleService() {
+ setLevel(Slider_Level.ASSEMBLE);
+ bottomUpJbossWebService();
+ }
+
+ @Test
+ public void testDeployService() {
+ setLevel(Slider_Level.DEPLOY);
+ bottomUpJbossWebService();
+ }
+
+ @Test
+ public void testInstallService() {
+ setLevel(Slider_Level.INSTALL);
+ bottomUpJbossWebService();
+ }
+
+ @Test
+ public void testStartService() {
+ setLevel(Slider_Level.START);
+ bottomUpJbossWebService();
+ }
+
+ @Test
+ public void testTestService() {
+ setLevel(Slider_Level.TEST);
+ bottomUpJbossWebService();
+ }
+
+ private void bottomUpJbossWebService() {
+ String s = readStream(BottomUpWSTest.class.getResourceAsStream("/resources/jbossws/ClassA.java.ws"));
+ String src = MessageFormat.format(s, getWsPackage(), getWsName());
+ createService(Service_Type.BOTTOM_UP, getWsPackage() + "." + getWsName(), getLevel(), src);
+// runProject(getProjectName());
+ switch (getLevel()) {
+ case DEVELOP:
+ return;
+ case ASSEMBLE:
+ case DEPLOY:
+ runProject(getEarProjectName());
+ break;
+ }
+ assertServiceDeployed(getWSDLUrl());
+// checkService(getWSDLUrl(svcName.substring(svcName.lastIndexOf(".") + 1)), QName service, QName port, String msg, String rsp)
+// servers.removeAllProjectsFromServer(configuredState.getServer().name);
+ }
+
+}
Copied: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/wtp/TopDownWSTest.java (from rev 26699, trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/TopDownWebService.java)
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/wtp/TopDownWSTest.java (rev 0)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/wtp/TopDownWSTest.java 2010-11-19 14:40:46 UTC (rev 26768)
@@ -0,0 +1,110 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.ws.ui.bot.test.wtp;
+
+import java.text.MessageFormat;
+
+import org.jboss.tools.ui.bot.ext.config.Annotations.SWTBotTestRequires;
+import org.jboss.tools.ui.bot.ext.config.Annotations.Server;
+import org.jboss.tools.ws.ui.bot.test.uiutils.wizards.WebServiceWizard.Service_Type;
+import org.jboss.tools.ws.ui.bot.test.uiutils.wizards.WebServiceWizard.Slider_Level;
+import org.junit.Test;
+
+@SWTBotTestRequires(server=@Server(),perspective="Java EE")
+public class TopDownWSTest extends WSTestBase {
+
+ @Override
+ protected String getEarProjectName() {
+ return "TopDownWS-ear";
+ }
+
+ @Override
+ protected String getWsPackage() {
+ return "jbossws.td." + getLevel().toString().toLowerCase();
+ }
+
+ @Override
+ protected String getWsName() {
+ return "WsdlWs" + getLevel();
+ }
+
+ @Override
+ protected String getWsProjectName() {
+ return "TopDownWS-web";
+ }
+
+ //http://localhost:8080/TopDownJbossWS/jbossws.ClassB?wsdl
+ /*
+<soap:Body>
+<method xmlns = "http://jbossws/">
+</method>
+</soap:Body>
+
+<soap:Body>
+<ns2:methodResponse xmlns:ns2="http://jbossws/">
+<return>0</return>
+</ns2:methodResponse>
+</soap:Body>
+ */
+
+ @Test
+ public void testDevelopService() {
+ setLevel(Slider_Level.DEVELOP);
+ topDownWS();
+ }
+
+ @Test
+ public void testAssembleService() {
+ setLevel(Slider_Level.ASSEMBLE);
+ topDownWS();
+ }
+
+ @Test
+ public void testDeployService() {
+ setLevel(Slider_Level.DEPLOY);
+ topDownWS();
+ }
+
+ @Test
+ public void testInstallService() {
+ setLevel(Slider_Level.INSTALL);
+ topDownWS();
+ }
+
+ @Test
+ public void testStartService() {
+ setLevel(Slider_Level.START);
+ topDownWS();
+ }
+
+ @Test
+ public void testTestService() {
+ setLevel(Slider_Level.TEST);
+ topDownWS();
+ }
+
+ private void topDownWS() {
+ String s = readStream(TopDownWSTest.class.getResourceAsStream("/resources/jbossws/ClassB.wsdl"));
+ String[] tns = getWsPackage().split("\\.");
+ StringBuilder sb = new StringBuilder();
+ for (int i = tns.length - 1; i > 0; i--) {
+ sb.append(tns[i]);
+ sb.append(".");
+ }
+ sb.append(tns[0]);
+ String src = MessageFormat.format(s, sb.toString(), getWsName());
+ createService(Service_Type.TOP_DOWN, "/" + getWsProjectName() + "/src/" + getWsName() + ".wsdl", getLevel(), src);
+// runProject(getProjectName());
+ assertServiceDeployed(getWSDLUrl());
+// servers.removeAllProjectsFromServer(configuredState.getServer().name);
+ }
+
+}
Copied: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/wtp/WSTestBase.java (from rev 26699, trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/JbossWSTest.java)
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/wtp/WSTestBase.java (rev 0)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/wtp/WSTestBase.java 2010-11-19 14:40:46 UTC (rev 26768)
@@ -0,0 +1,361 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.ws.ui.bot.test.wtp;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.io.StringWriter;
+import java.io.Writer;
+import java.net.HttpURLConnection;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.text.MessageFormat;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEclipseEditor;
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
+import org.eclipse.swtbot.swt.finder.SWTBot;
+import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotCombo;
+import org.jboss.tools.ui.bot.ext.SWTTestExt;
+import org.jboss.tools.ui.bot.ext.gen.ActionItem;
+import org.jboss.tools.ui.bot.ext.gen.ActionItem.NewObject.JavaEEEnterpriseApplicationProject;
+import org.jboss.tools.ui.bot.ext.gen.ActionItem.NewObject.WebServicesWSDL;
+import org.jboss.tools.ui.bot.ext.gen.ActionItem.NewObject.WebServicesWebServiceClient;
+import org.jboss.tools.ui.bot.ext.gen.ActionItem.NewObject.WebServlet;
+import org.jboss.tools.ui.bot.ext.parts.SWTBotHyperlinkExt;
+import org.jboss.tools.ui.bot.ext.parts.SWTBotScaleExt;
+import org.jboss.tools.ui.bot.ext.types.IDELabel;
+import org.jboss.tools.ws.ui.bot.test.uiutils.actions.NewFileWizardAction;
+import org.jboss.tools.ws.ui.bot.test.uiutils.wizards.DynamicWebProjectWizard;
+import org.jboss.tools.ws.ui.bot.test.uiutils.wizards.WebServiceWizard;
+import org.jboss.tools.ws.ui.bot.test.uiutils.wizards.WebServiceWizard.Service_Type;
+import org.jboss.tools.ws.ui.bot.test.uiutils.wizards.WebServiceWizard.Slider_Level;
+import org.jboss.tools.ws.ui.bot.test.uiutils.wizards.Wizard;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.runner.RunWith;
+
+(a)RunWith(SWTBotJunit4ClassRunner.class)
+public abstract class WSTestBase extends SWTTestExt {
+
+ public static final String EAR_PROJECT_NAME="EAR";
+
+ public static final String CLASS_C="ClassC";
+ public static final String BOTTOMUP_WS_CLIENT_PROJ_NAME = "BottomUpJbossWSClient";
+ public static final String BOTTOMUP_WS_CLIENT_SERVLET_NAME = "BottomUpJbossWStest";
+ public static final String BOTTOMUP_WS_CLIENT_SERVLET_URL = "http://localhost:8080/"+BOTTOMUP_WS_CLIENT_PROJ_NAME+"/"+BOTTOMUP_WS_CLIENT_SERVLET_NAME;
+ public static final String TWO_SERVICES_CLIENT_SERVLET_NAME="TwoServicesJbossWStest";
+ public static final String TWO_SERVICES_CLIENT_SERVLET_URL = "http://localhost:8080/"+BOTTOMUP_WS_CLIENT_PROJ_NAME+"/"+TWO_SERVICES_CLIENT_SERVLET_NAME;
+ public static final String TOPDOWN_WS_CLIENT_PROJ_NAME = "TopDownJbossWSClient";
+ public static final String TOPDOWN_WS_CLIENT_SERVLET_NAME = "TopDownJbossWStest";
+ public static final String TOPDOWN_WS_CLIENT_SERVLET_URL = "http://localhost:8080/"+TOPDOWN_WS_CLIENT_PROJ_NAME+"/"+TOPDOWN_WS_CLIENT_SERVLET_NAME;
+ public static final String JBOSSWS_CRED_LOGIN="admin";
+ public static final String JBOSSWS_CRED_PASS="admin";
+ public static final int CLIENT_SCALE_START=1;
+
+ private static final String SOAP_REQUEST_TEMPLATE = "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\" ?>" +
+ "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"" +
+ " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"" +
+ " xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">" +
+ "<soap:Body>{0}</soap:Body>" +
+ "</soap:Envelope>";
+
+ private static final Logger L = Logger.getLogger(WSTestBase.class.getName());
+ private Slider_Level level;
+
+ @Before
+ public void setup() {
+ if (getEarProjectName() != null && !projectExists(getEarProjectName())) {
+ createEARProject(getEarProjectName());
+ }
+ if (!projectExists(getWsProjectName())) {
+ createProject(getWsProjectName());
+ }
+ }
+
+ private boolean projectExists(String name) {
+ return projectExplorer.existsResource(name);
+ }
+
+ @After
+ public void cleanup() {
+ servers.removeAllProjectsFromServer();
+ }
+
+ @AfterClass
+ public static void cleanAll() {
+ projectExplorer.deleteAllProjects();
+ }
+
+ protected abstract String getWsProjectName();
+
+ protected String getEarProjectName() {
+ return null;
+ }
+
+ protected abstract String getWsPackage();
+ protected abstract String getWsName();
+
+ protected void setLevel(Slider_Level level) {
+ this.level = level;
+ }
+
+ protected Slider_Level getLevel() {
+ return level;
+ }
+
+ protected String getWSDLUrl() {
+ return "http://localhost:8080/" + getWsProjectName() + "/" + getWsName() + "?wsdl";
+ }
+
+ protected void createClient(String projectName, String servletName,String wsdlDef, int type) {
+ createProject(projectName);
+ SWTBot wiz = open.newObject(WebServicesWebServiceClient.LABEL);
+ wiz.comboBoxWithLabel(
+ WebServicesWebServiceClient.TEXT_SERVICE_DEFINITION).setText(
+ wsdlDef);
+ SWTBotScaleExt slider = bot.scale();
+ slider.setSelection(type);
+ selectJbossWSRuntime();
+ bot.sleep(TIME_1S); // wait for wizard to validate wsdl url and
+ // enable Finish button
+ open.finish(wiz);
+ projectExplorer.selectProject(projectName);
+ // create servlet which will invoke service
+ createInvokingServlet(servletName);
+ }
+
+ /**
+ * checks if 'Web Service Runtime' is set to 'JbossWS' and possibly sets it correctly
+ * @param wiz wizard page of new Web Service
+ */
+ @Deprecated
+ protected void selectJbossWSRuntime() {
+ SWTBotHyperlinkExt link = bot.hyperlink(1);
+ String linkText = link.getText();
+ if (!linkText.contains("JBossWS")) {
+ link.click();
+ SWTBot dBot = bot.activeShell().bot();
+ dBot.tree().select("JBossWS");
+ open.finish(dBot,IDELabel.Button.OK);
+ }
+ }
+
+ protected void createService(Service_Type t, String source, Slider_Level level, String code) {
+ //create ws source - java class or wsdl
+ SWTBotEditor ed = null;
+ switch (t) {
+ case BOTTOM_UP:
+ ed = createClass(getWsPackage(), getWsName());
+ break;
+ case TOP_DOWN:
+ ed = createWsdl(getWsName());
+ break;
+ }
+ assertNotNull(ed);
+ //replace default content of java class w/ code
+ SWTBotEclipseEditor st = ed.toTextEditor();
+ st.selectRange(0, 0, st.getText().length());
+ st.setText(code);
+ ed.saveAndClose();
+ //create a web service
+ new NewFileWizardAction().run().selectTemplate("Web Services", "Web Service").next();
+ WebServiceWizard wsw = new WebServiceWizard();
+ wsw.setServiceType(t);
+ wsw.setServiceSource(source);
+ wsw.setServerRuntime(configuredState.getServer().name);
+ wsw.setWebServiceRuntime("JBossWS");
+ wsw.setServiceProject(getWsProjectName());
+ wsw.setServiceEARProject(getEarProjectName());
+ wsw.setServiceSlider(level);
+ if (wsw.isClientEnabled()) {
+ wsw.setClientSlider(Slider_Level.NO_CLIENT);
+ }
+ wsw.finish();
+ util.waitForNonIgnoredJobs();
+ bot.sleep(1000);
+ }
+
+ private SWTBotEditor createClass(String pkg, String cName) {
+ new NewFileWizardAction().run().selectTemplate("Class").next();
+ Wizard w = new Wizard();
+ w.bot().textWithLabel("Package:").setText(pkg);
+ w.bot().textWithLabel("Name:").setText(cName);
+ w.bot().textWithLabel("Source folder:").setText(getWsProjectName() + "/src");
+ w.finish();
+ return bot.editorByTitle(cName + ".java");
+ }
+
+ private SWTBotEditor createWsdl(String s) {
+ SWTBot wiz1 = open.newObject(WebServicesWSDL.LABEL);
+ wiz1.textWithLabel(WebServicesWSDL.TEXT_FILE_NAME).setText(s + ".wsdl");
+ wiz1.textWithLabel(WebServicesWSDL.TEXT_ENTER_OR_SELECT_THE_PARENT_FOLDER)
+ .setText(getWsProjectName() + "/src");
+ wiz1.button(IDELabel.Button.NEXT).click();
+ open.finish(wiz1);
+ return bot.editorByTitle(s + ".wsdl");
+ }
+
+ protected void createInvokingServlet(String servletName) {
+ String PKG_NAME="jbossws";
+ SWTBot wiz = open.newObject(WebServlet.LABEL);
+ wiz.textWithLabel(WebServlet.TEXT_JAVA_PACKAGE).setText(
+ PKG_NAME);
+ wiz.textWithLabel(WebServlet.TEXT_CLASS_NAME).setText(
+ servletName);
+ open.finish(wiz);
+ eclipse.setClassContentFromResource(bot
+ .editorByTitle(servletName
+ + ".java"), true,
+ org.jboss.tools.ws.ui.bot.test.Activator.PLUGIN_ID,
+ PKG_NAME, servletName
+ + ".java.servlet");
+ }
+
+ protected void createProject(String name) {
+ new NewFileWizardAction().run().selectTemplate("Web", "Dynamic Web Project").next();
+ new DynamicWebProjectWizard().setProjectName(name).finish();
+ util.waitForNonIgnoredJobs();
+ assertTrue(projectExplorer.existsResource(name));
+ projectExplorer.selectProject(name);
+ }
+
+ protected void createEARProject(String name) {
+ SWTBot wiz = open.newObject(JavaEEEnterpriseApplicationProject.LABEL);
+ wiz.textWithLabel(JavaEEEnterpriseApplicationProject.TEXT_PROJECT_NAME).setText(name);
+ // set EAR version
+ SWTBotCombo combo = wiz.comboBox(1);
+ combo.setSelection(combo.itemCount()-1);
+ wiz.button(IDELabel.Button.NEXT).click();
+ wiz.checkBox("Generate application.xml deployment descriptor").click();
+ open.finish(wiz);
+ bot.sleep(5000);
+ assertTrue(projectExplorer.existsResource(name));
+ projectExplorer.selectProject(name);
+ }
+
+ protected void assertServiceDeployed(String wsdlURL) {
+ HttpURLConnection connection = null;
+ try {
+ URL u = new URL(wsdlURL);
+ connection = (HttpURLConnection) u.openConnection();
+ assertEquals("Service was not sucessfully deployed, WSDL '" + wsdlURL + "' was not found",
+ HttpURLConnection.HTTP_OK, connection.getResponseCode());
+ } catch (MalformedURLException e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } finally {
+ if (connection != null) {
+ connection.disconnect();
+ }
+ }
+ }
+
+ protected void assertServiceNotDeployed(String wsdlURL) {
+ HttpURLConnection connection = null;
+ try {
+ URL u = new URL(wsdlURL);
+ connection = (HttpURLConnection) u.openConnection();
+ assertEquals("Project was not sucessfully undeployed, WSDL '" + wsdlURL + "' is still available",
+ HttpURLConnection.HTTP_NOT_FOUND, connection.getResponseCode());
+ } catch (MalformedURLException e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } finally {
+ if (connection != null) {
+ connection.disconnect();
+ }
+ }
+ }
+
+ protected void assertServiceResponseToClient(String startServlet, String response) {
+ InputStream is = null;
+ try {
+ URL u = new URL(startServlet);
+ is = u.openStream();
+ String rsp = readStream(is);
+ assertContains(response, rsp);
+ } catch (MalformedURLException e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } finally {
+ if (is != null) {
+ try {
+ is.close();
+ } catch (IOException e) {
+ //ignore
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+
+ public static String getSoapRequest(String body) {
+ return MessageFormat.format(SOAP_REQUEST_TEMPLATE, body);
+ }
+
+ protected String readStream(InputStream is) {
+ Reader r = null;
+ Writer w = null;
+ try {
+ char[] buffer = new char[1024];
+ r = new BufferedReader(new InputStreamReader(is, "UTF-8"));
+ w = new StringWriter();
+ int n;
+ while ((n = r.read(buffer)) != -1) {
+ w.write(buffer, 0, n);
+ }
+ } catch (IOException e) {
+ L.log(Level.WARNING, e.getMessage(), e);
+ } finally {
+ if (r != null) {
+ try {
+ r.close();
+ } catch (IOException e) {
+ //ignore
+ L.log(Level.WARNING, e.getMessage(), e);
+ }
+ }
+ if (w != null) {
+ try {
+ w.close();
+ } catch (IOException e) {
+ //ignore
+ L.log(Level.WARNING, e.getMessage(), e);
+ }
+ }
+ }
+ return w != null ? w.toString() : "";
+ }
+
+ protected void runProject(String project) {
+ open.viewOpen(ActionItem.View.ServerServers.LABEL);
+ projectExplorer.runOnServer(project);
+ bot.sleep(5000);
+ }
+
+
+}
15 years, 5 months
JBoss Tools SVN: r26767 - trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/icons.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2010-11-19 09:32:37 -0500 (Fri, 19 Nov 2010)
New Revision: 26767
Added:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/icons/system_view.gif
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/icons/system_viewd.gif
Log:
[JBIDE-7642] replace remote system explorer icon
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/icons/system_view.gif
===================================================================
(Binary files differ)
Property changes on: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/icons/system_view.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/icons/system_viewd.gif
===================================================================
(Binary files differ)
Property changes on: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/icons/system_viewd.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
15 years, 5 months
JBoss Tools SVN: r26766 - trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2010-11-19 09:27:24 -0500 (Fri, 19 Nov 2010)
New Revision: 26766
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/DisconnectCloudHandler.java
Log:
[JBIDE-7534] added confirmation dialog in case you disconnect a single cloud
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/DisconnectCloudHandler.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/DisconnectCloudHandler.java 2010-11-19 13:56:17 UTC (rev 26765)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/DisconnectCloudHandler.java 2010-11-19 14:27:24 UTC (rev 26766)
@@ -23,6 +23,7 @@
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
@@ -95,7 +96,14 @@
if (selectedElements != null
&& selectedElements.size() == 1
&& deltaCloud != null) {
- removeDeltaCloud(deltaCloud);
+ // TODO internationalize strings
+ if (MessageDialog.openConfirm(
+ HandlerUtil.getActiveShell(event),
+ "Confirm disconnect",
+ MessageFormat.format("Are you sure that you want to disconnect cloud \"{0}\"?",
+ deltaCloud.getName()))) {
+ removeDeltaCloud(deltaCloud);
+ }
} else {
removeWithDialog(shell, selectedElements);
}
15 years, 5 months
JBoss Tools SVN: r26765 - in trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime: handlers and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2010-11-19 08:56:17 -0500 (Fri, 19 Nov 2010)
New Revision: 26765
Modified:
trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/JBossRuntimeLocator.java
trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/JBossRuntimeStartup.java
trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/ServerDefinition.java
trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/handlers/DroolsHandler.java
trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/handlers/JbpmHandler.java
trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/handlers/SeamHandler.java
trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/preferences/RuntimeDialog.java
trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/preferences/RuntimePreferencePage.java
Log:
JBIDE-7524 JBoss Tools Runtimes improvements
Modified: trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/JBossRuntimeLocator.java
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/JBossRuntimeLocator.java 2010-11-19 13:48:42 UTC (rev 26764)
+++ trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/JBossRuntimeLocator.java 2010-11-19 13:56:17 UTC (rev 26765)
@@ -60,10 +60,16 @@
if (!JBossServerType.UNKNOWN.equals(serverBean.getType())) {
serverDefinitions.add(new ServerDefinition(serverBean));
+ if (monitor.isCanceled()) {
+ return serverDefinitions;
+ }
} else {
String seamVersion = getSeamVersionFromManifest(root.getAbsolutePath());
if (seamVersion != null) {
serverDefinitions.add(new ServerDefinition(root.getName(), seamVersion, SEAM, root.getAbsoluteFile()));
+ if (monitor.isCanceled()) {
+ return serverDefinitions;
+ }
} else {
String[] files = root.list(new FilenameFilter() {
@@ -83,6 +89,9 @@
droolsFound = true;
}
}
+ if (monitor.isCanceled()) {
+ return serverDefinitions;
+ }
boolean jbpmFound = false;
if (!droolsFound) {
boolean isJBPM = isValidJbpmInstallation(root.getAbsolutePath());
@@ -97,6 +106,9 @@
jbpmFound = true;
}
}
+ if (monitor.isCanceled()) {
+ return serverDefinitions;
+ }
if (!droolsFound && !jbpmFound) {
children = root.listFiles();
}
@@ -106,6 +118,9 @@
} else {
children = File.listRoots();
}
+ if (monitor.isCanceled()) {
+ return serverDefinitions;
+ }
if (depth == 0) {
return serverDefinitions;
}
@@ -140,6 +155,25 @@
}
public static String getSeamVersionFromManifest(String seamHome) {
+ File seamHomeFolder = new File(seamHome);
+ if (seamHomeFolder == null || !seamHomeFolder.isDirectory()) {
+ return null;
+ }
+ String[] seamFiles = seamHomeFolder.list(new FilenameFilter() {
+
+ public boolean accept(File dir, String name) {
+ if ("seam-gen".equals(name)) {
+ return true;
+ }
+ if ("examples".equals(name)) {
+ return true;
+ }
+ return false;
+ }
+ });
+ if (seamFiles == null || seamFiles.length != 2) {
+ return null;
+ }
File jarFile = new File(seamHome, "lib/" + seamJarName);
if(!jarFile.isFile()) {
jarFile = new File(seamHome, seamJarName);
Modified: trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/JBossRuntimeStartup.java
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/JBossRuntimeStartup.java 2010-11-19 13:48:42 UTC (rev 26764)
+++ trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/JBossRuntimeStartup.java 2010-11-19 13:56:17 UTC (rev 26765)
@@ -44,6 +44,7 @@
public class JBossRuntimeStartup implements IStartup, IJBossRuntimePluginConstants {
+ private static IJBossRuntimePersistanceHandler[] jBossRuntimePersistanceHandler = null;
public static interface IJBossRuntimePersistanceHandler {
public void initializeRuntimes(List<ServerDefinition> serverDefinitions);
public void importRuntimes();
@@ -51,12 +52,15 @@
}
public static IJBossRuntimePersistanceHandler[] getPersistanceHandlers() {
- return new IJBossRuntimePersistanceHandler[] {
- new JbpmHandler(),
- new DroolsHandler(),
- new JBossASHandler(),
- new SeamHandler()
- };
+ if (jBossRuntimePersistanceHandler == null) {
+ jBossRuntimePersistanceHandler = new IJBossRuntimePersistanceHandler[] {
+ new JbpmHandler(),
+ new DroolsHandler(),
+ new JBossASHandler(),
+ new SeamHandler()
+ };
+ }
+ return jBossRuntimePersistanceHandler;
}
private List<ServerDefinition> serverDefinitions = new ArrayList<ServerDefinition>();
Modified: trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/ServerDefinition.java
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/ServerDefinition.java 2010-11-19 13:48:42 UTC (rev 26764)
+++ trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/ServerDefinition.java 2010-11-19 13:56:17 UTC (rev 26765)
@@ -13,7 +13,12 @@
import java.io.File;
import org.jboss.ide.eclipse.as.core.server.bean.ServerBean;
+import org.jboss.tools.runtime.handlers.DroolsHandler;
+import org.jboss.tools.runtime.handlers.JbpmHandler;
+import org.jboss.tools.runtime.handlers.SeamHandler;
+import static org.jboss.tools.runtime.IJBossRuntimePluginConstants.*;
+
/**
* @author Snjeza
*
@@ -23,6 +28,7 @@
private String name;
private String version;
private String type;
+ private String description;
private File location;
private boolean enabled = true;
@@ -33,6 +39,7 @@
this.version = version;
this.type = type;
this.location = location;
+ this.description = null;
}
/**
@@ -57,17 +64,23 @@
public void setVersion(String version) {
this.version = version;
}
+
public String getType() {
return type;
}
+
public void setType(String type) {
this.type = type;
+ this.description = "";
}
+
public File getLocation() {
return location;
}
+
public void setLocation(File location) {
this.location = location;
+ this.description = "";
}
@Override
@@ -127,5 +140,41 @@
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
+
+ public String getDescription() {
+ if (type == null || location == null) {
+ return "";
+ }
+ if (description == null || description.length() == 0) {
+ StringBuilder builder = new StringBuilder();
+ if (SOA_P.equals(type) || EAP.equals(type) || EPP.equals(type) || EWP.equals(type)) {
+ String includeSeam = SeamHandler.includeSeam(this);
+ append(builder, includeSeam);
+ }
+ if (SOA_P.equals(type)) {
+ String includeDrools = DroolsHandler.includeDrools(this);
+ append(builder, includeDrools);
+ String includeJbpm = JbpmHandler.includeJbpm(this);
+ append(builder, includeJbpm);
+ }
+ description = builder.toString();
+ }
+ return description;
+ }
+
+ private void append(StringBuilder builder, String string) {
+ if (string != null && string.length() > 0) {
+ if (builder.toString().length() == 0) {
+ builder.append("Includes ");
+ } else {
+ builder.append(", ");
+ }
+ builder.append(string);
+ }
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
}
Modified: trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/handlers/DroolsHandler.java
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/handlers/DroolsHandler.java 2010-11-19 13:48:42 UTC (rev 26764)
+++ trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/handlers/DroolsHandler.java 2010-11-19 13:56:17 UTC (rev 26765)
@@ -66,6 +66,18 @@
return false;
}
+ public static String includeDrools(ServerDefinition serverDefinition) {
+ StringBuilder builder = new StringBuilder();
+ File droolsRoot = serverDefinition.getLocation(); //$NON-NLS-1$
+ if (droolsRoot.isDirectory()) {
+ builder.append("Drools");
+ if (serverDefinition.getVersion() != null && serverDefinition.getVersion().length() > 0) {
+ builder.append(" ");
+ builder.append(serverDefinition.getVersion());
+ }
+ }
+ return builder.toString();
+ }
public void importRuntimes() {
// TODO Auto-generated method stub
Modified: trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/handlers/JbpmHandler.java
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/handlers/JbpmHandler.java 2010-11-19 13:48:42 UTC (rev 26764)
+++ trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/handlers/JbpmHandler.java 2010-11-19 13:56:17 UTC (rev 26765)
@@ -111,6 +111,19 @@
}
}
+ public static String includeJbpm(ServerDefinition serverDefinition) {
+ StringBuilder builder = new StringBuilder();
+ File jbpmRoot = new File(serverDefinition.getLocation(),"jbpm-jpdl"); //$NON-NLS-1$
+ if (jbpmRoot.isDirectory()) {
+ String version = JBossRuntimeLocator.JBPM3;
+ if (JBossRuntimeLocator.isJbpm4(serverDefinition.getLocation().getAbsolutePath())) {
+ version = JBossRuntimeLocator.JBPM4;
+ }
+ builder.append(version);
+ }
+ return builder.toString();
+ }
+
public void importRuntimes() {
String jbpms = Activator.getDefault().getPreferenceStore().getString(Activator.JBPMS);
if (jbpms != null && jbpms.trim().length() > 0) {
Modified: trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/handlers/SeamHandler.java
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/handlers/SeamHandler.java 2010-11-19 13:48:42 UTC (rev 26764)
+++ trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/handlers/SeamHandler.java 2010-11-19 13:56:17 UTC (rev 26765)
@@ -70,6 +70,7 @@
seamGenBuildPath = getSeamGenBuildPath(SEAM_2_0_HOME_CP, SEAM_2_0_HOME_CONFIGURATION_CP);
seamVersion = getSeamVersion(seamGenBuildPath);
addSeam2(map, seamGenBuildPath, seamVersion);
+ SeamRuntimeManager.getInstance().save();
}
private static void addSeam1(Map<String, SeamRuntime> map,
@@ -104,22 +105,6 @@
}
}
- private static SeamVersion getSeamVersion(String seamGenBuildPath) {
- if (seamGenBuildPath == null || seamGenBuildPath.trim().length() <= 0) {
- return null;
- }
- String fullVersion = SeamUtil.getSeamVersionFromManifest(seamGenBuildPath);
- if (fullVersion == null) {
- return null;
- }
- String version = fullVersion.substring(0,3);
- SeamVersion seamVersion = null;
- if (version != null) {
- seamVersion = SeamVersion.findByString(version);
- }
- return seamVersion;
- }
-
private static void addSeam(Map<String, SeamRuntime> map, String seamPath,SeamVersion seamVersion, String name) {
if (!seamExists(seamPath)) {
File seamFolder = new File(seamPath);
@@ -134,20 +119,6 @@
}
}
- /**
- * @param seamPath
- * @return
- */
- private static boolean seamExists(String seamPath) {
- SeamRuntime[] seamRuntimes = SeamRuntimeManager.getInstance().getRuntimes();
- for (SeamRuntime sr:seamRuntimes) {
- if (seamPath != null && seamPath.equals(sr.getHomeDir())) {
- return true;
- }
- }
- return false;
- }
-
private static String getSeamGenBuildPath(String seamHomePath,
String seamHomePathConfiguration) {
try {
@@ -184,4 +155,52 @@
}
+ public static String includeSeam(ServerDefinition serverDefinition) {
+ StringBuilder builder = new StringBuilder();
+ for (String folder : IJBossRuntimePluginConstants.SEAM_HOME_FOLDER_OPTIONS) {
+ File seamFile = new File(serverDefinition.getLocation(),folder); //$NON-NLS-1$
+ if (seamFile.exists() && seamFile.canRead() && seamFile.isDirectory()) {
+ SeamVersion seamVersion = getSeamVersion(seamFile.getAbsolutePath());
+ if (seamVersion != null) {
+ if (builder.toString().length() > 0) {
+ builder.append(", ");
+ }
+ builder.append("Seam ");
+ builder.append(seamVersion);
+ }
+ }
+ }
+ return builder.toString();
+ }
+
+ public static SeamVersion getSeamVersion(String seamGenBuildPath) {
+ if (seamGenBuildPath == null || seamGenBuildPath.trim().length() <= 0) {
+ return null;
+ }
+ String fullVersion = SeamUtil.getSeamVersionFromManifest(seamGenBuildPath);
+ if (fullVersion == null) {
+ return null;
+ }
+ String version = fullVersion.substring(0,3);
+ SeamVersion seamVersion = null;
+ if (version != null) {
+ seamVersion = SeamVersion.findByString(version);
+ }
+ return seamVersion;
+ }
+
+ /**
+ * @param seamPath
+ * @return
+ */
+ public static boolean seamExists(String seamPath) {
+ SeamRuntime[] seamRuntimes = SeamRuntimeManager.getInstance().getRuntimes();
+ for (SeamRuntime sr:seamRuntimes) {
+ if (seamPath != null && seamPath.equals(sr.getHomeDir())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
}
Modified: trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/preferences/RuntimeDialog.java
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/preferences/RuntimeDialog.java 2010-11-19 13:48:42 UTC (rev 26764)
+++ trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/preferences/RuntimeDialog.java 2010-11-19 13:56:17 UTC (rev 26765)
@@ -45,7 +45,7 @@
Composite contents = new Composite(area, SWT.NONE);
GridData gd = new GridData(GridData.FILL_BOTH);
gd.heightHint = 400;
- gd.widthHint = 500;
+ gd.widthHint = 700;
contents.setLayoutData(gd);
contents.setLayout(new GridLayout());
getShell().setText("JBoss Runtimes");
@@ -64,8 +64,8 @@
table.setHeaderVisible(true);
table.setLinesVisible(true);
- String[] columnNames = new String[] { "Name", "Version", "Type", "Location"};
- int[] columnWidths = new int[] { 140, 50, 50, 245};
+ String[] columnNames = new String[] { "Name", "Version", "Type", "Location", "Description"};
+ int[] columnWidths = new int[] { 140, 50, 50, 245, 200};
for (int i = 0; i < columnNames.length; i++) {
TableColumn tc = new TableColumn(table, SWT.LEFT);
@@ -121,6 +121,9 @@
return definition.getLocation().getAbsolutePath();
}
}
+ if (columnIndex == 4) {
+ return definition.getDescription();
+ }
}
return null;
}
Modified: trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/preferences/RuntimePreferencePage.java
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/preferences/RuntimePreferencePage.java 2010-11-19 13:48:42 UTC (rev 26764)
+++ trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/preferences/RuntimePreferencePage.java 2010-11-19 13:56:17 UTC (rev 26765)
@@ -10,16 +10,12 @@
************************************************************************************/
package org.jboss.tools.runtime.preferences;
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.InputStream;
import java.lang.reflect.InvocationTargetException;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -30,6 +26,7 @@
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
import org.eclipse.jface.layout.PixelConverter;
import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.preference.PreferenceDialog;
import org.eclipse.jface.preference.PreferencePage;
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jface.viewers.StructuredSelection;
@@ -47,23 +44,18 @@
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Link;
+import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.dialogs.PreferencesUtil;
import org.eclipse.ui.internal.wizards.preferences.PreferencesExportWizard;
import org.eclipse.ui.internal.wizards.preferences.PreferencesImportWizard;
-import org.eclipse.wst.server.core.IServerWorkingCopy;
-import org.eclipse.wst.server.core.internal.IMemento;
-import org.eclipse.wst.server.core.internal.Server;
-import org.eclipse.wst.server.core.internal.ServerPlugin;
-import org.eclipse.wst.server.core.internal.XMLMemento;
import org.jboss.tools.runtime.Activator;
import org.jboss.tools.runtime.JBossRuntimeLocator;
import org.jboss.tools.runtime.JBossRuntimeStartup;
-import org.jboss.tools.runtime.ServerDefinition;
import org.jboss.tools.runtime.JBossRuntimeStartup.IJBossRuntimePersistanceHandler;
-import org.jboss.tools.runtime.handlers.JbpmHandler;
+import org.jboss.tools.runtime.ServerDefinition;
/**
* @author Snjeza
@@ -72,6 +64,7 @@
public class RuntimePreferencePage extends PreferencePage implements
IWorkbenchPreferencePage {
+ public static String ID = "org.jboss.tools.runtime.preferences.RuntimePreferencePage";
private static final String LASTPATH = "lastPath";
public static final String SEAM_PREFERENCES_ID = "org.jboss.tools.common.model.ui.seam"; //$NON-NLS-1$
public static final String WTP_PREFERENCES_ID = "org.eclipse.wst.server.ui.runtime.preferencePage"; //$NON-NLS-1$
@@ -99,10 +92,10 @@
composite.setLayout(layout);
- createLink(composite, "See <a>WTP Runtime</a>", WTP_PREFERENCES_ID);
- createLink(composite, "See <a>Seam Runtime</a>", SEAM_PREFERENCES_ID);
- createLink(composite, "See <a>Drools Runtime</a>", DROOLS_PREFERENCES_ID);
- createLink(composite, "See <a>JBPM Runtime</a>", JBPM_PREFERENCES_ID);
+ createLink(composite, "See <a>WTP Runtimes</a>", WTP_PREFERENCES_ID);
+ createLink(composite, "See <a>Seam Runtimes</a>", SEAM_PREFERENCES_ID);
+ createLink(composite, "See <a>Drools Runtimes</a>", DROOLS_PREFERENCES_ID);
+ createLink(composite, "See <a>JBPM Runtimes</a>", JBPM_PREFERENCES_ID);
new Label(composite, SWT.NONE);
@@ -159,9 +152,6 @@
dialog.create();
dialog.open();
}
-
- private void exportServers() {
- }
private void importRuntimes() {
PreferencesImportWizard wizard = new PreferencesImportWizard();
@@ -174,6 +164,7 @@
for( int i = 0; i < importHandlers.length; i++ ) {
importHandlers[i].importRuntimes();
}
+ refreshPreferencePage();
}
}
@@ -265,10 +256,18 @@
}
JBossRuntimeStartup runtimeStartup = new JBossRuntimeStartup();
runtimeStartup.initializeRuntimes(serverDefinitions);
+ refreshPreferencePage();
}
}
}
+
+ private void refreshPreferencePage() {
+ getShell().close();
+ Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
+ PreferenceDialog preferenceDialog = PreferencesUtil.createPreferenceDialogOn(shell, ID, null, null);
+ preferenceDialog.open();
+ }
/**
* Returns a width hint for a button control.
15 years, 5 months
JBoss Tools SVN: r26764 - in trunk/documentation/whatsnew/vpe: images/3.2.0.Beta2 and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: mareshkau
Date: 2010-11-19 08:48:42 -0500 (Fri, 19 Nov 2010)
New Revision: 26764
Modified:
trunk/documentation/whatsnew/vpe/images/3.2.0.Beta2/rich-faces4-preview.png
trunk/documentation/whatsnew/vpe/images/3.2.0.Beta2/vpe-icons-moving.png
trunk/documentation/whatsnew/vpe/vpe-news-3.2.0.Beta2.html
Log:
right props has been added to html and images files, https://jira.jboss.org/browse/JBIDE-7657
Property changes on: trunk/documentation/whatsnew/vpe/images/3.2.0.Beta2/rich-faces4-preview.png
___________________________________________________________________
Name: svn:mime-type
- application/octet-stream
+ image/png
Property changes on: trunk/documentation/whatsnew/vpe/images/3.2.0.Beta2/vpe-icons-moving.png
___________________________________________________________________
Name: svn:mime-type
- application/octet-stream
+ image/png
Property changes on: trunk/documentation/whatsnew/vpe/vpe-news-3.2.0.Beta2.html
___________________________________________________________________
Name: svn:mime-type
- text/plain
+ text/html
15 years, 5 months
JBoss Tools SVN: r26763 - in trunk/documentation/whatsnew/vpe: images and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: mareshkau
Date: 2010-11-19 08:41:16 -0500 (Fri, 19 Nov 2010)
New Revision: 26763
Added:
trunk/documentation/whatsnew/vpe/images/3.2.0.Beta2/
trunk/documentation/whatsnew/vpe/images/3.2.0.Beta2/rich-faces4-preview.png
trunk/documentation/whatsnew/vpe/images/3.2.0.Beta2/vpe-icons-moving.png
trunk/documentation/whatsnew/vpe/vpe-news-3.2.0.Beta2.html
Log:
https://jira.jboss.org/browse/JBIDE-7657
Added: trunk/documentation/whatsnew/vpe/images/3.2.0.Beta2/rich-faces4-preview.png
===================================================================
(Binary files differ)
Property changes on: trunk/documentation/whatsnew/vpe/images/3.2.0.Beta2/rich-faces4-preview.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/documentation/whatsnew/vpe/images/3.2.0.Beta2/vpe-icons-moving.png
===================================================================
(Binary files differ)
Property changes on: trunk/documentation/whatsnew/vpe/images/3.2.0.Beta2/vpe-icons-moving.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/documentation/whatsnew/vpe/vpe-news-3.2.0.Beta2.html
===================================================================
--- trunk/documentation/whatsnew/vpe/vpe-news-3.2.0.Beta2.html (rev 0)
+++ trunk/documentation/whatsnew/vpe/vpe-news-3.2.0.Beta2.html 2010-11-19 13:41:16 UTC (rev 26763)
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Language" content="en-us" />
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+<link rel="stylesheet" href="../whatsnew.css" />
+<title>What's New Visual Page Editor 3.2.0.Beta1</title>
+</head>
+<body>
+<h1>What's New Visual Page Editor 3.2.0.Beta2</h1>
+
+<p align="right">
+<a href="../index.html">< Main Index</a>
+<a href="../cdi/cdi-news-3.2.0.Beta1.html">CDI Tools ></a>
+</p>
+<table border="0" cellpadding="10" cellspacing="0" width="80%">
+ <tr>
+ <td colspan="2">
+ <hr />
+ <h3>General</h3>
+ <hr />
+ </td>
+ </tr>
+
+ <tr>
+ <td valign="top" align="left"><b>Visual Editor Icons Positioning</b></td>
+ <td valign="top">Possibility of selection where to show visual editor icons has been added.
+ It's possible show icons on main eclipse toolbar(default) or on visual editor toolbar(old style).
+ <p><img src="images/3.2.0.Beta2/vpe-icons-moving.png" alt="icons moving" />
+ </p>
+ <p><small>
+ <a href="https://jira.jboss.org/browse/JBIDE-7383">Related Jira</a>
+ </small></p>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2">
+ <hr />
+ <h3>Templates</h3>
+ <hr />
+ </td>
+ </tr>
+ <tr>
+ <td valign="top" align="left"><b>RichFaces 4.0 Templates</b></td>
+ <td valign="top"><p>Rich Faces 4.0 M3 elements are rendered in visual preview.</p>
+ <p><img src="images/3.2.0.Beta2/rich-faces4-preview.png" alt="icons moving" />
+ </p>
+ <p><small>
+ <a href="https://jira.jboss.org/browse/JBIDE-7434">Related Jira</a>
+ </small></p>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2">
+ <hr />
+ </td>
+ </tr>
+
+</table>
+</body>
+</html>
Property changes on: trunk/documentation/whatsnew/vpe/vpe-news-3.2.0.Beta2.html
___________________________________________________________________
Name: svn:mime-type
+ text/plain
15 years, 5 months
JBoss Tools SVN: r26762 - in trunk/documentation/whatsnew/seam: images and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2010-11-19 08:10:58 -0500 (Fri, 19 Nov 2010)
New Revision: 26762
Added:
trunk/documentation/whatsnew/seam/images/3.2.0.Beta2/
trunk/documentation/whatsnew/seam/images/3.2.0.Beta2/NewSeamRuntime.png
trunk/documentation/whatsnew/seam/images/3.2.0.Beta2/RuntimeQuickFix.png
trunk/documentation/whatsnew/seam/images/3.2.0.Beta2/SetterQuickFix.png
trunk/documentation/whatsnew/seam/images/3.2.0.Beta2/Validation.png
trunk/documentation/whatsnew/seam/seam-news-3.2.0.Beta2.html
Log:
https://jira.jboss.org/browse/JBIDE-7656 Added Seam N&N for Beta2.
Added: trunk/documentation/whatsnew/seam/images/3.2.0.Beta2/NewSeamRuntime.png
===================================================================
(Binary files differ)
Property changes on: trunk/documentation/whatsnew/seam/images/3.2.0.Beta2/NewSeamRuntime.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/documentation/whatsnew/seam/images/3.2.0.Beta2/RuntimeQuickFix.png
===================================================================
(Binary files differ)
Property changes on: trunk/documentation/whatsnew/seam/images/3.2.0.Beta2/RuntimeQuickFix.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/documentation/whatsnew/seam/images/3.2.0.Beta2/SetterQuickFix.png
===================================================================
(Binary files differ)
Property changes on: trunk/documentation/whatsnew/seam/images/3.2.0.Beta2/SetterQuickFix.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/documentation/whatsnew/seam/images/3.2.0.Beta2/Validation.png
===================================================================
(Binary files differ)
Property changes on: trunk/documentation/whatsnew/seam/images/3.2.0.Beta2/Validation.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/documentation/whatsnew/seam/seam-news-3.2.0.Beta2.html
===================================================================
--- trunk/documentation/whatsnew/seam/seam-news-3.2.0.Beta2.html (rev 0)
+++ trunk/documentation/whatsnew/seam/seam-news-3.2.0.Beta2.html 2010-11-19 13:10:58 UTC (rev 26762)
@@ -0,0 +1,107 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Language" content="en-us" />
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+<link rel="stylesheet" href="../whatsnew.css" />
+<title>Seam tools 3.2.0.Beta2 What's New</title>
+</head>
+<body>
+<h1>Seam tools 3.2.0.Beta2 What's New</h1>
+
+<p align="right"><a href="../index.html">< Main Index</a> <a
+ href="../bpel/bpel-news-1.1.0.beta2.html">BPEL Tools ></a></p>
+
+<table border="0" cellpadding="10" cellspacing="0" width="80%">
+<tr>
+ <td colspan="2">
+ <hr />
+ <h3>Quick Fixes</h3>
+ <hr />
+ </td>
+ </tr>
+ <tr>
+ <td valign="top" align="left">
+ <p><b>Missing setter method for the property</b></p>
+ </td>
+ <td valign="top">
+ <p>If the setter method for a property defined in components.xml is missing then this setter can be created via Quick Fix menu:</p>
+ <img src="images/3.2.0.Beta2/SetterQuickFix.png"/>
+ <p><small><a
+ href="https://jira.jboss.org/browse/JBIDE-6872">Related Jira</a></small></p>
+ </td>
+ </tr>
+
+ <tr>
+ <td colspan="2">
+ <hr />
+ </td>
+ </tr>
+
+ <tr>
+ <td valign="top" align="left">
+ <p><b>Missing Seam runtime</b></p>
+ </td>
+ <td valign="top">
+ <p>Two quick fixes are available now for missing Seam runtimes:<br/>
+ 1. Rename the Seam runtime via Seam Settings Page<br/>
+ 2. Add missing runtime</p>
+ <img src="images/3.2.0.Beta2/RuntimeQuickFix.png"/><br/><br/>
+ <img src="images/3.2.0.Beta2/NewSeamRuntime.png"/>
+ <p><small><a
+ href="https://jira.jboss.org/browse/JBIDE-5134">Related Jira</a></small></p>
+ </td>
+ </tr>
+
+ <tr>
+ <td colspan="2">
+ <hr />
+ <h3>Validation</h3>
+ <hr />
+ </td>
+ </tr>
+ <tr>
+ <td valign="top" align="left">
+ <p><b>view-id validation in pages.xml</b></p>
+ </td>
+ <td valign="top">
+ <p>"view-id" validation has been improved. The following attributes are now validated:<br/>
+ - <pages no-conversation-view-id="" login-view-id=""><br/>
+ - <page view-id="" no-conversation-view-id=""><br/>
+ - <render view-id=""><br/></p>
+ <img src="images/3.2.0.Beta2/Validation.png"/>
+ <p><small><a
+ href="https://jira.jboss.org/browse/JBIDE-7245">Related Jira</a></small></p>
+ </td>
+ </tr>
+
+ <tr>
+ <td colspan="2">
+ <hr />
+ </td>
+ </tr>
+
+ <tr>
+ <td valign="top" align="left">
+ <p><b>@Import annotations</b></p>
+ </td>
+ <td valign="top">
+ <p>Seam validator will take into accaunt @Import annotations to resolve context variable names for bijections.</p>
+ <p><small><a
+ href="https://jira.jboss.org/browse/JBIDE-7616">Related Jira</a></small></p>
+ </td>
+ </tr>
+
+ <tr>
+ <td colspan="2">
+ <hr />
+ </td>
+ </tr>
+
+</table>
+
+</body>
+
+</html>
\ No newline at end of file
Property changes on: trunk/documentation/whatsnew/seam/seam-news-3.2.0.Beta2.html
___________________________________________________________________
Name: svn:mime-type
+ text/plain
15 years, 5 months
JBoss Tools SVN: r26761 - trunk/tests/plugins/org.jboss.tools.tests/src/org/jboss/tools/test/util.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2010-11-19 08:10:26 -0500 (Fri, 19 Nov 2010)
New Revision: 26761
Modified:
trunk/tests/plugins/org.jboss.tools.tests/src/org/jboss/tools/test/util/ResourcesUtils.java
Log:
JBIDE-7576
testSeamELContentAssistJbide1676 failure
An additional check is added to prevent NullPointerException appearing within test setUp() method.
Modified: trunk/tests/plugins/org.jboss.tools.tests/src/org/jboss/tools/test/util/ResourcesUtils.java
===================================================================
--- trunk/tests/plugins/org.jboss.tools.tests/src/org/jboss/tools/test/util/ResourcesUtils.java 2010-11-19 13:07:12 UTC (rev 26760)
+++ trunk/tests/plugins/org.jboss.tools.tests/src/org/jboss/tools/test/util/ResourcesUtils.java 2010-11-19 13:10:26 UTC (rev 26761)
@@ -19,7 +19,6 @@
import java.lang.reflect.InvocationTargetException;
import java.text.MessageFormat;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.List;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
@@ -40,7 +39,6 @@
import org.eclipse.core.runtime.Platform;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.dialogs.IOverwriteQuery;
-import org.eclipse.ui.wizards.datatransfer.FileSystemStructureProvider;
import org.eclipse.ui.wizards.datatransfer.ImportOperation;
import org.eclipse.ui.wizards.datatransfer.ZipFileStructureProvider;
import org.jboss.tools.tests.ImportProvider;
@@ -189,13 +187,17 @@
*/
public static IProject importProject(String bundleName, String templatePath,
IProgressMonitor monitor) throws IOException, CoreException, InvocationTargetException, InterruptedException {
- // TODO Auto-generated method stub
- return importProject(Platform.getBundle(bundleName), templatePath, monitor==null?new NullProgressMonitor():monitor);
+ Bundle bundle = Platform.getBundle(bundleName);
+ if (bundle == null)
+ return null;
+ return importProject(bundle, templatePath, monitor==null?new NullProgressMonitor():monitor);
}
public static IProject importProject(String bundleName, String templatePath) throws IOException, CoreException, InvocationTargetException, InterruptedException {
- // TODO Auto-generated method stub
- return importProject(Platform.getBundle(bundleName), templatePath, null);
+ Bundle bundle = Platform.getBundle(bundleName);
+ if (bundle == null)
+ return null;
+ return importProject(bundle, templatePath, null);
}
public static void deleteProject(String projectName) throws CoreException {
15 years, 5 months
JBoss Tools SVN: r26760 - trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2010-11-19 08:07:12 -0500 (Fri, 19 Nov 2010)
New Revision: 26760
Modified:
trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/SeamUiAllTests.java
Log:
JBIDE-7576
testSeamELContentAssistJbide1676 failure
An additional check is added to prevent NullPointerException appearing within test setUp() method.
Modified: trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/SeamUiAllTests.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/SeamUiAllTests.java 2010-11-19 13:04:48 UTC (rev 26759)
+++ trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/SeamUiAllTests.java 2010-11-19 13:07:12 UTC (rev 26760)
@@ -77,6 +77,8 @@
protected void setUp() throws Exception {
super.setUp();
IProject project = (IProject)ResourcesPlugin.getWorkspace().getRoot().findMember("SeamWebWarTestProject");
+ if (project == null)
+ return;
project.refreshLocal(IResource.DEPTH_INFINITE, null);
JobUtils.waitForIdle();
ISeamProject seamProject = SeamCorePlugin.getSeamProject(project, true);
15 years, 5 months
JBoss Tools SVN: r26759 - in trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test: hyperlink and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2010-11-19 08:04:48 -0500 (Fri, 19 Nov 2010)
New Revision: 26759
Modified:
trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/ca/SeamELContentAssistJbide1645Test.java
trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/ca/SeamELContentAssistJbide1676Test.java
trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/ca/SeamELContentAssistTestCase.java
trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/hyperlink/SeamViewHyperlinkPartitionerTest.java
trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/wizard/SeamProjectNewWizardTest.java
Log:
JBIDE-7576
testSeamELContentAssistJbide1676 failure
Clean up some test cases due to close the openned editors at the end of testing
Modified: trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/ca/SeamELContentAssistJbide1645Test.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/ca/SeamELContentAssistJbide1645Test.java 2010-11-19 12:54:52 UTC (rev 26758)
+++ trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/ca/SeamELContentAssistJbide1645Test.java 2010-11-19 13:04:48 UTC (rev 26759)
@@ -53,36 +53,38 @@
ELCorePlugin.getDefault().getPreferenceStore().setValue(ELContentAssistPreferences.SHOW_METHODS_WITH_PARENTHESES_ONLY, false);
openEditor(PAGE_NAME);
- // Find start of <rich:panel> tag
- String documentContent = document.get();
- int start = (documentContent == null ? -1 : documentContent.indexOf(INSERT_BEFORE_STRING));
- int offsetToTest = start + PREFIX_STRING.length();
-
- assertTrue("Cannot find the starting point in the test file \"" + PAGE_NAME + "\"", (start != -1));
-
- String documentContentModified = documentContent.substring(0, start) +
- INSERTION_STRING + documentContent.substring(start);
-
- jspTextEditor.setText(documentContentModified);
-
- ICompletionProposal[] result= null;
- String errorMessage = null;
-
- List<ICompletionProposal> res = TestUtil.collectProposals(contentAssistant, viewer, offsetToTest);
- assertTrue("Content Assistant peturned no proposals", (res != null && res.size() > 0));
-
- for (ICompletionProposal proposal : res) {
- // There should not be a proposal of type SeamELProposalProcessor.Proposal in the result
- assertFalse("Content Assistant peturned proposals of type (" + proposal.getClass().getName() + ").", (proposal instanceof ELProposalProcessor.Proposal));
+ try {
+ // Find start of <rich:panel> tag
+ String documentContent = document.get();
+ int start = (documentContent == null ? -1 : documentContent.indexOf(INSERT_BEFORE_STRING));
+ int offsetToTest = start + PREFIX_STRING.length();
+
+ assertTrue("Cannot find the starting point in the test file \"" + PAGE_NAME + "\"", (start != -1));
+
+ String documentContentModified = documentContent.substring(0, start) +
+ INSERTION_STRING + documentContent.substring(start);
+
+ jspTextEditor.setText(documentContentModified);
+
+ ICompletionProposal[] result= null;
+ String errorMessage = null;
+
+ List<ICompletionProposal> res = TestUtil.collectProposals(contentAssistant, viewer, offsetToTest);
+ assertTrue("Content Assistant peturned no proposals", (res != null && res.size() > 0));
+
+ for (ICompletionProposal proposal : res) {
+ // There should not be a proposal of type SeamELProposalProcessor.Proposal in the result
+ assertFalse("Content Assistant peturned proposals of type (" + proposal.getClass().getName() + ").", (proposal instanceof ELProposalProcessor.Proposal));
+ }
+
+ try {
+ JobUtils.waitForIdle();
+ } catch (Exception e) {
+ e.printStackTrace();
+ assertTrue("Waiting for the jobs to complete has failed.", false);
+ }
+ } finally {
+ closeEditor();
}
-
- try {
- JobUtils.waitForIdle();
- } catch (Exception e) {
- e.printStackTrace();
- assertTrue("Waiting for the jobs to complete has failed.", false);
- }
-
- closeEditor();
}
}
\ No newline at end of file
Modified: trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/ca/SeamELContentAssistJbide1676Test.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/ca/SeamELContentAssistJbide1676Test.java 2010-11-19 12:54:52 UTC (rev 26758)
+++ trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/ca/SeamELContentAssistJbide1676Test.java 2010-11-19 13:04:48 UTC (rev 26759)
@@ -254,77 +254,79 @@
assertTrue("The Java Editor couldn't be initialized.", false);
}
- CompilationUnitEditor javaEditor = null;
-
- if (editorPart instanceof CompilationUnitEditor)
- javaEditor = (CompilationUnitEditor)editorPart;
-
- // Delay for 3 seconds so that
- // the Favorites view can be seen.
try {
- JobUtils.waitForIdle();
- } catch (Exception e) {
- e.printStackTrace();
- assertTrue("Waiting for the jobs to complete has failed.", false);
- }
- TestUtil.delay(3000);
+ CompilationUnitEditor javaEditor = null;
+
+ if (editorPart instanceof CompilationUnitEditor)
+ javaEditor = (CompilationUnitEditor)editorPart;
- ISourceViewer viewer = javaEditor.getViewer();
- IDocument document = viewer.getDocument();
- SourceViewerConfiguration config = TestUtil.getSourceViewerConfiguration(javaEditor);
- IContentAssistant contentAssistant = (config == null ? null : config.getContentAssistant(viewer));
-
- assertTrue("Cannot get the Content Assistant instance for the editor for file \"" + JAVA_FILENAME + "\"", (contentAssistant != null));
-
- String documentContent = document.get();
- int start = (documentContent == null ? -1 : documentContent.indexOf(EL_START_TEMPLATE));
- int offsetToTest = start + EL_START_TEMPLATE.length();
-
- assertTrue("Cannot find the starting point in the test file \"" + JAVA_FILENAME + "\"", (start != -1));
-
- ICompletionProposal[] result= null;
- String errorMessage = null;
-
- IContentAssistProcessor p= TestUtil.getProcessor(viewer, offsetToTest, contentAssistant);
- if (p != null) {
+ // Delay for 3 seconds so that
+ // the Favorites view can be seen.
try {
- result= p.computeCompletionProposals(viewer, offsetToTest);
- } catch (Throwable x) {
- x.printStackTrace();
+ JobUtils.waitForIdle();
+ } catch (Exception e) {
+ e.printStackTrace();
+ assertTrue("Waiting for the jobs to complete has failed.", false);
+ }
+ TestUtil.delay(3000);
+
+ ISourceViewer viewer = javaEditor.getViewer();
+ IDocument document = viewer.getDocument();
+ SourceViewerConfiguration config = TestUtil.getSourceViewerConfiguration(javaEditor);
+ IContentAssistant contentAssistant = (config == null ? null : config.getContentAssistant(viewer));
+
+ assertTrue("Cannot get the Content Assistant instance for the editor for file \"" + JAVA_FILENAME + "\"", (contentAssistant != null));
+
+ String documentContent = document.get();
+ int start = (documentContent == null ? -1 : documentContent.indexOf(EL_START_TEMPLATE));
+ int offsetToTest = start + EL_START_TEMPLATE.length();
+
+ assertTrue("Cannot find the starting point in the test file \"" + JAVA_FILENAME + "\"", (start != -1));
+
+ ICompletionProposal[] result= null;
+ String errorMessage = null;
+
+ IContentAssistProcessor p= TestUtil.getProcessor(viewer, offsetToTest, contentAssistant);
+ if (p != null) {
+ try {
+ result= p.computeCompletionProposals(viewer, offsetToTest);
+ } catch (Throwable x) {
+ x.printStackTrace();
+ }
+ errorMessage= p.getErrorMessage();
}
- errorMessage= p.getErrorMessage();
- }
-
-// if (errorMessage != null && errorMessage.trim().length() > 0) {
-// System.out.println("#" + offsetToTest + ": ERROR MESSAGE: " + errorMessage);
-// }
-
- assertTrue("Content Assistant peturned no proposals", (result != null && result.length > 0));
-
- // compare SeamELCompletionProposals in the result to the filtered valid proposals
- Set<String> existingProposals = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
- Set<String> nonExistingProposals = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
- Set<String> filteredValidProposals = getJavaStringValidELProposals();
-
- for (int j = 0; j < result.length; j++) {
- // Look only for SeamELProposalProcessor proposals
- if (result[j] instanceof ELProposalProcessor.Proposal) {
- ELProposalProcessor.Proposal proposal = (ELProposalProcessor.Proposal)result[j];
- String proposalString = proposal.getPrefixCompletionText(document, offsetToTest).toString();
-
- if (filteredValidProposals.contains(proposalString)) {
- existingProposals.add(proposalString);
- filteredValidProposals.remove(proposalString);
- } else {
- nonExistingProposals.add(proposalString);
+
+ // if (errorMessage != null && errorMessage.trim().length() > 0) {
+ // System.out.println("#" + offsetToTest + ": ERROR MESSAGE: " + errorMessage);
+ // }
+
+ assertTrue("Content Assistant peturned no proposals", (result != null && result.length > 0));
+
+ // compare SeamELCompletionProposals in the result to the filtered valid proposals
+ Set<String> existingProposals = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
+ Set<String> nonExistingProposals = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
+ Set<String> filteredValidProposals = getJavaStringValidELProposals();
+
+ for (int j = 0; j < result.length; j++) {
+ // Look only for SeamELProposalProcessor proposals
+ if (result[j] instanceof ELProposalProcessor.Proposal) {
+ ELProposalProcessor.Proposal proposal = (ELProposalProcessor.Proposal)result[j];
+ String proposalString = proposal.getPrefixCompletionText(document, offsetToTest).toString();
+
+ if (filteredValidProposals.contains(proposalString)) {
+ existingProposals.add(proposalString);
+ filteredValidProposals.remove(proposalString);
+ } else {
+ nonExistingProposals.add(proposalString);
+ }
}
}
+ assertTrue("Some Seam EL proposals werent\'t shown in the Content Assistant", filteredValidProposals.isEmpty());
+ assertTrue("Some Seam EL proposals were shown in the Content Assistant but they shouldn\'t", nonExistingProposals.isEmpty());
+ } finally {
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
+ .closeEditor(editorPart, false);
}
- assertTrue("Some Seam EL proposals werent\'t shown in the Content Assistant", filteredValidProposals.isEmpty());
- assertTrue("Some Seam EL proposals were shown in the Content Assistant but they shouldn\'t", nonExistingProposals.isEmpty());
-
- PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
- .closeEditor(editorPart, false);
}
}
Modified: trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/ca/SeamELContentAssistTestCase.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/ca/SeamELContentAssistTestCase.java 2010-11-19 12:54:52 UTC (rev 26758)
+++ trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/ca/SeamELContentAssistTestCase.java 2010-11-19 13:04:48 UTC (rev 26759)
@@ -448,148 +448,55 @@
* Test for https://jira.jboss.org/jira/browse/JBIDE-3528
*/
public void testInterface() {
- checkProposals("/WebContent/interfaceTest.xhtml", 359, new String[]{"interfaceTest.test.text"}, false);
+ try {
+ checkProposals("/WebContent/interfaceTest.xhtml", 359, new String[]{"interfaceTest.test.text"}, false);
+ } finally {
+ closeEditor();
+ }
}
public void testSeamELContentAssist() {
ELCorePlugin.getDefault().getPreferenceStore().setValue(ELContentAssistPreferences.SHOW_METHODS_WITH_PARENTHESES_ONLY, false);
openEditor(PAGE_NAME);
-
- List<IRegion> regionsToTest = getELRegionsToTest(document);
-
- if (regionsToTest != null && regionsToTest.size() >= 1) {
-// for (IRegion region : regionsToTest) {
- IRegion region = regionsToTest.get(0);
- try {
-// System.out.println("Seam EL Region To Test: [" + region.getOffset() + "/" + region.getLength() + "] ==> [" +
-// document.get(region.getOffset(), region.getLength()) + "]");
-
- int startOffset = region.getOffset() + 2;
- for (int i = 2; i < region.getLength(); i++) {
- int offset = region.getOffset() + i;
+ try {
+ List<IRegion> regionsToTest = getELRegionsToTest(document);
+
+ if (regionsToTest != null && regionsToTest.size() >= 1) {
+ // for (IRegion region : regionsToTest) {
+ IRegion region = regionsToTest.get(0);
+ try {
+ // System.out.println("Seam EL Region To Test: [" + region.getOffset() + "/" + region.getLength() + "] ==> [" +
+ // document.get(region.getOffset(), region.getLength()) + "]");
- String filter = document.get(startOffset, offset - startOffset);
- Set<String> filteredValidProposals = getFilteredProposals(getPageValidProposals(), filter);
-
- ICompletionProposal[] result= null;
- String errorMessage = null;
-
- List<ICompletionProposal> res = TestUtil.collectProposals(contentAssistant, viewer, offset);
- assertTrue("Content Assist returned no proposals: ", (res != null && res.size() > 0));
-
-// if (errorMessage != null && errorMessage.trim().length() > 0) {
-// System.out.println("#" + offset + ": ERROR MESSAGE: " + errorMessage);
-// }
-
- // compare SeamELCompletionProposals in the result to the filtered valid proposals
- Set<String> existingProposals = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
-
- for (ICompletionProposal p : res) {
-// System.out.println("Result#" + i + "-" + j + " ==> " + result[j].getClass().getName());
- // Cannot separate Seam EL proposals from all the others,
- // so check only the required proposals existance
- //
- if (p instanceof AutoContentAssistantProposal) {
- AutoContentAssistantProposal proposal = (AutoContentAssistantProposal)p;
-
- String proposalString = proposal.getReplacementString();
- if (filteredValidProposals.contains(proposalString)) {
- existingProposals.add(proposalString);
- filteredValidProposals.remove(proposalString);
- } else {
- String validProposal = null;
- if (proposalString.indexOf("(") > -1) {
- String methodName = proposalString.substring(0, proposalString.indexOf("(")).trim();
- // Find method with the same name in filtered valid proposals
- for (String valid : filteredValidProposals) {
- if (valid.indexOf("(") > -1) {
- String validName = valid.substring(0, valid.indexOf("(")).trim();
-
- if (methodName.equals(validName)) {
- validProposal = valid;
- break;
- }
- }
- }
- }
- if (validProposal != null) {
- existingProposals.add(validProposal);
- filteredValidProposals.remove(validProposal);
- }
-
- }
- }
- }
- assertTrue("Some Seam EL proposals werent\'t shown in the Content Assistant", filteredValidProposals.isEmpty());
- }
-
- } catch (BadLocationException e) {
- assertNull("An exception caught: " + (e != null? e.getMessage() : ""), e);
- }
-// }
- }
- regionsToTest = getAttributeValueRegions(viewer);
- if (regionsToTest != null && regionsToTest.size() >= 1) {
-// for (IRegion region : regionsToTest) {
- IRegion region = regionsToTest.get(0);
- try {
-// System.out.println("Attribute Region To Test: [" + region.getOffset() + "/" + region.getLength() + "] ==> [" +
-// document.get(region.getOffset(), region.getLength()) + "]");
-
- String attributeText = document.get(region.getOffset(), region.getLength());
- int openQuoteIndex = attributeText.indexOf('"');
- if (openQuoteIndex == -1)
- openQuoteIndex = attributeText.indexOf('\'');
- else {
- int openQuoteIndex2 = attributeText.indexOf('\'');
- if (openQuoteIndex2 != -1) {
- openQuoteIndex = (openQuoteIndex < openQuoteIndex2 ? openQuoteIndex : openQuoteIndex2);
- }
- }
-
- int closeQuoteIndex = (openQuoteIndex == -1 ? -1 : attributeText.lastIndexOf(attributeText.charAt(openQuoteIndex)));
-
- int startOffset = region.getOffset();
- for (int i = 0; i < region.getLength(); i++) {
- int offset = startOffset + i;
- if ((openQuoteIndex != -1 && i <= openQuoteIndex) ||
- (closeQuoteIndex != -1 && i >= closeQuoteIndex)) {
- // - Before and at opening quotation mark (single or double quote)
- // - or at and after closing quotation mark (single or double quote)
- // There is no prompting acceptable
- } else {
- String filter = document.get(startOffset + openQuoteIndex + 1, offset - startOffset - openQuoteIndex - 1);
+ int startOffset = region.getOffset() + 2;
+ for (int i = 2; i < region.getLength(); i++) {
+ int offset = region.getOffset() + i;
- String clearedFilter = filter;
- if (filter.startsWith("#{")) {
- clearedFilter = filter.substring(2);
- } else {
- clearedFilter = null;
- }
-
- Set<String> filteredValidProposals = getFilteredProposals(getPageValidProposals(), clearedFilter);
+ String filter = document.get(startOffset, offset - startOffset);
+ Set<String> filteredValidProposals = getFilteredProposals(getPageValidProposals(), filter);
ICompletionProposal[] result= null;
String errorMessage = null;
List<ICompletionProposal> res = TestUtil.collectProposals(contentAssistant, viewer, offset);
assertTrue("Content Assist returned no proposals: ", (res != null && res.size() > 0));
-// if (errorMessage != null && errorMessage.trim().length() > 0) {
-// System.out.println("#" + offset + ": ERROR MESSAGE: " + errorMessage);
-// }
+
+ // if (errorMessage != null && errorMessage.trim().length() > 0) {
+ // System.out.println("#" + offset + ": ERROR MESSAGE: " + errorMessage);
+ // }
// compare SeamELCompletionProposals in the result to the filtered valid proposals
Set<String> existingProposals = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
-
+
for (ICompletionProposal p : res) {
-// System.out.println("Result#" + i + "/" + j + " ==> " + result[j].getClass().getName());
- // Cannot separate Seam EL proposals from all the others,
- // so check only the required proposals existance
- //
+ // System.out.println("Result#" + i + "-" + j + " ==> " + result[j].getClass().getName());
+ // Cannot separate Seam EL proposals from all the others,
+ // so check only the required proposals existance
+ //
if (p instanceof AutoContentAssistantProposal) {
AutoContentAssistantProposal proposal = (AutoContentAssistantProposal)p;
+
String proposalString = proposal.getReplacementString();
-
if (filteredValidProposals.contains(proposalString)) {
existingProposals.add(proposalString);
filteredValidProposals.remove(proposalString);
@@ -613,20 +520,118 @@
existingProposals.add(validProposal);
filteredValidProposals.remove(validProposal);
}
+
}
}
}
- assertTrue("Some in-attribute Seam EL proposals werent\'t shown in the Content Assistant", filteredValidProposals.isEmpty());
+ assertTrue("Some Seam EL proposals werent\'t shown in the Content Assistant", filteredValidProposals.isEmpty());
}
+
+ } catch (BadLocationException e) {
+ assertNull("An exception caught: " + (e != null? e.getMessage() : ""), e);
}
- } catch (BadLocationException e) {
- e.printStackTrace();
- assertNull("An exception caught: " + (e != null? e.getMessage() : ""), e);
- }
-// }
+ // }
+ }
+ regionsToTest = getAttributeValueRegions(viewer);
+ if (regionsToTest != null && regionsToTest.size() >= 1) {
+ // for (IRegion region : regionsToTest) {
+ IRegion region = regionsToTest.get(0);
+ try {
+ // System.out.println("Attribute Region To Test: [" + region.getOffset() + "/" + region.getLength() + "] ==> [" +
+ // document.get(region.getOffset(), region.getLength()) + "]");
+
+ String attributeText = document.get(region.getOffset(), region.getLength());
+ int openQuoteIndex = attributeText.indexOf('"');
+ if (openQuoteIndex == -1)
+ openQuoteIndex = attributeText.indexOf('\'');
+ else {
+ int openQuoteIndex2 = attributeText.indexOf('\'');
+ if (openQuoteIndex2 != -1) {
+ openQuoteIndex = (openQuoteIndex < openQuoteIndex2 ? openQuoteIndex : openQuoteIndex2);
+ }
+ }
+
+ int closeQuoteIndex = (openQuoteIndex == -1 ? -1 : attributeText.lastIndexOf(attributeText.charAt(openQuoteIndex)));
+
+ int startOffset = region.getOffset();
+ for (int i = 0; i < region.getLength(); i++) {
+ int offset = startOffset + i;
+ if ((openQuoteIndex != -1 && i <= openQuoteIndex) ||
+ (closeQuoteIndex != -1 && i >= closeQuoteIndex)) {
+ // - Before and at opening quotation mark (single or double quote)
+ // - or at and after closing quotation mark (single or double quote)
+ // There is no prompting acceptable
+ } else {
+ String filter = document.get(startOffset + openQuoteIndex + 1, offset - startOffset - openQuoteIndex - 1);
+
+ String clearedFilter = filter;
+ if (filter.startsWith("#{")) {
+ clearedFilter = filter.substring(2);
+ } else {
+ clearedFilter = null;
+ }
+
+ Set<String> filteredValidProposals = getFilteredProposals(getPageValidProposals(), clearedFilter);
+
+ ICompletionProposal[] result= null;
+ String errorMessage = null;
+
+ List<ICompletionProposal> res = TestUtil.collectProposals(contentAssistant, viewer, offset);
+ assertTrue("Content Assist returned no proposals: ", (res != null && res.size() > 0));
+ // if (errorMessage != null && errorMessage.trim().length() > 0) {
+ // System.out.println("#" + offset + ": ERROR MESSAGE: " + errorMessage);
+ // }
+
+ // compare SeamELCompletionProposals in the result to the filtered valid proposals
+ Set<String> existingProposals = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
+
+ for (ICompletionProposal p : res) {
+ // System.out.println("Result#" + i + "/" + j + " ==> " + result[j].getClass().getName());
+ // Cannot separate Seam EL proposals from all the others,
+ // so check only the required proposals existance
+ //
+ if (p instanceof AutoContentAssistantProposal) {
+ AutoContentAssistantProposal proposal = (AutoContentAssistantProposal)p;
+ String proposalString = proposal.getReplacementString();
+
+ if (filteredValidProposals.contains(proposalString)) {
+ existingProposals.add(proposalString);
+ filteredValidProposals.remove(proposalString);
+ } else {
+ String validProposal = null;
+ if (proposalString.indexOf("(") > -1) {
+ String methodName = proposalString.substring(0, proposalString.indexOf("(")).trim();
+ // Find method with the same name in filtered valid proposals
+ for (String valid : filteredValidProposals) {
+ if (valid.indexOf("(") > -1) {
+ String validName = valid.substring(0, valid.indexOf("(")).trim();
+
+ if (methodName.equals(validName)) {
+ validProposal = valid;
+ break;
+ }
+ }
+ }
+ }
+ if (validProposal != null) {
+ existingProposals.add(validProposal);
+ filteredValidProposals.remove(validProposal);
+ }
+ }
+ }
+ }
+ assertTrue("Some in-attribute Seam EL proposals werent\'t shown in the Content Assistant", filteredValidProposals.isEmpty());
+ }
+ }
+ } catch (BadLocationException e) {
+ e.printStackTrace();
+ assertNull("An exception caught: " + (e != null? e.getMessage() : ""), e);
+ }
+ // }
+ }
+ } finally {
+ closeEditor();
}
-
- closeEditor();
}
@@ -634,21 +639,22 @@
public void testContentAssistForInvocationOnString() {
openEditor(PAGE_HOME_NAME);
-
- List<IRegion> regionsToTest = getELRegionsToTest(document);
- if (regionsToTest != null) {
- for (IRegion region : regionsToTest) {
- int startOffset = region.getOffset() + 2;
- int offset = startOffset + 10;
-
- String errorMessage = null;
-
- List<ICompletionProposal> res = TestUtil.collectProposals(contentAssistant, viewer, offset);
- assertNotNull("Proposals were not created.", res);
- assertEquals("Incorrect number of proposals for #{'aa'.subst|ring(1)}", 3, res.size());
+ try {
+ List<IRegion> regionsToTest = getELRegionsToTest(document);
+ if (regionsToTest != null) {
+ for (IRegion region : regionsToTest) {
+ int startOffset = region.getOffset() + 2;
+ int offset = startOffset + 10;
+
+ String errorMessage = null;
+
+ List<ICompletionProposal> res = TestUtil.collectProposals(contentAssistant, viewer, offset);
+ assertNotNull("Proposals were not created.", res);
+ assertEquals("Incorrect number of proposals for #{'aa'.subst|ring(1)}", 3, res.size());
+ }
}
-
+ } finally {
+ closeEditor();
}
- closeEditor();
}
}
Modified: trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/hyperlink/SeamViewHyperlinkPartitionerTest.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/hyperlink/SeamViewHyperlinkPartitionerTest.java 2010-11-19 12:54:52 UTC (rev 26758)
+++ trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/hyperlink/SeamViewHyperlinkPartitionerTest.java 2010-11-19 13:04:48 UTC (rev 26759)
@@ -61,6 +61,10 @@
}
}
+ FileEditorInput editorInput = null;
+ IDocumentProvider documentProvider = null;
+ IStructuredModel model = null;
+
public void testSeamViewPartitioner() throws CoreException {
JobUtils.waitForIdle();
@@ -72,103 +76,106 @@
assertTrue("The file \"" + PAGE_NAME + "\" is not found", (jspFile != null));
assertTrue("The file \"" + PAGE_NAME + "\" is not found", (jspFile.exists()));
- FileEditorInput editorInput = new FileEditorInput(jspFile);
+ editorInput = new FileEditorInput(jspFile);
- IDocumentProvider documentProvider = null;
Throwable exception = null;
-
- documentProvider = DocumentProviderRegistry.getDefault().getDocumentProvider(editorInput);
- assertNotNull("The document provider for the file \"" + PAGE_NAME + "\" is not loaded", documentProvider);
-
-
- documentProvider.connect(editorInput);
- IDocument document = documentProvider.getDocument(editorInput);
-
- assertTrue("The document for the file \"" + PAGE_NAME + "\" is not loaded", (document != null));
-
- assertTrue("Document should be instance of IStructuredDocument",document instanceof IStructuredDocument);
- IStructuredModel model = StructuredModelManager.getModelManager().getModelForEdit((IStructuredDocument) document);
- assertTrue("The document model for the file \"" + PAGE_NAME + "\" is not loaded", (model != null));
-
- EditorModelUtil.addFactoriesTo(model);
-
- SeamViewHyperlinkPartitioner seamViewPartitioner = new SeamViewHyperlinkPartitioner();
-
- TestHyperlinkDetector detector = new TestHyperlinkDetector();
- HashMap<Object, ArrayList> recognitionTest = new HashMap<Object, ArrayList>();
-
- ArrayList<Region> regionList = new ArrayList<Region>();
- regionList.add(new Region(1888, 11));
- regionList.add(new Region(1943, 11));
- recognitionTest.put("org.jboss.tools.seam.text.ext.SEAM_VIEW_LINK", regionList);
-
- int counter = 0;
- for (int i = 0; i < document.getLength(); i++) {
- TestData testData = new TestData(document, i);
+ try {
+ documentProvider = DocumentProviderRegistry.getDefault().getDocumentProvider(editorInput);
+ assertNotNull("The document provider for the file \"" + PAGE_NAME + "\" is not loaded", documentProvider);
+
+
+ documentProvider.connect(editorInput);
- String[] partitionTypes = detector.getPartitionTypes(document, i);
-
- boolean recognized = false;
+ IDocument document = documentProvider.getDocument(editorInput);
+
+ assertTrue("The document for the file \"" + PAGE_NAME + "\" is not loaded", (document != null));
- if (partitionTypes != null && partitionTypes.length > 0) {
- recognized = ("org.jboss.tools.seam.text.ext.SEAM_VIEW_LINK".equals(partitionTypes[0]));
- }
-
- if (recognized) {
- recognized &= seamViewPartitioner.recognize(testData.document, testData.getHyperlinkRegion());
- }
+ assertTrue("Document should be instance of IStructuredDocument",document instanceof IStructuredDocument);
+ model = StructuredModelManager.getModelManager().getModelForEdit((IStructuredDocument) document);
+ assertTrue("The document model for the file \"" + PAGE_NAME + "\" is not loaded", (model != null));
- if (recognized) {
- String childPartitionType = seamViewPartitioner.getChildPartitionType(testData.document, testData.getHyperlinkRegion());
-// if (childPartitionType != null)
-// System.out.println("position #" + i + " partitionType: " + childPartitionType);
-
- if (childPartitionType != null) {
- ArrayList test = (ArrayList)recognitionTest.get(childPartitionType);
+ EditorModelUtil.addFactoriesTo(model);
+
+ SeamViewHyperlinkPartitioner seamViewPartitioner = new SeamViewHyperlinkPartitioner();
+
+ TestHyperlinkDetector detector = new TestHyperlinkDetector();
+ HashMap<Object, ArrayList> recognitionTest = new HashMap<Object, ArrayList>();
+
+ ArrayList<Region> regionList = new ArrayList<Region>();
+ regionList.add(new Region(1888, 11));
+ regionList.add(new Region(1943, 11));
+ recognitionTest.put("org.jboss.tools.seam.text.ext.SEAM_VIEW_LINK", regionList);
+
+ int counter = 0;
+ for (int i = 0; i < document.getLength(); i++) {
+ TestData testData = new TestData(document, i);
+
+ String[] partitionTypes = detector.getPartitionTypes(document, i);
+
+ boolean recognized = false;
+
+ if (partitionTypes != null && partitionTypes.length > 0) {
+ recognized = ("org.jboss.tools.seam.text.ext.SEAM_VIEW_LINK".equals(partitionTypes[0]));
+ }
+
+ if (recognized) {
+ recognized &= seamViewPartitioner.recognize(testData.document, testData.getHyperlinkRegion());
+ }
+
+ if (recognized) {
+ String childPartitionType = seamViewPartitioner.getChildPartitionType(testData.document, testData.getHyperlinkRegion());
+ // if (childPartitionType != null)
+ // System.out.println("position #" + i + " partitionType: " + childPartitionType);
+
+ if (childPartitionType != null) {
+ ArrayList test = (ArrayList)recognitionTest.get(childPartitionType);
+ boolean testResult = false;
+ Iterator regions = test.iterator();
+ Region r = null;
+ while (!testResult && regions.hasNext()) {
+ r = (Region)regions.next();
+ if (r.getOffset() <= testData.offset && testData.offset < (r.getOffset() + r.getLength()))
+ testResult = true;
+ }
+ assertTrue("Wrong recognition for the region: " + testData.getHyperlinkRegion().toString()
+ + " doesn't matches the region [" + r.getOffset() + "-" + (r.getOffset() + r.getLength()) + "]" , testResult);
+ counter++;
+ } else {
+ recognized = false;
+ }
+
+ }
+
+ if (!recognized) {
+
boolean testResult = false;
- Iterator regions = test.iterator();
+ Iterator keys = recognitionTest.keySet().iterator();
Region r = null;
- while (!testResult && regions.hasNext()) {
- r = (Region)regions.next();
- if (r.getOffset() <= testData.offset && testData.offset < (r.getOffset() + r.getLength()))
- testResult = true;
+ while (keys != null && keys.hasNext()) {
+ Object key = keys.next();
+ ArrayList test = (ArrayList)recognitionTest.get(key);
+ Iterator regions = test.iterator();
+ while (!testResult && regions.hasNext()) {
+ r = (Region)regions.next();
+ if (r.getOffset() <= testData.offset && testData.offset < (r.getOffset() + r.getLength()))
+ testResult = true;
+ // System.out.println(testData.getHyperlinkRegion().toString());
+ }
}
assertTrue("Wrong recognition for the region: " + testData.getHyperlinkRegion().toString()
- + " doesn't matches the region [" + r.getOffset() + "-" + (r.getOffset() + r.getLength()) + "]" , testResult);
- counter++;
- } else {
- recognized = false;
+ + " matches the wrong region [" + r.getOffset() + "-" + (r.getOffset() + r.getLength()) + "] in file \"" + PAGE_NAME + "\"" , (testResult == false));
}
-
}
+
+ assertEquals("Wrong recognized region count", 22 , counter);
+ } finally {
+ if (model != null)
+ model.releaseFromEdit();
- if (!recognized) {
-
- boolean testResult = false;
- Iterator keys = recognitionTest.keySet().iterator();
- Region r = null;
- while (keys != null && keys.hasNext()) {
- Object key = keys.next();
- ArrayList test = (ArrayList)recognitionTest.get(key);
- Iterator regions = test.iterator();
- while (!testResult && regions.hasNext()) {
- r = (Region)regions.next();
- if (r.getOffset() <= testData.offset && testData.offset < (r.getOffset() + r.getLength()))
- testResult = true;
-// System.out.println(testData.getHyperlinkRegion().toString());
- }
- }
- assertTrue("Wrong recognition for the region: " + testData.getHyperlinkRegion().toString()
- + " matches the wrong region [" + r.getOffset() + "-" + (r.getOffset() + r.getLength()) + "] in file \"" + PAGE_NAME + "\"" , (testResult == false));
- }
+ if (editorInput != null && documentProvider != null)
+ documentProvider.disconnect(editorInput);
}
-
- assertEquals("Wrong recognized region count", 22 , counter);
-
- model.releaseFromEdit();
-
- documentProvider.disconnect(editorInput);
}
class TestData {
Modified: trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/wizard/SeamProjectNewWizardTest.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/wizard/SeamProjectNewWizardTest.java 2010-11-19 12:54:52 UTC (rev 26758)
+++ trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/wizard/SeamProjectNewWizardTest.java 2010-11-19 13:04:48 UTC (rev 26759)
@@ -82,25 +82,34 @@
*
*/
public void testSeamProjectNewWizardInstanceIsCreated() {
- IWizardPage startSeamPrjWzPg = wizard.getStartingPage();
- wizard.getDataModel().setStringProperty("IProjectCreationPropertiesNew.PROJECT_NAME","testName");
- assertNotNull("Cannot create seam start wizard page", startSeamPrjWzPg);
- IWizardPage webModuleWizPg = wizard.getNextPage(startSeamPrjWzPg);
- assertNotNull("Cannot create dynamic web project wizard page",webModuleWizPg);
- IWizardPage jsfCapabilitiesWizPg = wizard.getNextPage(webModuleWizPg);
- assertNotNull("Cannot create JSF capabilities wizard page",jsfCapabilitiesWizPg);
- IWizardPage seamWizPg = wizard.getNextPage(jsfCapabilitiesWizPg);
- assertNotNull("Cannot create seam facet wizard page",seamWizPg);
- wizard.performCancel();
+ try {
+ IWizardPage startSeamPrjWzPg = wizard.getStartingPage();
+ wizard.getDataModel().setStringProperty("IProjectCreationPropertiesNew.PROJECT_NAME","testName");
+ assertNotNull("Cannot create seam start wizard page", startSeamPrjWzPg);
+ IWizardPage webModuleWizPg = wizard.getNextPage(startSeamPrjWzPg);
+ assertNotNull("Cannot create dynamic web project wizard page",webModuleWizPg);
+ IWizardPage jsfCapabilitiesWizPg = wizard.getNextPage(webModuleWizPg);
+ assertNotNull("Cannot create JSF capabilities wizard page",jsfCapabilitiesWizPg);
+ IWizardPage seamWizPg = wizard.getNextPage(jsfCapabilitiesWizPg);
+ assertNotNull("Cannot create seam facet wizard page",seamWizPg);
+ } finally {
+ wizard.performCancel();
+ dialog.close();
+ }
}
public void testSeamProjectNewWizardFinisDisableByDefaul() {
- // Disable Library Configuration
- disableLibraryConfiguration();
- JobUtils.delay(1000);
-
- boolean canFinish = wizard.canFinish();
- assertFalse("Finish button is enabled at first wizard page before all requerd fileds are valid.", canFinish);
+ try {
+ // Disable Library Configuration
+ disableLibraryConfiguration();
+ JobUtils.delay(1000);
+
+ boolean canFinish = wizard.canFinish();
+ assertFalse("Finish button is enabled at first wizard page before all requerd fileds are valid.", canFinish);
+ } finally {
+ wizard.performCancel();
+ dialog.close();
+ }
}
/**
@@ -109,15 +118,20 @@
* See http://jira.jboss.com/jira/browse/JBIDE-1111
*/
public void testJiraJbide1111() {
- // Disable Library Configuration
- disableLibraryConfiguration();
- JobUtils.delay(1000);
-
- // Set project name
- wizard.getDataModel().setProperty(IFacetDataModelProperties.FACET_PROJECT_NAME, "testSeamProject");
- JobUtils.delay(1000);
-
- assertTrue("Finish button is disabled at first wizard page in spite of created JBoss AS Runtime, Server, DB Connection and Seam Runtime and valid project name.", wizard.canFinish());
+ try {
+ // Disable Library Configuration
+ disableLibraryConfiguration();
+ JobUtils.delay(2000);
+
+ // Set project name
+ wizard.getDataModel().setProperty(IFacetDataModelProperties.FACET_PROJECT_NAME, "testSeamProject");
+ JobUtils.delay(2000);
+
+ assertTrue("Finish button is disabled at first wizard page in spite of created JBoss AS Runtime, Server, DB Connection and Seam Runtime and valid project name.", wizard.canFinish());
+ } finally {
+ wizard.performCancel();
+ dialog.close();
+ }
}
private void disableLibraryConfiguration(){
@@ -170,8 +184,7 @@
@Override
protected void tearDown() throws Exception {
- wizard.performCancel();
- dialog.close();
+
}
public static final String INIT_ERROR_MESSAGE = "System property ''{0}'' must be configured with -D to run these tests";
15 years, 5 months