[jbosstools-commits] JBoss Tools SVN: r43953 - in trunk/ws/tests/org.jboss.tools.ws.ui.bot.test: resources/projects/httpAnnot and 8 other directories.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Mon Sep 24 04:12:05 EDT 2012


Author: jjankovi
Date: 2012-09-24 04:12:04 -0400 (Mon, 24 Sep 2012)
New Revision: 43953

Added:
   trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/resources/projects/httpAnnot/
   trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/resources/projects/httpAnnot/.classpath
   trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/resources/projects/httpAnnot/.project
   trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/resources/projects/httpAnnot/.settings/
   trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/resources/projects/httpAnnot/.settings/.jsdtscope
   trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/resources/projects/httpAnnot/.settings/org.eclipse.wst.common.component
   trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/resources/projects/httpAnnot/.settings/org.eclipse.wst.common.project.facet.core.xml
   trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/resources/projects/httpAnnot/.settings/org.eclipse.wst.jsdt.ui.superType.container
   trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/resources/projects/httpAnnot/.settings/org.eclipse.wst.jsdt.ui.superType.name
   trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/resources/projects/httpAnnot/.settings/org.jboss.ide.eclipse.as.core.prefs
   trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/resources/projects/httpAnnot/WebContent/
   trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/resources/projects/httpAnnot/WebContent/META-INF/
   trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/resources/projects/httpAnnot/WebContent/META-INF/MANIFEST.MF
   trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/resources/projects/httpAnnot/WebContent/WEB-INF/
   trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/resources/projects/httpAnnot/WebContent/WEB-INF/lib/
   trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/resources/projects/httpAnnot/build/
   trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/resources/projects/httpAnnot/src/
   trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/resources/projects/httpAnnot/src/test/
   trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/resources/projects/httpAnnot/src/test/MyAnnot.java
   trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/annotation/HTTPMethodAnnotationQuickFixTest.java
Modified:
   trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/WSAllBotTests.java
Log:
JBQA-6997 implemented

Added: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/resources/projects/httpAnnot/.classpath
===================================================================
(Binary files differ)


Property changes on: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/resources/projects/httpAnnot/.classpath
___________________________________________________________________
Added: svn:mime-type
   + application/xml

Added: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/resources/projects/httpAnnot/.project
===================================================================
(Binary files differ)


Property changes on: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/resources/projects/httpAnnot/.project
___________________________________________________________________
Added: svn:mime-type
   + application/xml

Added: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/resources/projects/httpAnnot/.settings/.jsdtscope
===================================================================
(Binary files differ)


Property changes on: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/resources/projects/httpAnnot/.settings/.jsdtscope
___________________________________________________________________
Added: svn:mime-type
   + application/xml

Added: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/resources/projects/httpAnnot/.settings/org.eclipse.wst.common.component
===================================================================
(Binary files differ)


Property changes on: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/resources/projects/httpAnnot/.settings/org.eclipse.wst.common.component
___________________________________________________________________
Added: svn:mime-type
   + application/xml

Added: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/resources/projects/httpAnnot/.settings/org.eclipse.wst.common.project.facet.core.xml
===================================================================
(Binary files differ)


Property changes on: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/resources/projects/httpAnnot/.settings/org.eclipse.wst.common.project.facet.core.xml
___________________________________________________________________
Added: svn:mime-type
   + application/xml

Added: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/resources/projects/httpAnnot/.settings/org.eclipse.wst.jsdt.ui.superType.container
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/resources/projects/httpAnnot/.settings/org.eclipse.wst.jsdt.ui.superType.container	                        (rev 0)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/resources/projects/httpAnnot/.settings/org.eclipse.wst.jsdt.ui.superType.container	2012-09-24 08:12:04 UTC (rev 43953)
@@ -0,0 +1 @@
+org.eclipse.wst.jsdt.launching.baseBrowserLibrary
\ No newline at end of file

Added: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/resources/projects/httpAnnot/.settings/org.eclipse.wst.jsdt.ui.superType.name
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/resources/projects/httpAnnot/.settings/org.eclipse.wst.jsdt.ui.superType.name	                        (rev 0)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/resources/projects/httpAnnot/.settings/org.eclipse.wst.jsdt.ui.superType.name	2012-09-24 08:12:04 UTC (rev 43953)
@@ -0,0 +1 @@
+Window
\ No newline at end of file

Added: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/resources/projects/httpAnnot/.settings/org.jboss.ide.eclipse.as.core.prefs
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/resources/projects/httpAnnot/.settings/org.jboss.ide.eclipse.as.core.prefs	                        (rev 0)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/resources/projects/httpAnnot/.settings/org.jboss.ide.eclipse.as.core.prefs	2012-09-24 08:12:04 UTC (rev 43953)
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+org.jboss.ide.eclipse.as.core.singledeployable.deployableList=

Added: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/resources/projects/httpAnnot/WebContent/META-INF/MANIFEST.MF
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/resources/projects/httpAnnot/WebContent/META-INF/MANIFEST.MF	                        (rev 0)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/resources/projects/httpAnnot/WebContent/META-INF/MANIFEST.MF	2012-09-24 08:12:04 UTC (rev 43953)
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Class-Path: 
+

Added: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/resources/projects/httpAnnot/src/test/MyAnnot.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/resources/projects/httpAnnot/src/test/MyAnnot.java	                        (rev 0)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/resources/projects/httpAnnot/src/test/MyAnnot.java	2012-09-24 08:12:04 UTC (rev 43953)
@@ -0,0 +1,8 @@
+package test;
+
+import javax.ws.rs.HttpMethod;
+
+ at HttpMethod(value = "METHOD")
+public @interface MyAnnot {
+
+}

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 06:16:26 UTC (rev 43952)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/WSAllBotTests.java	2012-09-24 08:12:04 UTC (rev 43953)
@@ -11,6 +11,7 @@
 package org.jboss.tools.ws.ui.bot.test;
 
 import org.jboss.tools.ui.bot.ext.RequirementAwareSuite;
+import org.jboss.tools.ws.ui.bot.test.annotation.HTTPMethodAnnotationQuickFixTest;
 import org.jboss.tools.ws.ui.bot.test.integration.JAXRSToolingIntegrationTest;
 import org.jboss.tools.ws.ui.bot.test.integration.SOAPWSToolingIntegrationTest;
 import org.jboss.tools.ws.ui.bot.test.rest.DefaultValueAnnotationSupportTest;
@@ -59,6 +60,7 @@
 //	WSTesterPromptValuesSupportTest.class, // not implemented yet
 	ApplicationPathAnnotationTest.class,
 	JaxRsValidatorTest.class,
+	HTTPMethodAnnotationQuickFixTest.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/annotation/HTTPMethodAnnotationQuickFixTest.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/annotation/HTTPMethodAnnotationQuickFixTest.java	                        (rev 0)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/annotation/HTTPMethodAnnotationQuickFixTest.java	2012-09-24 08:12:04 UTC (rev 43953)
@@ -0,0 +1,85 @@
+package org.jboss.tools.ws.ui.bot.test.annotation;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.equalTo;
+
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEclipseEditor;
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
+import org.jboss.tools.ui.bot.ext.config.Annotations.Require;
+import org.jboss.tools.ui.bot.ext.config.Annotations.Server;
+import org.jboss.tools.ui.bot.ext.config.Annotations.ServerState;
+import org.jboss.tools.ui.bot.ext.parts.QuickFixBot;
+import org.jboss.tools.ui.bot.ext.parts.SWTBotEditorExt;
+import org.jboss.tools.ui.bot.ext.view.ProblemsView;
+import org.jboss.tools.ws.ui.bot.test.WSTestBase;
+import org.junit.Test;
+
+/**
+ * 
+ * @author jjankovi
+ *
+ */
+ at Require(server = @Server(state = ServerState.NotRunning), perspective = "Java EE")
+public class HTTPMethodAnnotationQuickFixTest extends WSTestBase {
+
+	@Override
+	protected String getWsProjectName() {
+		return "httpAnnot";
+	}
+	
+	@Override
+	public void setup() {
+		importWSTestProject(getWsProjectName());
+	}
+	
+	@Override
+	public void cleanup() {
+		projectExplorer.deleteAllProjects();
+	}
+	
+	@Test
+	public void testQuickFixes() {
+		
+		/* workaround for JBIDE-12690 */
+		jbide12680Workaround(getWsProjectName(), "src", "test", "MyAnnot.java");
+		
+		/* assert that there are two JAX-RS errors */
+		assertThat(errorsByType("JAX-RS Problem").length, equalTo(2));
+
+		/* get quickfix bot for MyAnnot annotation */
+		QuickFixBot bot = quickFixBot();
+		
+		/* check that there are quick fixes for both required annotations */
+		bot.checkQuickFix("Add @Target annotation on type MyAnnot", false);
+		bot.checkQuickFix("Add @Retention annotation on type MyAnnot", false);
+		
+	}
+	
+	private void jbide12680Workaround(String projectName, String... path) {
+		SWTBotEditor editor = packageExplorer.openFile(projectName, path);
+		SWTBotEclipseEditor eclipseEditor = editor.toTextEditor();
+		eclipseEditor.insertText(" ");
+		eclipseEditor.save();
+	}
+
+	private QuickFixBot quickFixBot() {
+		SWTBotEditorExt editor = new SWTBotEditorExt(bot.activeEditor().getReference(), bot);
+		SWTBotEclipseEditor eclipseEditor = editor.toTextEditor();
+		int lineIndex = 0;
+		for (String line : eclipseEditor.getLines()) {
+			if (line.contains("@Http")) {
+				 break;
+			}
+			lineIndex++;
+		}
+		eclipseEditor.navigateTo(lineIndex, 0);
+		return new QuickFixBot(editor);
+	}
+
+	private SWTBotTreeItem[] errorsByType(String problemType) {
+		return ProblemsView.
+				getFilteredErrorsTreeItems(bot, null, null, null, problemType);
+	}
+	
+}



More information about the jbosstools-commits mailing list