[jbosstools-commits] JBoss Tools SVN: r43414 - in trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test: integration and 4 other directories.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Wed Sep 5 10:07:30 EDT 2012


Author: jjankovi
Date: 2012-09-05 10:07:30 -0400 (Wed, 05 Sep 2012)
New Revision: 43414

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/integration/JAXRSToolingIntegrationTest.java
   trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/RESTfulHelper.java
   trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/RESTfulTestBase.java
   trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/completion/RESTfulCompletionTest.java
   trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/validation/RESTfulValidationTest.java
   trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/uiutils/RESTFullExplorer.java
   trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/uiutils/RunOnServerDialog.java
Log:
fixing ws tests according to JBDS 6 + some refactoring

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	2012-09-05 13:42:23 UTC (rev 43413)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/WSAllBotTests.java	2012-09-05 14:07:30 UTC (rev 43414)
@@ -36,20 +36,6 @@
 import org.junit.runners.Suite.SuiteClasses;
 
 /**
- * System properties:
- *  -Dswtbot.test.properties.file=$PATH
- *  -Dusage_reporting_enabled=$BOOLEAN
- *  
- *  Format of swtbot.properties file:
- *  SERVER=EAP|JBOSS_AS,<server version>,<jre version to run with>|default,<server home>
- *  
- *  Sample swtbot.properties file:
- *
- *  SERVER=JBOSS_AS,6.0,default,/home/lukas/latest/jboss-6.0.0.Final
- *  JAVA=1.6,/space/java/sdk/jdk1.6.0_22
- *  
- *  
- *  Suite duration: aprox. 13min
  * 
  * @author Lukas Jungmann
  * @author jjankovi
@@ -60,7 +46,7 @@
 	SampleRESTWebServiceTest.class,
 	SimpleSoapWebServiceTest.class,
 	SimpleRESTWebServiceTest.class,
-	AnnotationPropertiesTest.class,
+//	AnnotationPropertiesTest.class, // not implemented yet
 	RESTfulExplorerTest.class, 
 	PathAnnotationSupportTest.class,
 	QueryAnnotationSupportTest.class,
@@ -70,6 +56,7 @@
 	RESTfulCompletionTest.class,
 	JAXRSToolingIntegrationTest.class,
 	SOAPWSToolingIntegrationTest.class,
+//	WSTesterPromptValuesSupportTest.class, // not implemented yet
 	ApplicationPathAnnotationTest.class,
 	BottomUpWSTest.class,
 	TopDownWSTest.class,

Modified: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/integration/JAXRSToolingIntegrationTest.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/integration/JAXRSToolingIntegrationTest.java	2012-09-05 13:42:23 UTC (rev 43413)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/integration/JAXRSToolingIntegrationTest.java	2012-09-05 14:07:30 UTC (rev 43414)
@@ -53,11 +53,11 @@
 		restfulWizard = new RESTFullExplorer(projectName);
 		
 		/* run on server - web service tester should be shown */
-		runRestServiceOnConfiguredServer("GET");
+		runRestServiceOnConfiguredServer(restfulWizard.restService("GET"));
 		assertWebServiceTesterIsActive();
 		
 		/* test generated url and response after invoking */
-		wsTesterView = showWSTester();
+		wsTesterView.show();
 		assertEquals(serviceUrl + "get", wsTesterView.getServiceURL());
 		
 		invokeMethodInWSTester(wsTesterView, Request_Type.GET);
@@ -71,11 +71,11 @@
 		restfulWizard = new RESTFullExplorer(projectName);
 		
 		/* run on server - web service tester should be shown */
-		runRestServiceOnConfiguredServer("POST");
+		runRestServiceOnConfiguredServer(restfulWizard.restService("POST"));
 		assertWebServiceTesterIsActive();
 		
 		/* test generated url and response after invoking */
-		wsTesterView = showWSTester();
+		wsTesterView.show();
 		assertEquals(serviceUrl + "post", wsTesterView.getServiceURL());
 		
 		invokeMethodInWSTester(wsTesterView, Request_Type.POST);
@@ -89,11 +89,11 @@
 		restfulWizard = new RESTFullExplorer(projectName);
 		
 		/* run on server - web service tester should be shown */
-		runRestServiceOnConfiguredServer("PUT");
+		runRestServiceOnConfiguredServer(restfulWizard.restService("PUT"));
 		assertWebServiceTesterIsActive();
 		
 		/* test generated url and response after invoking */
-		wsTesterView = showWSTester();
+		wsTesterView.show();
 		assertEquals(serviceUrl + "put", wsTesterView.getServiceURL());
 		
 		invokeMethodInWSTester(wsTesterView, Request_Type.PUT);
@@ -107,11 +107,11 @@
 		restfulWizard = new RESTFullExplorer(projectName);
 		
 		/* run on server - web service tester should be shown */
-		runRestServiceOnConfiguredServer("DELETE");
+		runRestServiceOnConfiguredServer(restfulWizard.restService("DELETE"));
 		assertWebServiceTesterIsActive();
 		
 		/* test generated url and response after invoking */
-		wsTesterView = showWSTester();
+		wsTesterView.show();
 		assertEquals(serviceUrl + "delete", wsTesterView.getServiceURL());
 		
 		invokeMethodInWSTester(wsTesterView, Request_Type.DELETE);
@@ -125,11 +125,11 @@
 		restfulWizard = new RESTFullExplorer(projectName);
 		
 		/* run on server - web service tester should be shown */
-		runRestServiceOnConfiguredServer("GET");
+		runRestServiceOnConfiguredServer(restfulWizard.restService("GET"));
 		assertWebServiceTesterIsActive();
 		
 		/* test generated url and response after invoking */
-		wsTesterView = showWSTester();
+		wsTesterView.show();
 		assertEquals(serviceUrl + "get", wsTesterView.getServiceURL());
 		
 		invokeMethodInWSTester(wsTesterView, Request_Type.POST);
@@ -137,14 +137,4 @@
 		assertEquals("[HTTP/1.1 405 Method Not Allowed]", wsTesterView.getResponseHeaders()[0]);
 	}
 	
-	private WsTesterView showWSTester() {
-		wsTesterView.show();		
-		return wsTesterView;
-	}
-	
-	private void invokeMethodInWSTester(WsTesterView wsTesterView, Request_Type type) {
-		wsTesterView.setRequestType(type);
-		wsTesterView.invoke();
-	}
-	
 }

Modified: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/RESTfulHelper.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/RESTfulHelper.java	2012-09-05 13:42:23 UTC (rev 43413)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/RESTfulHelper.java	2012-09-05 14:07:30 UTC (rev 43414)
@@ -41,13 +41,13 @@
 	private static final SWTUtilExt util = new SWTUtilExt(bot);
 	private static final ProjectExplorer projectExplorer = new ProjectExplorer();
 	private static final SWTOpenExt open = new SWTOpenExt(bot);
-	private static ResourceHelper resourceHelper = new ResourceHelper();
+	private static final ResourceHelper resourceHelper = new ResourceHelper();
 	
-	private final String PATH_PARAM_VALID_ERROR = "Invalid @PathParam value";
-	private final String VALIDATION_PREFERENCE = "Validation";
-	private final String ENABLE_ALL = "Enable All";
-	private final String JAX_RS_VALIDATOR = "JAX-RS Metamodel Validator";
-	private final String VALIDATION_SETTINGS_CHANGED = "Validation Settings Changed";
+	private static final String PATH_PARAM_VALID_ERROR = "@PathParam value";
+	private static final String VALIDATION_PREFERENCE = "Validation";
+	private static final String ENABLE_ALL = "Enable All";
+	private static final String JAX_RS_VALIDATOR = "JAX-RS Metamodel Validator";
+	private static final String VALIDATION_SETTINGS_CHANGED = "Validation Settings Changed";
 	
 	private enum ConfigureOption {
 		ADD, REMOVE;

Modified: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/RESTfulTestBase.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/RESTfulTestBase.java	2012-09-05 13:42:23 UTC (rev 43413)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/RESTfulTestBase.java	2012-09-05 14:07:30 UTC (rev 43414)
@@ -22,6 +22,8 @@
 import org.jboss.tools.ws.ui.bot.test.WSTestBase;
 import org.jboss.tools.ws.ui.bot.test.uiutils.RESTFullExplorer;
 import org.jboss.tools.ws.ui.bot.test.uiutils.RunOnServerDialog;
+import org.jboss.tools.ws.ui.bot.test.widgets.WsTesterView;
+import org.jboss.tools.ws.ui.bot.test.widgets.WsTesterView.Request_Type;
 
 /**
  * Test base for bot tests using RESTFul support
@@ -158,8 +160,8 @@
 				foundCount == expectedCount);
 	}
 	
-	protected void runRestServiceOnConfiguredServer(String webService) {
-		RunOnServerDialog dialog = restfulWizard.runOnServer(restfulWizard.restService(webService));
+	protected void runRestServiceOnConfiguredServer(SWTBotTreeItem webService) {
+		RunOnServerDialog dialog = restfulWizard.runOnServer(webService);
 		dialog.chooseExistingServer().selectServer(configuredState.getServer().name).finish();		
 		bot.waitUntil(new ViewIsActive(IDELabel.View.WEB_SERVICE_TESTER));
 	}
@@ -169,6 +171,11 @@
 		return restfulWizard.getAllRestServices();
 	}
 
+	protected void invokeMethodInWSTester(WsTesterView wsTesterView, Request_Type type) {
+		wsTesterView.setRequestType(type);
+		wsTesterView.invoke();
+	}
+
 	protected SWTBotEditor editorForClass(String projectName, String... path) {
 		return packageExplorer.openFile(projectName, path);
 	}

Modified: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/completion/RESTfulCompletionTest.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/completion/RESTfulCompletionTest.java	2012-09-05 13:42:23 UTC (rev 43413)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/completion/RESTfulCompletionTest.java	2012-09-05 14:07:30 UTC (rev 43414)
@@ -25,13 +25,13 @@
  */
 public class RESTfulCompletionTest extends RESTfulTestBase{
 
-	private final String GET_METHOD_PATH = "/{userId}";
-	private final String CORRECT_PATH_PARAM = "userId";
-	private final String INCORRECT_PATH_PARAM = "someId";
-	private final String PATH_PARAM_NAVIGATION = "@PathParam(";
-	private final List<String> EXP_NON_EMPTY_COMPLETION_RESULT = 
+	private static final String GET_METHOD_PATH = "/{userId}";
+	private static final String CORRECT_PATH_PARAM = "userId";
+	private static final String INCORRECT_PATH_PARAM = "someId";
+	private static final String PATH_PARAM_NAVIGATION = "@PathParam(";
+	private static final List<String> EXP_NON_EMPTY_COMPLETION_RESULT = 
 			Arrays.asList("userId - JAX-RS Mapping");
-	private final List<String> EXP_EMPTY_COMPLETION_RESULT = 
+	private static final List<String> EXP_EMPTY_COMPLETION_RESULT = 
 			Arrays.asList("No Default Proposals");
 	
 	@Override

Modified: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/validation/RESTfulValidationTest.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/validation/RESTfulValidationTest.java	2012-09-05 13:42:23 UTC (rev 43413)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/validation/RESTfulValidationTest.java	2012-09-05 14:07:30 UTC (rev 43414)
@@ -21,9 +21,9 @@
  */
 public class RESTfulValidationTest extends RESTfulTestBase {
 	
-	private final String GET_METHOD_PATH = "/{id}";
-	private final String CORRECT_PATH_PARAM = "id";
-	private final String BAD_PATH_PARAM = "customerId";
+	private static final String GET_METHOD_PATH = "/{id}";
+	private static final String CORRECT_PATH_PARAM = "id";
+	private static final String BAD_PATH_PARAM = "customerId";
 	
 	@Override
 	protected String getWsProjectName() {

Modified: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/uiutils/RESTFullExplorer.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/uiutils/RESTFullExplorer.java	2012-09-05 13:42:23 UTC (rev 43413)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/uiutils/RESTFullExplorer.java	2012-09-05 14:07:30 UTC (rev 43414)
@@ -97,6 +97,20 @@
 	 * @param restService
 	 * @return
 	 */
+	public String getClassMethodName(SWTBotTreeItem restService) {
+		for (SWTBotTreeItem ti: getAllInfoAboutRestService(restService)) {
+			if (!ti.getText().contains("produces:") && !ti.getText().contains("consumes:")) {
+				return ti.getText();
+			}
+		}
+		return null;
+	}
+	
+	/**
+	 * 
+	 * @param restService
+	 * @return
+	 */
 	public String getRestServiceName(SWTBotTreeItem restService) {
 		return restService.getText().split(" ")[0];
 	}

Modified: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/uiutils/RunOnServerDialog.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/uiutils/RunOnServerDialog.java	2012-09-05 13:42:23 UTC (rev 43413)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/uiutils/RunOnServerDialog.java	2012-09-05 14:07:30 UTC (rev 43414)
@@ -28,7 +28,7 @@
 
 	private SWTBotShell shell = null;
 	private SWTBot bot = null;
-	private final String DIALOG_TITLE = "Run On Server";
+	private static final String DIALOG_TITLE = "Run On Server";
 	
 	public RunOnServerDialog() {
 		shell = SWTBotFactory.getBot().shell(getDialogTitle());



More information about the jbosstools-commits mailing list