Author: jjankovi
Date: 2012-10-02 08:25:19 -0400 (Tue, 02 Oct 2012)
New Revision: 44213
Added:
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/validation/ApplicationValidationTest.java
Removed:
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/validation/ApplicationPathAnnotationTest.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/RESTfulHelper.java
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/RESTfulTestBase.java
Log:
new tests implemented + useful method added into test base class
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-10-02
12:21:06 UTC (rev 44212)
+++
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/WSAllBotTests.java 2012-10-02
12:25:19 UTC (rev 44213)
@@ -20,7 +20,7 @@
import org.jboss.tools.ws.ui.bot.test.rest.QueryAnnotationSupportTest;
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.ApplicationValidationTest;
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;
@@ -58,7 +58,7 @@
JAXRSToolingIntegrationTest.class,
SOAPWSToolingIntegrationTest.class,
// WSTesterPromptValuesSupportTest.class, // not implemented yet
- ApplicationPathAnnotationTest.class,
+ ApplicationValidationTest.class,
JaxRsValidatorTest.class,
HTTPMethodAnnotationQuickFixTest.class,
BottomUpWSTest.class,
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-10-02
12:21:06 UTC (rev 44212)
+++
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/RESTfulHelper.java 2012-10-02
12:25:19 UTC (rev 44213)
@@ -50,12 +50,12 @@
ENABLE, DISABLE;
}
- private SWTBotTreeItem[] getRESTValidationErrors(String wsProjectName, String
description) {
+ public SWTBotTreeItem[] getRESTValidationErrors(String wsProjectName, String
description) {
return ProblemsView.getFilteredErrorsTreeItems(bot,
description, "/" + wsProjectName, null, "JAX-RS Problem");
}
- private SWTBotTreeItem[] getRESTValidationWarnings(String wsProjectName,
+ public SWTBotTreeItem[] getRESTValidationWarnings(String wsProjectName,
String description) {
return ProblemsView.getFilteredWarningsTreeItems(bot,
description, "/" + wsProjectName, null, "JAX-RS Problem");
@@ -65,10 +65,6 @@
return getRESTValidationErrors(wsProjectName, PATH_PARAM_VALID_ERROR);
}
- public SWTBotTreeItem[] getApplicationAnnotationValidationWarnings(String wsProjectName)
{
- return getRESTValidationWarnings(wsProjectName, null);
- }
-
public void enableRESTValidation() {
modifyRESTValidation(ConfigureOption.ENABLE);
}
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-10-02
12:21:06 UTC (rev 44212)
+++
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/RESTfulTestBase.java 2012-10-02
12:25:19 UTC (rev 44213)
@@ -153,10 +153,16 @@
protected void assertCountOfApplicationAnnotationValidationWarnings(String projectName,
int expectedCount) {
- int foundWarnings =
restfulHelper.getApplicationAnnotationValidationWarnings(projectName).length;
- assertCountOfValidationError(expectedCount, foundWarnings);
+ int foundProblems = restfulHelper.getRESTValidationWarnings(projectName, null).length;
+ assertCountOfValidationError(expectedCount, foundProblems);
}
+ protected void assertCountOfApplicationAnnotationValidationErrors(String projectName,
+ int expectedCount) {
+ int foundProblems = restfulHelper.getRESTValidationErrors(projectName, null).length;
+ assertCountOfValidationError(expectedCount, foundProblems);
+ }
+
private void assertCountOfValidationError(int expectedCount, int foundCount) {
assertTrue("Expected count of validation errors: " + expectedCount
+ ". Count of found validation errors: " + foundCount,
Deleted:
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/validation/ApplicationPathAnnotationTest.java
===================================================================
---
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/validation/ApplicationPathAnnotationTest.java 2012-10-02
12:21:06 UTC (rev 44212)
+++
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/validation/ApplicationPathAnnotationTest.java 2012-10-02
12:25:19 UTC (rev 44213)
@@ -1,79 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010-2012 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.rest.validation;
-
-import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEclipseEditor;
-import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
-import org.jboss.tools.ws.ui.bot.test.rest.RESTfulTestBase;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- *
- * @author jjankovi
- *
- */
-public class ApplicationPathAnnotationTest extends RESTfulTestBase {
-
-
- @Before
- public void setup() {
-
- }
-
- @Test
- public void testMultipleApplicationClasses() {
-
- /* prepare project */
- importRestWSProject("app1");
-
- /* workaround for JBIDE-12690
- jbide12680Workaround("app1", "src", "test",
"App.java"); */
-
- /* test validation error */
- assertCountOfApplicationAnnotationValidationWarnings("app1", 2);
- }
-
- @Test
- public void testWebXmlAndApplicationClassWithWarning() {
-
- /* prepare project */
- importRestWSProject("app2");
-
- /* workaround for JBIDE-12690
- jbide12680Workaround("app2", "src", "test",
"App.java"); */
-
- /* test validation error */
- assertCountOfApplicationAnnotationValidationWarnings("app2", 2);
- }
-
- @Test
- public void testWebXmlAndApplicationClassWithoutWarning() {
-
- /* prepare project */
- importRestWSProject("app3");
-
- /* workaround for JBIDE-12690
- jbide12680Workaround("app3", "src", "test",
"App.java"); */
-
- /* test validation error */
- assertCountOfApplicationAnnotationValidationWarnings("app3", 0);
- }
-
- private void jbide12680Workaround(String projectName, String... path) {
- SWTBotEditor editor = packageExplorer.openFile(projectName, path);
- SWTBotEclipseEditor eclipseEditor = editor.toTextEditor();
- eclipseEditor.insertText(" ");
- eclipseEditor.save();
- }
-
-}
Added:
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/validation/ApplicationValidationTest.java
===================================================================
---
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/validation/ApplicationValidationTest.java
(rev 0)
+++
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/validation/ApplicationValidationTest.java 2012-10-02
12:25:19 UTC (rev 44213)
@@ -0,0 +1,119 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2012 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.rest.validation;
+
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEclipseEditor;
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
+import org.jboss.tools.ws.ui.bot.test.rest.RESTfulTestBase;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ *
+ * @author jjankovi
+ *
+ */
+public class ApplicationValidationTest extends RESTfulTestBase {
+
+
+ @Before
+ public void setup() {
+
+ }
+
+ @Test
+ public void testMultipleApplicationClasses() {
+
+ /* prepare project */
+ importRestWSProject("app1");
+
+ /* workaround for JBIDE-12690 */
+ jbide12680Workaround("app1", "src", "test",
"App.java");
+
+ /* test validation error */
+ assertCountOfApplicationAnnotationValidationWarnings("app1", 2);
+ }
+
+ @Test
+ public void testWebXmlAndApplicationClassWithWarning() {
+
+ /* prepare project */
+ importRestWSProject("app2");
+
+ /* workaround for JBIDE-12690 */
+ jbide12680Workaround("app2", "src", "test",
"App.java");
+
+ /* test validation error */
+ assertCountOfApplicationAnnotationValidationWarnings("app2", 2);
+ }
+
+ @Test
+ public void testWebXmlAndApplicationClassWithoutWarning() {
+
+ /* prepare project */
+ importRestWSProject("app3");
+
+ /* workaround for JBIDE-12690 */
+ jbide12680Workaround("app3", "src", "test",
"App.java");
+
+ /* test validation error */
+ assertCountOfApplicationAnnotationValidationWarnings("app3", 0);
+ }
+
+ @Test
+ public void testNotExtendingApplicationClass() {
+
+ /* prepare project */
+ importRestWSProject("app4");
+
+ /* workaround for JBIDE-12690 */
+ jbide12680Workaround("app4", "src", "test",
"App.java");
+
+ /* test validation error */
+ assertCountOfApplicationAnnotationValidationErrors("app4", 1);
+
+ /* fix class - should be no error */
+ resourceHelper.replaceInEditor(editorForClass("app4", "src",
+ "test", "App.java").toTextEditor(),
"@ApplicationPath(\"/rest\")", "", true);
+
+ /* test validation error */
+ assertCountOfApplicationAnnotationValidationErrors("app4", 0);
+ }
+
+ @Test
+ public void testApplicationClassWithoutPath() {
+
+ /* prepare project */
+ importRestWSProject("app5");
+
+ /* workaround for JBIDE-12690 */
+ jbide12680Workaround("app5", "src", "test",
"App.java");
+
+ /* test validation error */
+ assertCountOfApplicationAnnotationValidationErrors("app5", 1);
+
+ /* fix class - should be no error */
+ resourceHelper.replaceInEditor(editorForClass("app5", "src",
+ "test", "App.java").toTextEditor(), "extends
Application", "", true);
+
+ /* test validation error */
+ assertCountOfApplicationAnnotationValidationErrors("app5", 0);
+ }
+
+ private void jbide12680Workaround(String projectName, String... path) {
+ SWTBotEditor editor = packageExplorer.openFile(projectName, path);
+ SWTBotEclipseEditor eclipseEditor = editor.toTextEditor();
+ eclipseEditor.insertText(" ");
+ eclipseEditor.save();
+ }
+
+}