[jbosstools-commits] JBoss Tools SVN: r23294 - in trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui: utils and 1 other directories.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Wed Jul 7 18:42:06 EDT 2010


Author: bfitzpat
Date: 2010-07-07 18:42:06 -0400 (Wed, 07 Jul 2010)
New Revision: 23294

Modified:
   trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/messages/JBossWSUI.properties
   trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/messages/JBossWSUIMessages.java
   trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/utils/JAXWSTester2.java
   trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/views/JAXRSWSTestView.java
Log:
[JBIDE-6577] Updates to fix issue with key listener and more with canceling the invocation

Modified: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/messages/JBossWSUI.properties
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/messages/JBossWSUI.properties	2010-07-07 21:13:45 UTC (rev 23293)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/messages/JBossWSUI.properties	2010-07-07 22:42:06 UTC (rev 23294)
@@ -93,6 +93,7 @@
 JAXRSWSTestView_JAXRS_Success_Status=Successful JAX-RS Web Service Execution
 JAXRSWSTestView_JAXWS_Success_Status=Successful JAX-WS Web Service Execution
 JAXRSWSTestView_Message_Service_Invocation_Cancelled=Service invocation cancelled by user.
+JAXRSWSTestView_Message_Unsuccessful_Test=Test unsuccessful: Check the URL, request message, and parameter values.
 JAXRSWSTestView_Open_Monitor_Button=Open Monitor
 JAXRSWSTestView_Open_Response_Tag_Contents_in_XML_Editor=Open &Response tag contents in XML Editor
 JAXRSWSTestView_Open_Result_in_XML_Editor=&Open in XML Editor

Modified: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/messages/JBossWSUIMessages.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/messages/JBossWSUIMessages.java	2010-07-07 21:13:45 UTC (rev 23293)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/messages/JBossWSUIMessages.java	2010-07-07 22:42:06 UTC (rev 23294)
@@ -124,6 +124,7 @@
 	public static String JAXRSWSTestView_JAXRS_Success_Status;
 	public static String JAXRSWSTestView_JAXWS_Success_Status;
 	public static String JAXRSWSTestView_Message_Service_Invocation_Cancelled;
+	public static String JAXRSWSTestView_Message_Unsuccessful_Test;
 	public static String JAXRSWSTestView_Open_Monitor_Button;
 	public static String JAXRSWSTestView_Open_Response_Tag_Contents_in_XML_Editor;
 	public static String JAXRSWSTestView_Open_Result_in_XML_Editor;

Modified: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/utils/JAXWSTester2.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/utils/JAXWSTester2.java	2010-07-07 21:13:45 UTC (rev 23293)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/utils/JAXWSTester2.java	2010-07-07 22:42:06 UTC (rev 23294)
@@ -102,7 +102,7 @@
 		
 		Response<SOAPMessage> response = d.invokeAsync(m);
 		while (!response.isDone()){
-		//go off and do some work
+			//go off and do some work
 			if (monitor != null) {
 				if (monitor.isCanceled()) {
 					response.cancel(true);

Modified: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/views/JAXRSWSTestView.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/views/JAXRSWSTestView.java	2010-07-07 21:13:45 UTC (rev 23293)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/views/JAXRSWSTestView.java	2010-07-07 22:42:06 UTC (rev 23294)
@@ -222,7 +222,7 @@
 
 			public void keyReleased(KeyEvent e) {
 				setControlsForSelectedURL();
-				if (e.keyCode == SWT.CR) {
+				if (e.keyCode == SWT.CR && e.stateMask == SWT.CTRL) {
 					handleTest(wsTypeCombo.getText());
 				}
 			}
@@ -577,8 +577,17 @@
 
 	private void setControlsForSelectedURL() {
 		if (urlCombo.getText().trim().length() > 0) {
-			testButton.setEnabled(true);
-			addTCPIPMonitorButton.setEnabled(true);
+			String urlText = urlCombo.getText();
+			try {
+				new URL(urlText);
+				testButton.setEnabled(true);
+				addTCPIPMonitorButton.setEnabled(true);
+			} catch (MalformedURLException mue) {
+				testButton.setEnabled(false);
+				addTCPIPMonitorButton.setEnabled(false);
+
+				return;
+			}
 		} else {
 			testButton.setEnabled(false);
 			addTCPIPMonitorButton.setEnabled(false);
@@ -779,6 +788,14 @@
 	 */
 	private void handleTest(final String wsTech) {
 
+		String urlText = urlCombo.getText();
+		try {
+			new URL(urlText);
+		} catch (MalformedURLException mue) {
+			// do nothing, but return since we don't have a working URL
+			return;
+		}
+		
 		if (urlCombo.getItemCount() > 0) {
 			java.util.List<String> aList = Arrays.asList(urlCombo.getItems());
 			if (!aList.contains(urlCombo.getText())) {
@@ -858,20 +875,32 @@
 //			JAXWSTester tester = new JAXWSTester();
 //			tester.doTest(url, action, body);
 			JAXWSTester2 tester = new JAXWSTester2();
+			boolean itRan = false;
 			while (!monitor.isCanceled()) {
 				try {
-					// call the service
-					tester.doTest(monitor, url, action, serviceNSMessage[0], serviceNSMessage[1], serviceNSMessage[2], body);
+					if (!itRan && serviceNSMessage != null && serviceNSMessage.length == 3) { 
+						itRan = true;
+						// 	call the service
+						tester.doTest(monitor, url, action, serviceNSMessage[0], serviceNSMessage[1], serviceNSMessage[2], body);
+					} else {
+						break;
+					}
 				} catch (InterruptedException ie) {
 					monitor.setCanceled(true);
 				}
 			}
 			if (monitor.isCanceled()) {
-				WSTestStatus status = new WSTestStatus(IStatus.WARNING, 
+				WSTestStatus status = new WSTestStatus(IStatus.OK, 
 						JBossWSUIPlugin.PLUGIN_ID, 
 						JBossWSUIMessages.JAXRSWSTestView_Message_Service_Invocation_Cancelled);
 				return status;
 			}
+			if (!itRan) {
+				WSTestStatus status = new WSTestStatus(IStatus.OK, 
+						JBossWSUIPlugin.PLUGIN_ID, 
+						JBossWSUIMessages.JAXRSWSTestView_Message_Unsuccessful_Test);
+				return status;
+			}
 //			tester.doTest(url, action, serviceNSMessage[0], serviceNSMessage[1], serviceNSMessage[2], body);
 			monitor.worked(70);
 			String result = tester.getResultBody();
@@ -905,7 +934,7 @@
 			monitor.worked(10);
 			return status;
 		} catch (Exception e) {
-			WSTestStatus status = new WSTestStatus(IStatus.ERROR, 
+			WSTestStatus status = new WSTestStatus(IStatus.OK, 
 					JBossWSUIPlugin.PLUGIN_ID, 
 					JBossWSUIMessages.JAXRSWSTestView_Exception_Status + e.getLocalizedMessage());
 			status.setResultsText(e.toString());



More information about the jbosstools-commits mailing list