[jbosstools-commits] JBoss Tools SVN: r43951 - in trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test: rest/validation and 1 other directory.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Mon Sep 24 02:09:41 EDT 2012


Author: jjankovi
Date: 2012-09-24 02:09:40 -0400 (Mon, 24 Sep 2012)
New Revision: 43951

Added:
   trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/validation/JaxRsValidatorTest.java
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/rest/validation/RESTfulValidationTest.java
Log:
JBQA-6998 test implemented

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-24 03:48:10 UTC (rev 43950)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/WSAllBotTests.java	2012-09-24 06:09:40 UTC (rev 43951)
@@ -20,6 +20,7 @@
 import org.jboss.tools.ws.ui.bot.test.rest.completion.RESTfulCompletionTest;
 import org.jboss.tools.ws.ui.bot.test.rest.explorer.RESTfulExplorerTest;
 import org.jboss.tools.ws.ui.bot.test.rest.validation.ApplicationPathAnnotationTest;
+import org.jboss.tools.ws.ui.bot.test.rest.validation.JaxRsValidatorTest;
 import org.jboss.tools.ws.ui.bot.test.rest.validation.RESTfulValidationTest;
 import org.jboss.tools.ws.ui.bot.test.sample.test.SampleRESTWebServiceTest;
 import org.jboss.tools.ws.ui.bot.test.sample.test.SampleSoapWebServiceTest;
@@ -57,6 +58,7 @@
 	SOAPWSToolingIntegrationTest.class,
 //	WSTesterPromptValuesSupportTest.class, // not implemented yet
 	ApplicationPathAnnotationTest.class,
+	JaxRsValidatorTest.class,
 	BottomUpWSTest.class,
 	TopDownWSTest.class,
 	WsClientTest.class,

Added: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/validation/JaxRsValidatorTest.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/validation/JaxRsValidatorTest.java	                        (rev 0)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/validation/JaxRsValidatorTest.java	2012-09-24 06:09:40 UTC (rev 43951)
@@ -0,0 +1,86 @@
+package org.jboss.tools.ws.ui.bot.test.rest.validation;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.eclipse.swtbot.swt.finder.SWTBot;
+import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
+import org.jboss.tools.ui.bot.ext.gen.IPreference;
+import org.jboss.tools.ui.bot.ext.types.IDELabel;
+import org.jboss.tools.ws.ui.bot.test.rest.RESTfulTestBase;
+import org.junit.Test;
+
+/**
+ * 
+ * @author jjankovi
+ *
+ */
+public class JaxRsValidatorTest extends RESTfulTestBase {
+
+	@Override
+	public String getWsProjectName() {
+		return "restValidation2";
+	}
+	
+	@Override
+	public void cleanup() {		
+	
+	}
+	
+	@Test
+	public void testValidatorInPreferences() {
+		
+		/* try to open JAX-RS Validator in Preferences */
+		SWTBot bot = openJaxRsValidator();
+		closeJaxRsValidator(bot);
+		
+	}
+	
+	@Test
+	public void testValidatorEnabled() {
+		
+		/* enable restful validation */
+		restfulHelper.enableRESTValidation();
+		
+		/* test count of validation errors */
+		assertCountOfPathAnnotationValidationErrors(getWsProjectName(), 1);
+		
+		
+	}
+	
+	@Test
+	public void testValidatorDisabled() {
+		
+		/* disable restful validation */
+		restfulHelper.disableRESTValidation();
+		
+		/* test count of validation errors */
+		assertCountOfPathAnnotationValidationErrors(getWsProjectName(), 0);
+	}
+	
+	private SWTBot openJaxRsValidator() {
+		
+		try {
+			return open.preferenceOpen(new IPreference() {
+				@Override
+				public String getName() {
+					return "JAX-RS Validator";
+				
+				}
+				
+				@Override
+				public List<String> getGroupPath() {
+					return Arrays.asList("JBoss Tools", "JAX-RS");
+				}
+			});
+		} catch(WidgetNotFoundException exc) {
+			fail("JAX-RS Validator is not located in Preferences");
+		}
+		return null;	
+	}
+	
+	private void closeJaxRsValidator(SWTBot bot) {
+		bot.button(IDELabel.Button.CANCEL).click();
+	}
+	
+}

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-24 03:48:10 UTC (rev 43950)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/validation/RESTfulValidationTest.java	2012-09-24 06:09:40 UTC (rev 43951)
@@ -89,27 +89,5 @@
 		/* test count of validation errors */
 		assertCountOfPathAnnotationValidationErrors(getWsProjectName(), 0);
 	}
-	
-	@Test
-	public void testJaxRsValidator() {
-		
-		/* disable restful validation */
-		restfulHelper.disableRESTValidation();
-		
-		/* prepare project */
-		prepareRestfulResource(editorForClass(getWsProjectName(), "src", 
-				"org.rest.test", "RestService.java"), SIMPLE_REST_WS_RESOURCE, 
-				"org.rest.test", "RestService",
-				GET_METHOD_PATH, BAD_PATH_PARAM);
-		
-		/* test count of validation errors */
-		assertCountOfPathAnnotationValidationErrors(getWsProjectName(), 0);
-		
-		/* enable restful validation */
-		restfulHelper.enableRESTValidation();
-		
-		/* test count of validation errors */
-		assertCountOfPathAnnotationValidationErrors(getWsProjectName(), 1);
-	}
 
 }



More information about the jbosstools-commits mailing list