Author: jjankovi
Date: 2012-06-05 03:56:43 -0400 (Tue, 05 Jun 2012)
New Revision: 41709
Added:
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/DefaultValueAnnotationSupportTest.java
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/MatrixAnnotationSupportTest.java
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/QueryAnnotationSupportTest.java
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/explorer/RESTfulExplorerTest.java
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/uiutils/views/AnnotationPropertiesView.java
Removed:
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/DefaultValueParamSupportTest.java
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/MatrixParamSupportTest.java
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/QueryParamSupportTest.java
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/explorer/RESTfulSupportTest.java
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/uiutils/views/AnnotationProperties.java
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/utils/NodeContextUtil.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/WSTestBase.java
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/PathAnnotationSupportTest.java
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/RESTFulAnnotations.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/todo.txt
Log:
refactoring of ws bot tests
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-06-05
07:54:21 UTC (rev 41708)
+++
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/WSAllBotTests.java 2012-06-05
07:56:43 UTC (rev 41709)
@@ -12,12 +12,12 @@
import org.jboss.tools.ui.bot.ext.RequirementAwareSuite;
import org.jboss.tools.ws.ui.bot.test.annotation.AnnotationPropertiesTest;
-import org.jboss.tools.ws.ui.bot.test.rest.DefaultValueParamSupportTest;
-import org.jboss.tools.ws.ui.bot.test.rest.MatrixParamSupportTest;
+import org.jboss.tools.ws.ui.bot.test.rest.DefaultValueAnnotationSupportTest;
+import org.jboss.tools.ws.ui.bot.test.rest.MatrixAnnotationSupportTest;
import org.jboss.tools.ws.ui.bot.test.rest.PathAnnotationSupportTest;
-import org.jboss.tools.ws.ui.bot.test.rest.QueryParamSupportTest;
+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.RESTfulSupportTest;
+import org.jboss.tools.ws.ui.bot.test.rest.explorer.RESTfulExplorerTest;
import org.jboss.tools.ws.ui.bot.test.rest.validation.ApplicationPathParameterTest;
import org.jboss.tools.ws.ui.bot.test.rest.validation.RESTfulValidationTest;
import org.jboss.tools.ws.ui.bot.test.sample.test.SampleRESTWebServiceTest;
@@ -59,11 +59,11 @@
SimpleSoapWebServiceTest.class,
SimpleRESTWebServiceTest.class,
AnnotationPropertiesTest.class,
- RESTfulSupportTest.class,
+ RESTfulExplorerTest.class,
PathAnnotationSupportTest.class,
- QueryParamSupportTest.class,
- DefaultValueParamSupportTest.class,
- MatrixParamSupportTest.class,
+ QueryAnnotationSupportTest.class,
+ MatrixAnnotationSupportTest.class,
+ DefaultValueAnnotationSupportTest.class,
RESTfulValidationTest.class,
RESTfulCompletionTest.class,
ApplicationPathParameterTest.class,
Modified:
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/WSTestBase.java
===================================================================
---
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/WSTestBase.java 2012-06-05
07:54:21 UTC (rev 41708)
+++
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/WSTestBase.java 2012-06-05
07:56:43 UTC (rev 41709)
@@ -32,33 +32,33 @@
/**
* Basic test base for all web service bot tests
+ *
* @author jjankovi
- *
+ *
*/
-@Require(perspective="Java EE",
- server=(a)Server(type=ServerType.JbossAS,
- version = "7.1", operator = ">="))
-//@Require(perspective="Java EE",
-// server=(a)Server(type=ServerType.EAP,
-// version = "5.1", operator = ">="))
+@Require(perspective = "Java EE", server = @Server(type = ServerType.JbossAS,
version = "7.1", operator = ">="))
+// @Require(perspective="Java EE",
+// server=(a)Server(type=ServerType.EAP,
+// version = "5.1", operator = ">="))
@RunWith(RequirementAwareSuite.class)
@SuiteClasses({ WSAllBotTests.class })
public class WSTestBase extends SWTTestExt {
private Slider_Level level;
private String wsProjectName = null;
-
+
private static final String SOAP_REQUEST_TEMPLATE = "<?xml
version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"
?>"
+ "<soap:Envelope
xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\""
+ "
xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""
+ "
xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">"
+ "<soap:Body>{0}</soap:Body>" +
"</soap:Envelope>";
- protected static final Logger LOGGER = Logger
- .getLogger(WSAllBotTests.class.getName());
-
- protected final String LINE_SEPARATOR = System.getProperty("line.separator");
-
+ protected static final Logger LOGGER = Logger.getLogger(WSAllBotTests.class
+ .getName());
+
+ protected final String LINE_SEPARATOR = System
+ .getProperty("line.separator");
+
protected static ResourceHelper resourceHelper = new ResourceHelper();
protected static ProjectHelper projectHelper = new ProjectHelper();
protected static DeploymentHelper deploymentHelper = new DeploymentHelper();
@@ -69,7 +69,7 @@
if (getEarProjectName() != null && !projectExists(getEarProjectName())) {
projectHelper.createEARProject(getEarProjectName());
if (!projectExists(getWsProjectName())) {
- projectHelper.createProjectForEAR(getWsProjectName(),
+ projectHelper.createProjectForEAR(getWsProjectName(),
getEarProjectName());
}
}
@@ -82,15 +82,15 @@
public void cleanup() {
servers.removeAllProjectsFromServer();
}
-
+
protected boolean projectExists(String name) {
return projectExplorer.existsResource(name);
}
-
+
protected Slider_Level getLevel() {
return level;
}
-
+
protected void setLevel(Slider_Level level) {
this.level = level;
}
@@ -118,12 +118,16 @@
public static String getSoapRequest(String body) {
return MessageFormat.format(SOAP_REQUEST_TEMPLATE, body);
}
-
+
+ protected void importWSTestProject(String projectName) {
+ String location = "/resources/projects/" + projectName;
+ importWSTestProject(location, projectName);
+ }
+
protected void importWSTestProject(String projectLocation, String dir) {
ImportHelper.importProject(projectLocation, dir, Activator.PLUGIN_ID);
-
- eclipse.addConfiguredRuntimeIntoProject(getWsProjectName(),
- configuredState.getServer().name);
+
+ eclipse.addConfiguredRuntimeIntoProject(dir, configuredState.getServer().name);
}
}
Added:
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/DefaultValueAnnotationSupportTest.java
===================================================================
---
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/DefaultValueAnnotationSupportTest.java
(rev 0)
+++
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/DefaultValueAnnotationSupportTest.java 2012-06-05
07:56:43 UTC (rev 41709)
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2007-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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.ws.ui.bot.test.rest;
+
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
+import org.jboss.tools.ws.ui.bot.test.ti.wizard.RESTFullExplorerWizard;
+import org.junit.Test;
+
+public class DefaultValueAnnotationSupportTest extends RESTfulTestBase {
+
+ private String projectName = "default1";
+
+ @Override
+ protected String getWsProjectName() {
+ return projectName;
+ }
+
+ @Override
+ public void cleanup() {
+ projectExplorer.deleteAllProjects();
+ }
+
+ @Test
+ public void testQueryParamDefaultValue() {
+
+ String queryParam = "param";
+ String defaultValue = "abc";
+ String queryParamType = "java.lang.String";
+
+ /* prepare project */
+ importRestWSProject(getWsProjectName());
+
+ /* get JAX-RS REST explorer for the project */
+ restfulWizard = new RESTFullExplorerWizard(getWsProjectName());
+ SWTBotTreeItem[] restServices = restfulWizard.getAllRestServices();
+
+ /* test JAX-RS REST explorer */
+ assertCountOfRESTServices(restServices, 1);
+ assertExpectedPathOfService(restServices[0],
+ "/rest?" + queryParam + "={" + queryParam + ":" +
+ queryParamType + "=" + defaultValue + "}");
+
+ }
+
+ @Test
+ public void testPathParamDefaultValue() {
+
+ }
+
+ @Test
+ public void testMatrixParamDefaultValue() {
+
+ }
+
+}
Deleted:
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/DefaultValueParamSupportTest.java
===================================================================
---
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/DefaultValueParamSupportTest.java 2012-06-05
07:54:21 UTC (rev 41708)
+++
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/DefaultValueParamSupportTest.java 2012-06-05
07:56:43 UTC (rev 41709)
@@ -1,92 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007-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
- *
- * Contributor:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-
-package org.jboss.tools.ws.ui.bot.test.rest;
-
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
-import org.jboss.tools.ui.bot.ext.Timing;
-import org.jboss.tools.ws.ui.bot.test.ti.wizard.RESTFullExplorerWizard;
-import org.junit.Test;
-
-public class DefaultValueParamSupportTest extends RESTfulTestBase {
-
- private RESTFullExplorerWizard restfulWizard = null;
-
- private String projectName = "restEmpty";
-
- private final String DEFAULT_VALUE_RESOURCE =
"/resources/restful/DefaultValue.java.ws";
-
- @Override
- protected String getWsProjectName() {
- return projectName;
- }
-
- @Override
- public void cleanup() {
- bot.activeEditor().toTextEditor().save();
- }
-
- @Test
- public void testDefaultValueSupport() {
-
- String queryParam = "param";
- String defaultValue = "abc";
- String defaultValueNew = "cba";
- String queryParamType = "java.lang.String";
-
- /** test showing default DefaultValue in RESTful explorer **/
- packageExplorer.openFile(getWsProjectName(), "src",
- getWsPackage(), getWsName() + ".java").toTextEditor();
- resourceHelper.copyResourceToClassWithSave(bot.editorByTitle(getWsName() +
".java"),
- DefaultValueParamSupportTest.class.getResourceAsStream(DEFAULT_VALUE_RESOURCE),
- false, false, getWsPackage(), getWsName(), queryParam, defaultValue,
queryParamType);
- bot.sleep(Timing.time2S());
-
- restfulWizard = new RESTFullExplorerWizard(getWsProjectName());
- SWTBotTreeItem[] restServices = restfulWizard.getAllRestServices();
-
- assertTrue("There should be one RESTful web service instead of " +
- restServices.length, restServices.length == 1);
- String path = restfulWizard.getPathForRestFulService(restServices[0]);
- assertEquals("/rest?" + queryParam + "={" + queryParam +
":" +
- queryParamType + "=" + defaultValue + "}", path);
-
- /** test showing edited DefaultValue value in RESTful explorer **/
- resourceHelper.replaceInEditor(bot.activeEditor().toTextEditor(),
- defaultValue, defaultValueNew, false);
- bot.sleep(Timing.time2S());
-
- restfulWizard = new RESTFullExplorerWizard(getWsProjectName());
- restServices = restfulWizard.getAllRestServices();
-
- assertTrue("There should be one RESTful web service instead of " +
- restServices.length, restServices.length == 1);
- path = restfulWizard.getPathForRestFulService(restServices[0]);
- assertEquals("/rest?" + queryParam + "={" + queryParam +
":" +
- queryParamType + "=" + defaultValueNew + "}", path);
-
- /** test showing deleted DefaultValue value in RESTful explorer **/
- resourceHelper.replaceInEditor(bot.activeEditor().toTextEditor(),
- "@DefaultValue(\"" + defaultValueNew + "\")",
"", false);
- bot.sleep(Timing.time2S());
-
- restfulWizard = new RESTFullExplorerWizard(getWsProjectName());
- restServices = restfulWizard.getAllRestServices();
-
- assertTrue("There should be one RESTful web service instead of " +
- restServices.length, restServices.length == 1);
- path = restfulWizard.getPathForRestFulService(restServices[0]);
- assertEquals("/rest?" + queryParam + "={" + queryParam +
":" +
- queryParamType + "}", path);
-
- }
-
-}
Added:
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/MatrixAnnotationSupportTest.java
===================================================================
---
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/MatrixAnnotationSupportTest.java
(rev 0)
+++
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/MatrixAnnotationSupportTest.java 2012-06-05
07:56:43 UTC (rev 41709)
@@ -0,0 +1,98 @@
+/*******************************************************************************
+ * Copyright (c) 2007-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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.ws.ui.bot.test.rest;
+
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
+import org.jboss.tools.ui.bot.ext.Timing;
+import org.jboss.tools.ws.ui.bot.test.ti.wizard.RESTFullExplorerWizard;
+import org.junit.Test;
+
+public class MatrixAnnotationSupportTest extends RESTfulTestBase {
+
+ private String projectName = "matrix1";
+ private String matrixParam1 = "author";
+ private String matrixParam2 = "country";
+ private String matrixParamNew = "library";
+ private String matrixParamType1 = "java.lang.String";
+ private String matrixParamType2 = "java.lang.Integer";
+ private String matrixParamTypeNew = "java.lang.Long";
+
+ @Override
+ protected String getWsProjectName() {
+ return projectName;
+ }
+
+ @Override
+ public void cleanup() {
+ projectExplorer.deleteAllProjects();
+ }
+
+ @Test
+ public void testMatrixParamSupport() {
+
+ /* prepare project */
+ importRestWSProject("matrix1");
+
+ /* get JAX-RS REST explorer for the project */
+ restfulWizard = new RESTFullExplorerWizard("matrix1");
+ SWTBotTreeItem[] restServices = restfulWizard.getAllRestServices();
+
+ /* test JAX-RS REST explorer */
+ assertCountOfRESTServices(restServices, 1);
+ assertExpectedPathOfService(restServices[0],
+ "/rest;" + matrixParam1 + "={" + matrixParamType1 +
"};"
+ + matrixParam2 + "={" + matrixParamType2 + "}");
+
+ }
+
+ @Test
+ public void testEditingMatrixParam() {
+
+ /* prepare project */
+ importRestWSProject("matrix1");
+ resourceHelper.replaceInEditor(editorForClass("matrix1", "src",
+ "org.rest.test", "RestService.java").toTextEditor(),
+ matrixParam1, matrixParamNew, true);
+ bot.sleep(Timing.time2S());
+
+ /* get JAX-RS REST explorer for the project */
+ restfulWizard = new RESTFullExplorerWizard("matrix1");
+ SWTBotTreeItem[] restServices = restfulWizard.getAllRestServices();
+
+ /* test JAX-RS REST explorer */
+ assertCountOfRESTServices(restServices, 1);
+ assertExpectedPathOfService(restServices[0],
+ "/rest;" + matrixParamNew + "={" + matrixParamType1 +
"};"
+ + matrixParam2 + "={" + matrixParamType2 + "}");
+ }
+
+ @Test
+ public void testEditingTypeOfMatrixParam() {
+
+ /* prepare project */
+ importRestWSProject("matrix1");
+ resourceHelper.replaceInEditor(editorForClass("matrix1", "src",
+ "org.rest.test", "RestService.java").toTextEditor(),
+ matrixParamType1, matrixParamTypeNew, true);
+ bot.sleep(Timing.time2S());
+
+ /* get JAX-RS REST explorer for the project */
+ restfulWizard = new RESTFullExplorerWizard("matrix1");
+ SWTBotTreeItem[] restServices = restfulWizard.getAllRestServices();
+
+ /* test JAX-RS REST explorer */
+ assertCountOfRESTServices(restServices, 1);
+ assertExpectedPathOfService(restServices[0],
+ "/rest;" + matrixParam1 + "={" + matrixParamTypeNew +
"};"
+ + matrixParam2 + "={" + matrixParamType2 + "}");
+ }
+}
Deleted:
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/MatrixParamSupportTest.java
===================================================================
---
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/MatrixParamSupportTest.java 2012-06-05
07:54:21 UTC (rev 41708)
+++
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/MatrixParamSupportTest.java 2012-06-05
07:56:43 UTC (rev 41709)
@@ -1,142 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007-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
- *
- * Contributor:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-
-package org.jboss.tools.ws.ui.bot.test.rest;
-
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
-import org.jboss.tools.ui.bot.ext.Timing;
-import org.jboss.tools.ws.ui.bot.test.ti.wizard.RESTFullExplorerWizard;
-import org.junit.Test;
-
-public class MatrixParamSupportTest extends RESTfulTestBase {
-
- private RESTFullExplorerWizard restfulWizard = null;
- private String projectName = "restEmpty";
- private final String MATRIX_PARAM_RESOURCE =
"/resources/restful/MatrixParam.java.ws";
-
- private String matrixParam1 = "author";
- private String matrixParam2 = "country";
- private String matrixParamNew = "library";
- private String matrixParamType1 = "java.lang.String";
- private String matrixParamType2 = "java.lang.Integer";
- private String matrixParamTypeNew = "java.lang.Long";
-
- @Override
- protected String getWsProjectName() {
- return projectName;
- }
-
- @Override
- public void cleanup() {
- bot.activeEditor().toTextEditor().save();
- }
-
- @Test
- public void testMatrixParamSupport() {
-
- prepareWSResource(MATRIX_PARAM_RESOURCE, getWsPackage(), getWsName(),
- matrixParam1, matrixParamType1, matrixParam2, matrixParamType2);
-
- restfulWizard = new RESTFullExplorerWizard(getWsProjectName());
- SWTBotTreeItem[] restServices = restfulWizard.getAllRestServices();
-
- assertTrue("There should be one RESTful web service instead of "
- + restServices.length, restServices.length == 1);
- String path = restfulWizard.getPathForRestFulService(restServices[0]);
- assertEquals("/rest;" + matrixParam1 + "={" + matrixParamType1 +
"};"
- + matrixParam2 + "={" + matrixParamType2 + "}", path);
-
- }
-
- @Test
- public void testEditingMatrixParam() {
-
- prepareWSResource(MATRIX_PARAM_RESOURCE, getWsPackage(), getWsName(),
- matrixParam1, matrixParamType1, matrixParam2, matrixParamType2);
-
- resourceHelper.replaceInEditor(bot.activeEditor().toTextEditor(),
- matrixParam1, matrixParamNew, false);
- bot.sleep(Timing.time2S());
-
- restfulWizard = new RESTFullExplorerWizard(getWsProjectName());
- SWTBotTreeItem[] restServices = restfulWizard.getAllRestServices();
-
- assertTrue("There should be one RESTful web service instead of "
- + restServices.length, restServices.length == 1);
- String path = restfulWizard.getPathForRestFulService(restServices[0]);
- assertEquals("/rest;" + matrixParamNew + "={" + matrixParamType1 +
"};"
- + matrixParam2 + "={" + matrixParamType2 + "}", path);
-
- resourceHelper.replaceInEditor(bot.activeEditor().toTextEditor(),
- matrixParamNew, matrixParam1, false);
- resourceHelper.replaceInEditor(bot.activeEditor().toTextEditor(),
- matrixParam2, matrixParamNew, false);
- bot.sleep(Timing.time2S());
- restfulWizard = new RESTFullExplorerWizard(getWsProjectName());
- restServices = restfulWizard.getAllRestServices();
-
- assertTrue("There should be one RESTful web service instead of "
- + restServices.length, restServices.length == 1);
- path = restfulWizard.getPathForRestFulService(restServices[0]);
- assertEquals("/rest;" + matrixParam1 + "={" + matrixParamType1 +
"};"
- + matrixParamNew + "={" + matrixParamType2 + "}", path);
-
- }
-
- @Test
- public void testEditingTypeOfMatrixParam() {
-
- prepareWSResource(MATRIX_PARAM_RESOURCE, getWsPackage(), getWsName(),
- matrixParam1, matrixParamType1, matrixParam2, matrixParamType2);
-
- resourceHelper.replaceInEditor(bot.activeEditor().toTextEditor(),
- matrixParamType1, matrixParamTypeNew, false);
- bot.sleep(Timing.time2S());
-
- restfulWizard = new RESTFullExplorerWizard(getWsProjectName());
- SWTBotTreeItem[] restServices = restfulWizard.getAllRestServices();
-
- assertTrue("There should be one RESTful web service instead of " +
- restServices.length, restServices.length == 1);
- String path = restfulWizard.getPathForRestFulService(restServices[0]);
- assertEquals("/rest;" + matrixParam1 + "={" + matrixParamTypeNew +
"};"
- + matrixParam2 + "={" + matrixParamType2 + "}", path);
-
-
- resourceHelper.replaceInEditor(bot.activeEditor().toTextEditor(),
- matrixParamTypeNew, matrixParamType1, false);
- resourceHelper.replaceInEditor(bot.activeEditor().toTextEditor(),
- matrixParamType2, matrixParamTypeNew, false);
- bot.sleep(Timing.time2S());
- restfulWizard = new RESTFullExplorerWizard(getWsProjectName());
- restServices = restfulWizard.getAllRestServices();
-
- assertTrue("There should be one RESTful web service instead of " +
- restServices.length, restServices.length == 1);
- path = restfulWizard.getPathForRestFulService(restServices[0]);
- assertEquals("/rest;" + matrixParam1 + "={" + matrixParamType1 +
"};"
- + matrixParam2 + "={" + matrixParamTypeNew + "}", path);
-
- }
-
- private void prepareWSResource(String streamPath, Object... parameters) {
-
- packageExplorer.openFile(getWsProjectName(), "src", getWsPackage(),
- getWsName() + ".java").toTextEditor();
- resourceHelper.copyResourceToClassWithSave(
- bot.editorByTitle(getWsName() + ".java"),
- QueryParamSupportTest.class.getResourceAsStream(streamPath),
- false, false, parameters);
- bot.sleep(Timing.time2S());
-
- }
-
-}
Modified:
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/PathAnnotationSupportTest.java
===================================================================
---
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/PathAnnotationSupportTest.java 2012-06-05
07:54:21 UTC (rev 41708)
+++
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/PathAnnotationSupportTest.java 2012-06-05
07:56:43 UTC (rev 41709)
@@ -11,9 +11,11 @@
package org.jboss.tools.ws.ui.bot.test.rest;
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEclipseEditor;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
import org.jboss.tools.ui.bot.ext.Timing;
import org.jboss.tools.ws.ui.bot.test.ti.wizard.RESTFullExplorerWizard;
+import org.junit.After;
import org.junit.Test;
/**
@@ -24,135 +26,107 @@
*/
public class PathAnnotationSupportTest extends RESTfulTestBase {
- private RESTFullExplorerWizard restfulWizard = null;
-
- private String restEmptyProjectName = "restEmpty";
-
- @Override
- protected String getWsProjectName() {
- return restEmptyProjectName;
+ @After
+ public void cleanWorkspace() {
+ projectExplorer.deleteAllProjects();
}
- @Override
- public void cleanup() {
- bot.activeEditor().toTextEditor().save();
- }
-
@Test
public void testAddingSimpleRESTMethods() {
- prepareWSResource(BASIC_WS_RESOURCE);
+ /* import project */
+ importRestWSProject("restBasic");
- restfulWizard = new RESTFullExplorerWizard(getWsProjectName());
+ /* get JAX-RS REST explorer for the project */
+ restfulWizard = new RESTFullExplorerWizard("restBasic");
SWTBotTreeItem[] restServices = restfulWizard.getAllRestServices();
- assertTrue(restServices.length + " RESTful services was found instead of 4.",
- restServices.length == 4);
- assertTrue("All RESTful services (GET, DELETE, POST, PUT) should be present but
they are not",
- allRestServicesArePresent(restServices));
-
- for (SWTBotTreeItem restService : restServices) {
- assertTrue(restfulWizard.getPathForRestFulService(restService).equals("/rest"));
- assertTrue(restfulWizard.getConsumesInfo(restService).equals("*/*"));
- assertTrue(restfulWizard.getProducesInfo(restService).equals("*/*"));
- }
+ /* test JAX-RS REST explorer */
+ assertCountOfRESTServices(restServices, 4);
+ assertAllRESTServicesInExplorer(restServices);
+ assertPathOfAllRESTWebServices(restServices, "/rest");
}
-
+
@Test
public void testAddingAdvancedRESTMethods() {
- prepareWSResource(ADVANCED_WS_RESOURCE);
+ /* import project */
+ importRestWSProject("restAdvanced");
- restfulWizard = new RESTFullExplorerWizard(getWsProjectName());
+ /* get JAX-RS REST explorer for the project */
+ restfulWizard = new RESTFullExplorerWizard("restAdvanced");
SWTBotTreeItem[] restServices = restfulWizard.getAllRestServices();
- assertTrue(restServices.length + " RESTful services was found instead of
4.",
- restServices.length == 4);
- assertTrue("All RESTful services (GET, DELETE, POST, PUT) should be present but
they are not",
- allRestServicesArePresent(restServices));
-
- for (SWTBotTreeItem restService : restServices) {
- if
(restfulWizard.getRestServiceName(restService).equals(RESTFulAnnotations.GET.getLabel()))
{
- assertTrue(restfulWizard.getPathForRestFulService(restService).equals("/rest/{id}"));
- assertTrue(restfulWizard.getConsumesInfo(restService).equals("*/*"));
- assertTrue(restfulWizard.getProducesInfo(restService).equals("text/plain"));
- }
- if
(restfulWizard.getRestServiceName(restService).equals(RESTFulAnnotations.PUT.getLabel()))
{
- assertTrue(restfulWizard.getPathForRestFulService(restService).equals("/rest/put/{id}"));
- assertTrue(restfulWizard.getConsumesInfo(restService).equals("text/plain"));
- assertTrue(restfulWizard.getProducesInfo(restService).equals("*/*"));
- }
- if
(restfulWizard.getRestServiceName(restService).equals(RESTFulAnnotations.POST.getLabel()))
{
- assertTrue(restfulWizard.getPathForRestFulService(restService).equals("/rest/post/{id}"));
- assertTrue(restfulWizard.getConsumesInfo(restService).equals("text/plain"));
- assertTrue(restfulWizard.getProducesInfo(restService).equals("text/plain"));
- }
- if
(restfulWizard.getRestServiceName(restService).equals(RESTFulAnnotations.DELETE.getLabel()))
{
- assertTrue(restfulWizard.getPathForRestFulService(restService).equals("/rest/delete/{id}"));
- assertTrue(restfulWizard.getConsumesInfo(restService).equals("*/*"));
- assertTrue(restfulWizard.getProducesInfo(restService).equals("*/*"));
- }
- }
-
+ /* test JAX-RS REST explorer */
+ assertCountOfRESTServices(restServices, 4);
+ assertAllRESTServicesInExplorer(restServices);
+ testAdvancedRESTServices(restServices);
}
@Test
public void testEditingSimpleRESTMethods() {
- prepareWSResource(BASIC_WS_RESOURCE);
+ /* import project */
+ importRestWSProject("restBasic");
- restfulWizard = new RESTFullExplorerWizard(getWsProjectName());
- SWTBotTreeItem[] restServices = restfulWizard.getAllRestServices();
-
- assertTrue("All RESTful services (GET, DELETE, POST, PUT) should be present but
they are not",
- allRestServicesArePresent(restServices));
-
- packageExplorer.openFile(getWsProjectName(), "src",
- getWsPackage(), getWsName() + ".java").toTextEditor();
- resourceHelper.replaceInEditor(bot.activeEditor().toTextEditor(), "@DELETE",
"@GET", false);
-
+ /* replace @DELETE annotation to @GET annotation */
+ resourceHelper.replaceInEditor(editorForClass("restBasic", "src",
+ "org.rest.test", "RestService.java").toTextEditor(),
"@DELETE", "@GET", true);
bot.sleep(Timing.time2S());
- restfulWizard = new RESTFullExplorerWizard(getWsProjectName());
- restServices = restfulWizard.getAllRestServices();
- assertFalse("All RESTful services (GET, DELETE, POST, PUT) shouldnt be present but
they are",
- allRestServicesArePresent(restServices));
+ /* get JAX-RS REST explorer for the project */
+ restfulWizard = new RESTFullExplorerWizard("restBasic");
+ SWTBotTreeItem[] restServices = restfulWizard.getAllRestServices();
- for (SWTBotTreeItem restService : restServices) {
- if
(restfulWizard.getRestServiceName(restService).equals(RESTFulAnnotations.DELETE.getLabel()))
{
- fail("There should not be DELETE RESTful services");
- }
- }
+ /* test JAX-RS REST explorer */
+ assertNotAllRESTServicesInExplorer(restServices);
+ assertAbsenceOfRESTWebService(restServices,
+ RESTFulAnnotations.DELETE.getLabel());
}
@Test
public void testEditingAdvancedRESTMethods() {
- prepareWSResource(ADVANCED_WS_RESOURCE);
+ /* import project */
+ importRestWSProject("restAdvanced");
- restfulWizard = new RESTFullExplorerWizard(getWsProjectName());
- SWTBotTreeItem[] restServices = restfulWizard.getAllRestServices();
+ /* edit @DELETE annotation */
+ SWTBotEclipseEditor editor = editorForClass("restAdvanced", "src",
+ "org.rest.test", "RestService.java").toTextEditor();
+ resourceHelper.replaceInEditor(editor, "/delete/{id}",
+ "delete/edited/{id}", true);
+ resourceHelper.replaceInEditor(editor, "@DELETE", "@DELETE"
+ + LINE_SEPARATOR + "@Produces(\"text/plain\")", true);
+ bot.sleep(Timing.time2S());
- assertTrue(restServices.length > 0);
+ /* get JAX-RS REST explorer for the project */
+ restfulWizard = new RESTFullExplorerWizard("restAdvanced");
+ SWTBotTreeItem[] restServices = restfulWizard.getAllRestServices();
- for (SWTBotTreeItem restService : restServices) {
- if
(restfulWizard.getRestServiceName(restService).equals(RESTFulAnnotations.DELETE.getLabel()))
{
- assertTrue(restfulWizard.getPathForRestFulService(restService).equals("/rest/delete/{id}"));
- assertTrue(restfulWizard.getProducesInfo(restService).equals("*/*"));
- }
- }
+ /* test JAX-RS REST explorer */
+ testEditedDeleteRestWebResource(restServices);
+ }
+
+ @Test
+ public void testDeletingRESTMethods() {
- packageExplorer.openFile(getWsProjectName(), "src",
- getWsPackage(), getWsName() + ".java").toTextEditor();
- resourceHelper.replaceInEditor(bot.activeEditor().toTextEditor(),
- "/delete/{id}", "delete/edited/{id}", false);
- resourceHelper.replaceInEditor(bot.activeEditor().toTextEditor(), "@DELETE",
- "@DELETE" + LINE_SEPARATOR +
"@Produces(\"text/plain\")", false);
-
+ /* prepare project*/
+ importRestWSProject("restBasic");
+ prepareRestfulResource(editorForClass("restBasic", "src",
+ "org.rest.test", "RestService.java"),
"EmptyRestfulWS.java.ws",
+ "org.rest.test", "RestService");
bot.sleep(Timing.time2S());
- restfulWizard = new RESTFullExplorerWizard(getWsProjectName());
- restServices = restfulWizard.getAllRestServices();
+ /* get JAX-RS REST explorer for the project */
+ restfulWizard = new RESTFullExplorerWizard("restBasic");
+ SWTBotTreeItem[] restServices = restfulWizard.getAllRestServices();
+
+ /* none of REST web services found */
+ assertNoRESTServicesInExplorerFound(restServices);
+ }
+
+ private void testEditedDeleteRestWebResource(
+ SWTBotTreeItem[] restServices) {
for (SWTBotTreeItem restService : restServices) {
if
(restfulWizard.getRestServiceName(restService).equals(RESTFulAnnotations.DELETE.getLabel()))
{
assertTrue(restfulWizard.getPathForRestFulService(restService).equals("/rest/delete/edited/{id}"));
@@ -160,60 +134,30 @@
}
}
}
-
- @Test
- public void testDeletingRESTMethods() {
-
- prepareWSResource(BASIC_WS_RESOURCE);
-
- restfulWizard = new RESTFullExplorerWizard(getWsProjectName());
- SWTBotTreeItem[] restServices = restfulWizard.getAllRestServices();
-
- assertTrue(restServices.length + " RESTful services was found instead of 4.",
- restServices.length == 4);
-
- packageExplorer.openFile(getWsProjectName(), "src",
- getWsPackage(), getWsName() + ".java").toTextEditor();
- resourceHelper.copyResourceToClassWithSave(bot.editorByTitle(getWsName() +
".java"),
- PathAnnotationSupportTest.class.
- getResourceAsStream(EMPTY_WS_RESOURCE),
- false, false, getWsPackage(), getWsName());
-
- bot.sleep(Timing.time2S());
- restfulWizard = new RESTFullExplorerWizard(getWsProjectName());
- restServices = restfulWizard.getAllRestServices();
-
- assertTrue(restServices.length + " RESTful services was found instead of
0.",
- restServices.length == 0);
-
- }
-
- private boolean allRestServicesArePresent(SWTBotTreeItem[] restServices) {
-
- String[] restMethods = {RESTFulAnnotations.GET.getLabel(),
RESTFulAnnotations.POST.getLabel(),
- RESTFulAnnotations.POST.getLabel(), RESTFulAnnotations.DELETE.getLabel()};
- for (String restMethod : restMethods) {
- boolean serviceFound = false;
- for (SWTBotTreeItem restService : restServices) {
- if (restfulWizard.getRestServiceName(restService).equals(restMethod)) {
- serviceFound = true;
- break;
- }
- }
- if (!serviceFound) return false;
+
+ private void testAdvancedRESTServices(
+ SWTBotTreeItem[] restServices) {
+ for (SWTBotTreeItem restService : restServices) {
+ if
(restfulWizard.getRestServiceName(restService).equals(RESTFulAnnotations.GET.getLabel()))
{
+ assertTrue(restfulWizard.getPathForRestFulService(restService).equals("/rest/{id}"));
+ assertTrue(restfulWizard.getConsumesInfo(restService).equals("*/*"));
+ assertTrue(restfulWizard.getProducesInfo(restService).equals("text/plain"));
+ }
+ if
(restfulWizard.getRestServiceName(restService).equals(RESTFulAnnotations.PUT.getLabel()))
{
+ assertTrue(restfulWizard.getPathForRestFulService(restService).equals("/rest/put/{id}"));
+ assertTrue(restfulWizard.getConsumesInfo(restService).equals("text/plain"));
+ assertTrue(restfulWizard.getProducesInfo(restService).equals("*/*"));
+ }
+ if
(restfulWizard.getRestServiceName(restService).equals(RESTFulAnnotations.POST.getLabel()))
{
+ assertTrue(restfulWizard.getPathForRestFulService(restService).equals("/rest/post/{id}"));
+ assertTrue(restfulWizard.getConsumesInfo(restService).equals("text/plain"));
+ assertTrue(restfulWizard.getProducesInfo(restService).equals("text/plain"));
+ }
+ if
(restfulWizard.getRestServiceName(restService).equals(RESTFulAnnotations.DELETE.getLabel()))
{
+ assertTrue(restfulWizard.getPathForRestFulService(restService).equals("/rest/delete/{id}"));
+ assertTrue(restfulWizard.getConsumesInfo(restService).equals("*/*"));
+ assertTrue(restfulWizard.getProducesInfo(restService).equals("*/*"));
+ }
}
- return true;
}
-
- private void prepareWSResource(String streamPath) {
-
- packageExplorer.openFile(getWsProjectName(), "src",
- getWsPackage(), getWsName() + ".java").toTextEditor();
- resourceHelper.copyResourceToClassWithSave(bot.editorByTitle(getWsName() +
".java"),
- PathAnnotationSupportTest.class.getResourceAsStream(streamPath),
- false, false, getWsPackage(), getWsName());
- bot.sleep(Timing.time2S());
-
- }
-
}
Added:
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/QueryAnnotationSupportTest.java
===================================================================
---
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/QueryAnnotationSupportTest.java
(rev 0)
+++
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/QueryAnnotationSupportTest.java 2012-06-05
07:56:43 UTC (rev 41709)
@@ -0,0 +1,112 @@
+/*******************************************************************************
+ * Copyright (c) 2007-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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.ws.ui.bot.test.rest;
+
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
+import org.jboss.tools.ui.bot.ext.Timing;
+import org.jboss.tools.ws.ui.bot.test.ti.wizard.RESTFullExplorerWizard;
+import org.junit.Test;
+
+public class QueryAnnotationSupportTest extends RESTfulTestBase {
+
+ private final String QUERY_TWO_PARAM_RESOURCE = "QueryTwoParam.java.ws";
+
+ private String queryParam1 = "param1";
+ private String queryParam2 = "param2";
+ private String queryType = "java.lang.String";
+ private String queryParam1New = "newParam1";
+ private String queryType1 = "java.lang.String";
+ private String queryType2 = "java.lang.Integer";
+ private String queryTypeNew = "java.lang.Long";
+
+ @Override
+ public void cleanup() {
+ projectExplorer.deleteAllProjects();
+ }
+
+ @Test
+ public void testQueryParamSupport() {
+
+ /* prepare project */
+ importRestWSProject("query1");
+
+ /* get JAX-RS REST explorer for the project */
+ restfulWizard = new RESTFullExplorerWizard("query1");
+ SWTBotTreeItem[] restServices = restfulWizard.getAllRestServices();
+
+ /* test JAX-RS REST explorer */
+ assertCountOfRESTServices(restServices, 1);
+ assertExpectedPathOfService(restServices[0],
+ "/rest?" + queryParam1 + "={" + queryParam1 + ":" +
queryType + "}");
+
+ /* prepare project*/
+ importRestWSProject("query2");
+
+ /* get JAX-RS REST explorer for the project */
+ restfulWizard = new RESTFullExplorerWizard("query2");
+ restServices = restfulWizard.getAllRestServices();
+
+ /* test JAX-RS REST explorer */
+ assertCountOfRESTServices(restServices, 1);
+ assertExpectedPathOfService(restServices[0],
+ "/rest?" + queryParam1 + "={" + queryParam1 + ":" +
queryType + "}&" +
+ queryParam2 + "={" + queryParam2 + ":" + queryType +
"}");
+ }
+
+ @Test
+ public void testEditingQueryParam() {
+
+ /* prepare project */
+ importRestWSProject("query2");
+
+ /* replace param1 to newParam1 */
+ resourceHelper.replaceInEditor(editorForClass("query2", "src",
+ "org.rest.test", "RestService.java").toTextEditor(),
+ queryParam1, queryParam1New, true);
+ bot.sleep(Timing.time2S());
+
+ /* get JAX-RS REST explorer for the project */
+ restfulWizard = new RESTFullExplorerWizard("query2");
+ SWTBotTreeItem[] restServices = restfulWizard.getAllRestServices();
+
+ /* test JAX-RS REST explorer */
+ assertCountOfRESTServices(restServices, 1);
+ assertExpectedPathOfService(restServices[0],
+ "/rest?" + queryParam1New + "={" + queryParam1New + ":"
+ queryType + "}&" +
+ queryParam2 + "={" + queryParam2 + ":" + queryType +
"}");
+ }
+
+ @Test
+ public void testEditingTypeOfQueryParam() {
+
+ /* prepare project anc class */
+ importRestWSProject("query2");
+ prepareRestfulResource(editorForClass("query2", "src",
+ "org.rest.test", "RestService.java"), QUERY_TWO_PARAM_RESOURCE,
+ "org.rest.test", "RestService",
+ queryParam1, queryType1, queryParam2, queryType2);
+ resourceHelper.replaceInEditor(editorForClass("query2", "src",
+ "org.rest.test", "RestService.java").toTextEditor(),
+ queryType1, queryTypeNew, true);
+ bot.sleep(Timing.time2S());
+
+ /* get JAX-RS REST explorer for the project */
+ restfulWizard = new RESTFullExplorerWizard("query2");
+ SWTBotTreeItem[] restServices = restfulWizard.getAllRestServices();
+
+ /* test JAX-RS REST explorer */
+ assertCountOfRESTServices(restServices, 1);
+ assertExpectedPathOfService(restServices[0],
+ "/rest?" + queryParam1 + "={" + queryParam1 + ":" +
queryTypeNew + "}&" +
+ queryParam2 + "={" + queryParam2 + ":" + queryType2 +
"}");
+ }
+}
Deleted:
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/QueryParamSupportTest.java
===================================================================
---
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/QueryParamSupportTest.java 2012-06-05
07:54:21 UTC (rev 41708)
+++
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/QueryParamSupportTest.java 2012-06-05
07:56:43 UTC (rev 41709)
@@ -1,157 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007-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
- *
- * Contributor:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-
-package org.jboss.tools.ws.ui.bot.test.rest;
-
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
-import org.jboss.tools.ui.bot.ext.Timing;
-import org.jboss.tools.ws.ui.bot.test.ti.wizard.RESTFullExplorerWizard;
-import org.junit.Test;
-
-public class QueryParamSupportTest extends RESTfulTestBase {
-
- private RESTFullExplorerWizard restfulWizard = null;
- private String projectName = "restEmpty";
- private final String QUERY_ONE_PARAM_RESOURCE =
"/resources/restful/QueryOneParam.java.ws";
- private final String QUERY_TWO_PARAM_RESOURCE =
"/resources/restful/QueryTwoParam.java.ws";
-
- private String queryParam1 = "param1";
- private String queryParam2 = "param2";
- private String queryType = "java.lang.String";
- private String queryParam1New = "newParam1";
- private String queryParam2New = "newParam2";
- private String queryType1 = "java.lang.String";
- private String queryType2 = "java.lang.Integer";
- private String queryTypeNew = "java.lang.Long";
-
-
- @Override
- protected String getWsProjectName() {
- return projectName;
- }
-
- @Override
- public void cleanup() {
- bot.activeEditor().toTextEditor().save();
- }
-
- @Test
- public void testSupportInExplorer() {
-
- prepareWSResource(QUERY_ONE_PARAM_RESOURCE,
- getWsPackage(), getWsName(), queryParam1, queryType);
-
- restfulWizard = new RESTFullExplorerWizard(getWsProjectName());
- SWTBotTreeItem[] restServices = restfulWizard.getAllRestServices();
-
- assertTrue("There should be one RESTful web service instead of " +
- restServices.length, restServices.length == 1);
- String path = restfulWizard.getPathForRestFulService(restServices[0]);
- assertEquals("/rest?" + queryParam1 + "={" + queryParam1 +
":" + queryType + "}", path);
-
- prepareWSResource(QUERY_TWO_PARAM_RESOURCE, getWsPackage(), getWsName(),
- queryParam1, queryType, queryParam2, queryType);
-
- restfulWizard = new RESTFullExplorerWizard(getWsProjectName());
- restServices = restfulWizard.getAllRestServices();
-
- assertTrue("There should be one RESTful web service instead of " +
- restServices.length, restServices.length == 1);
-
- path = restfulWizard.getPathForRestFulService(restServices[0]);
- assertEquals("/rest?" + queryParam1 + "={" + queryParam1 +
":" + queryType + "}&" +
- queryParam2 + "={" + queryParam2 + ":" + queryType +
"}", path);
- }
-
- @Test
- public void testEditingQueryParam() {
-
- prepareWSResource(QUERY_TWO_PARAM_RESOURCE, getWsPackage(), getWsName(),
- queryParam1, queryType, queryParam2, queryType);
-
- resourceHelper.replaceInEditor(bot.activeEditor().toTextEditor(),
- queryParam1, queryParam1New, false);
- bot.sleep(Timing.time2S());
-
- restfulWizard = new RESTFullExplorerWizard(getWsProjectName());
- SWTBotTreeItem[] restServices = restfulWizard.getAllRestServices();
-
- assertTrue("There should be one RESTful web service instead of " +
- restServices.length, restServices.length == 1);
- String path = restfulWizard.getPathForRestFulService(restServices[0]);
- assertEquals("/rest?" + queryParam1New + "={" + queryParam1New +
":" + queryType + "}&" +
- queryParam2 + "={" + queryParam2 + ":" + queryType +
"}", path);
-
-
- resourceHelper.replaceInEditor(bot.activeEditor().toTextEditor(),
- queryParam1New, queryParam1, false);
- resourceHelper.replaceInEditor(bot.activeEditor().toTextEditor(),
- queryParam2, queryParam2New, false);
- bot.sleep(Timing.time2S());
- restfulWizard = new RESTFullExplorerWizard(getWsProjectName());
- restServices = restfulWizard.getAllRestServices();
-
- assertTrue("There should be one RESTful web service instead of " +
- restServices.length, restServices.length == 1);
- path = restfulWizard.getPathForRestFulService(restServices[0]);
- assertEquals("/rest?" + queryParam1 + "={" + queryParam1 +
":" + queryType + "}&" +
- queryParam2New + "={" + queryParam2New + ":" + queryType +
"}", path);
-
- }
-
- @Test
- public void testEditingTypeOfQueryParam() {
-
- prepareWSResource(QUERY_TWO_PARAM_RESOURCE, getWsPackage(), getWsName(),
- queryParam1, queryType1, queryParam2, queryType2);
-
- resourceHelper.replaceInEditor(bot.activeEditor().toTextEditor(),
- queryType1, queryTypeNew, false);
- bot.sleep(Timing.time2S());
-
- restfulWizard = new RESTFullExplorerWizard(getWsProjectName());
- SWTBotTreeItem[] restServices = restfulWizard.getAllRestServices();
-
- assertTrue("There should be one RESTful web service instead of " +
- restServices.length, restServices.length == 1);
- String path = restfulWizard.getPathForRestFulService(restServices[0]);
- assertEquals("/rest?" + queryParam1 + "={" + queryParam1 +
":" + queryTypeNew + "}&" +
- queryParam2 + "={" + queryParam2 + ":" + queryType2 +
"}", path);
-
-
- resourceHelper.replaceInEditor(bot.activeEditor().toTextEditor(),
- queryTypeNew, queryType1, false);
- resourceHelper.replaceInEditor(bot.activeEditor().toTextEditor(),
- queryType2, queryTypeNew, false);
- bot.sleep(Timing.time2S());
- restfulWizard = new RESTFullExplorerWizard(getWsProjectName());
- restServices = restfulWizard.getAllRestServices();
-
- assertTrue("There should be one RESTful web service instead of " +
- restServices.length, restServices.length == 1);
- path = restfulWizard.getPathForRestFulService(restServices[0]);
- assertEquals("/rest?" + queryParam1 + "={" + queryParam1 +
":" + queryType1 + "}&" +
- queryParam2 + "={" + queryParam2 + ":" + queryTypeNew +
"}", path);
-
- }
-
- private void prepareWSResource(String streamPath, Object... parameters) {
-
- packageExplorer.openFile(getWsProjectName(), "src",
- getWsPackage(), getWsName() + ".java").toTextEditor();
- resourceHelper.copyResourceToClassWithSave(bot.editorByTitle(getWsName() +
".java"),
- QueryParamSupportTest.class.getResourceAsStream(streamPath),
- false, false, parameters);
- bot.sleep(Timing.time2S());
-
- }
-
-}
Modified:
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/RESTFulAnnotations.java
===================================================================
---
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/RESTFulAnnotations.java 2012-06-05
07:54:21 UTC (rev 41708)
+++
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/RESTFulAnnotations.java 2012-06-05
07:56:43 UTC (rev 41709)
@@ -2,7 +2,6 @@
public enum RESTFulAnnotations {
- CONFIGURE_MENU_LABEL("Configure"),
REST_SUPPORT_MENU_LABEL_ADD("Add JAX-RS 1.1 support..."),
REST_SUPPORT_MENU_LABEL_REMOVE("Remove JAX-RS 1.1 support..."),
REST_EXPLORER_LABEL("JAX-RS REST Web Services"),
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-06-05
07:54:21 UTC (rev 41708)
+++
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/RESTfulHelper.java 2012-06-05
07:56:43 UTC (rev 41709)
@@ -18,6 +18,7 @@
import java.util.List;
import org.eclipse.swtbot.swt.finder.SWTBot;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTable;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
@@ -28,9 +29,10 @@
import org.jboss.tools.ui.bot.ext.config.TestConfigurator;
import org.jboss.tools.ui.bot.ext.gen.IPreference;
import org.jboss.tools.ui.bot.ext.helper.BuildPathHelper;
+import org.jboss.tools.ui.bot.ext.helper.ContextMenuHelper;
+import org.jboss.tools.ui.bot.ext.types.IDELabel;
import org.jboss.tools.ui.bot.ext.view.ProblemsView;
import org.jboss.tools.ui.bot.ext.view.ProjectExplorer;
-import org.jboss.tools.ws.ui.bot.test.utils.NodeContextUtil;
import org.jboss.tools.ws.ui.bot.test.utils.ResourceHelper;
public class RESTfulHelper {
@@ -160,12 +162,13 @@
projectExplorer.selectProject(wsProjectName);
SWTBotTree tree = projectExplorer.bot().tree();
SWTBotTreeItem item = tree.getTreeItem(wsProjectName);
- item.expand();
- NodeContextUtil.nodeContextMenu(tree, item,
- RESTFulAnnotations.CONFIGURE_MENU_LABEL.getLabel(),
- option == ConfigureOption.ADD ? RESTFulAnnotations.REST_SUPPORT_MENU_LABEL_ADD
- .getLabel() : RESTFulAnnotations.REST_SUPPORT_MENU_LABEL_REMOVE
- .getLabel()).click();
+ ContextMenuHelper.prepareTreeItemForContextMenu(tree, item);
+ SWTBotMenu menu = new SWTBotMenu(
+ ContextMenuHelper.getContextMenu(
+ tree, IDELabel.Menu.PACKAGE_EXPLORER_CONFIGURE, false));
+ menu.menu(option == ConfigureOption.ADD ?
RESTFulAnnotations.REST_SUPPORT_MENU_LABEL_ADD
+ .getLabel() : RESTFulAnnotations.REST_SUPPORT_MENU_LABEL_REMOVE
+ .getLabel()).click();
bot.sleep(Timing.time2S());
util.waitForAll();
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-06-05
07:54:21 UTC (rev 41708)
+++
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/RESTfulTestBase.java 2012-06-05
07:56:43 UTC (rev 41709)
@@ -11,11 +11,14 @@
package org.jboss.tools.ws.ui.bot.test.rest;
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
import org.jboss.tools.ui.bot.ext.Timing;
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.ws.ui.bot.test.WSTestBase;
+import org.jboss.tools.ws.ui.bot.test.ti.wizard.RESTFullExplorerWizard;
/**
* Test base for bot tests using RESTFul support
@@ -23,64 +26,165 @@
* @author jjankovi
*
*/
-@Require(server = @Server(state=ServerState.NotRunning), perspective = "Java
EE")
+@Require(server = @Server(state = ServerState.NotRunning), perspective = "Java
EE")
public class RESTfulTestBase extends WSTestBase {
protected final RESTfulHelper restfulHelper = new RESTfulHelper();
-
- protected final String CONFIGURE_MENU_LABEL = "Configure";
- protected final String REST_SUPPORT_MENU_LABEL_ADD = "Add JAX-RS 1.1
support...";
- protected final String REST_SUPPORT_MENU_LABEL_REMOVE = "Remove JAX-RS 1.1
support...";
- protected final String REST_EXPLORER_LABEL = "JAX-RS REST Web Services";
- protected final String REST_EXPLORER_LABEL_BUILD = "Building RESTful Web
Services...";
-
- protected final String BASIC_WS_RESOURCE =
"/resources/restful/BasicRestfulWS.java.ws";
-
- protected final String ADVANCED_WS_RESOURCE =
"/resources/restful/AdvancedRestfulWS.java.ws";
-
- protected final String EMPTY_WS_RESOURCE =
"/resources/restful/EmptyRestfulWS.java.ws";
-
- protected final String SIMPLE_REST_WS_RESOURCE =
"/resources/restful/SimpleRestWS.java.ws";
+ protected RESTFullExplorerWizard restfulWizard = null;
+
+ protected final String SIMPLE_REST_WS_RESOURCE = "SimpleRestWS.java.ws";
+
protected String getWsPackage() {
return "org.rest.test";
}
-
+
protected String getWsName() {
return "RestService";
}
-
+
@Override
- public void setup() {
- prepareRestProject();
+ public void setup() {
+
}
-
+
@Override
- public void cleanup() {
-
+ public void cleanup() {
+
}
-
- protected void prepareRestProject() {
-
- if (!projectExists(getWsProjectName())) {
-
- //importing project without targeted runtime set
- importWSTestProject("resources/projects/" +
- getWsProjectName(), getWsProjectName());
-
- projectExplorer.selectProject(getWsProjectName());
- eclipse.cleanAllProjects();
- bot.sleep(Timing.time3S());
-
- if (!restfulHelper.isRestSupportEnabled(getWsProjectName())) {
- // workaround for EAP 5.1
- if (configuredState.getServer().type.equals("EAP") &&
- configuredState.getServer().version.equals("5.1")) {
- restfulHelper.addRestEasyLibs(getWsProjectName());
+
+ protected void importRestWSProject(String projectName) {
+
+ // importing project without targeted runtime set
+ importWSTestProject(projectName);
+
+ projectExplorer.selectProject(projectName);
+ eclipse.cleanAllProjects();
+ bot.sleep(Timing.time3S());
+
+ // workaround for EAP 5.1
+ if (configuredState.getServer().type.equals("EAP")
+ && configuredState.getServer().version.equals("5.1")) {
+ restfulHelper.addRestEasyLibs(projectName);
+ }
+ }
+
+ protected void assertRestFullSupport(String projectName) {
+ assertTrue("JAX-RS REST Web Services explorer is missing in "
+ + "project \"" + projectName + "\"",
+ restfulHelper.isRestSupportEnabled(getWsProjectName()));
+ }
+
+ protected void assertCountOfRESTServices(SWTBotTreeItem[] restServices,
+ int expectedCount) {
+ assertTrue(restServices.length + " RESTful services"
+ + " was found instead of " + expectedCount,
+ restServices.length == expectedCount);
+ }
+
+ protected void assertAllRESTServicesInExplorer(SWTBotTreeItem[] restServices) {
+ assertTrue("All RESTful services (GET, DELETE, POST, PUT) "
+ + "should be present but they are not",
+ allRestServicesArePresent(restServices));
+ }
+
+ protected void assertNotAllRESTServicesInExplorer(
+ SWTBotTreeItem[] restServices) {
+ assertFalse("All RESTful services (GET, DELETE, POST, PUT) "
+ + "shouldnt be present but they are",
+ allRestServicesArePresent(restServices));
+ }
+
+ protected void assertNoRESTServicesInExplorerFound(
+ SWTBotTreeItem[] restServices) {
+ assertTrue(restServices.length
+ + " RESTful services was found instead of 0.",
+ restServices.length == 0);
+ }
+
+ protected void assertPathOfAllRESTWebServices(
+ SWTBotTreeItem[] restServices, String path) {
+ for (SWTBotTreeItem restService : restServices) {
+ assertTrue(
+ "RESTful Web Service \""
+ + restfulWizard.getRestServiceName(restService)
+ + "\" has been set wrong path", restfulWizard
+ .getPathForRestFulService(restService).equals(path));
+ }
+ }
+
+ protected void assertAbsenceOfRESTWebService(SWTBotTreeItem[] restServices,
+ String restWebService) {
+ for (SWTBotTreeItem restService : restServices) {
+ if (restfulWizard.getRestServiceName(restService).equals(
+ restWebService)) {
+ fail("There should not be " + restWebService
+ + "RESTful services");
+ }
+ }
+ }
+
+ protected void assertPresenceOfRESTWebService(
+ SWTBotTreeItem[] restServices, String restWebService) {
+ boolean found = false;
+ for (SWTBotTreeItem restService : restServices) {
+ if (restfulWizard.getRestServiceName(restService).equals(
+ restWebService)) {
+ found = true;
+ break;
+ }
+ }
+ assertTrue("There should be " + restWebService + "RESTful
services",
+ found);
+ }
+
+ protected void assertExpectedPathOfService(SWTBotTreeItem service,
+ String expectedPath) {
+ String path = restfulWizard.getPathForRestFulService(service);
+ assertEquals("Expected path: " + expectedPath + " <--> found path:
"
+ + path, expectedPath, path);
+ }
+
+ protected void assertCoundOfValidationErrors(String projectName,
+ int expectedCount) {
+ int foundErrors = restfulHelper.getRESTValidationErrors(projectName).length;
+ assertTrue("There should be " + expectedCount
+ + " validation error. Found: " + foundErrors,
+ foundErrors == expectedCount);
+ }
+
+ protected SWTBotEditor editorForClass(String projectName, String... path) {
+ return packageExplorer.openFile(projectName, path);
+ }
+
+ protected void prepareRestfulResource(SWTBotEditor editor,
+ String resourceFile, Object... parameters) {
+ String streamPath = "/resources/restful/" + resourceFile;
+ resourceHelper.copyResourceToClassWithSave(editor,
+ QueryAnnotationSupportTest.class
+ .getResourceAsStream(streamPath), true, false,
+ parameters);
+ bot.sleep(Timing.time2S());
+ }
+
+ private boolean allRestServicesArePresent(SWTBotTreeItem[] restServices) {
+
+ String[] restMethods = { RESTFulAnnotations.GET.getLabel(),
+ RESTFulAnnotations.POST.getLabel(),
+ RESTFulAnnotations.POST.getLabel(),
+ RESTFulAnnotations.DELETE.getLabel() };
+ for (String restMethod : restMethods) {
+ boolean serviceFound = false;
+ for (SWTBotTreeItem restService : restServices) {
+ if (restfulWizard.getRestServiceName(restService).equals(
+ restMethod)) {
+ serviceFound = true;
+ break;
}
- restfulHelper.addRestSupport(getWsProjectName());
}
+ if (!serviceFound)
+ return false;
}
+ return true;
}
-
}
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-06-05
07:54:21 UTC (rev 41708)
+++
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/completion/RESTfulCompletionTest.java 2012-06-05
07:56:43 UTC (rev 41709)
@@ -29,25 +29,32 @@
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 =
Arrays.asList("userId - JAX-RS Mapping");
- private final List<String> EXP_EMPTY_COMPLETION_RESULT = Arrays.asList("No
Default Proposals");
+ private final List<String> EXP_NON_EMPTY_COMPLETION_RESULT =
+ Arrays.asList("userId - JAX-RS Mapping");
+ private final List<String> EXP_EMPTY_COMPLETION_RESULT =
+ Arrays.asList("No Default Proposals");
@Override
protected String getWsProjectName() {
return "restEmpty";
}
+ @Override
+ public void cleanup() {
+ projectExplorer.deleteAllProjects();
+ }
+
@Test
public void testWithEmptyPrefix() {
- packageExplorer.openFile(getWsProjectName(), "src",
- getWsPackage(), getWsName() + ".java").toTextEditor();
- resourceHelper.copyResourceToClass(bot.editorByTitle(getWsName() + ".java"),
- RESTfulCompletionTest.class.getResourceAsStream(SIMPLE_REST_WS_RESOURCE),
- false, getWsPackage(), getWsName(), GET_METHOD_PATH, "");
+ /* prepare project */
+ importRestWSProject(getWsProjectName());
+ prepareRestfulResource(editorForClass(getWsProjectName(), "src",
+ "org.rest.test", "RestService.java"), SIMPLE_REST_WS_RESOURCE,
+ "org.rest.test", "RestService",
+ GET_METHOD_PATH, "");
- packageExplorer.openFile(getWsProjectName(), "src",
- getWsPackage(), getWsName() + ".java").toTextEditor();
+ /* test content assist proposal */
ContentAssistHelper.checkContentAssistContent(bot,
getWsName() + ".java", PATH_PARAM_NAVIGATION,
PATH_PARAM_NAVIGATION.length() + 1,
0, EXP_NON_EMPTY_COMPLETION_RESULT);
@@ -57,14 +64,14 @@
@Test
public void testWithValidPrefixAtTheEnd() {
- packageExplorer.openFile(getWsProjectName(), "src",
- getWsPackage(), getWsName() + ".java").toTextEditor();
- resourceHelper.copyResourceToClass(bot.editorByTitle(getWsName() + ".java"),
- RESTfulCompletionTest.class.getResourceAsStream(SIMPLE_REST_WS_RESOURCE),
- false, getWsPackage(), getWsName(), GET_METHOD_PATH, CORRECT_PATH_PARAM);
+ /* prepare project */
+ importRestWSProject(getWsProjectName());
+ prepareRestfulResource(editorForClass(getWsProjectName(), "src",
+ "org.rest.test", "RestService.java"), SIMPLE_REST_WS_RESOURCE,
+ "org.rest.test", "RestService",
+ GET_METHOD_PATH, CORRECT_PATH_PARAM);
- packageExplorer.openFile(getWsProjectName(), "src",
- getWsPackage(), getWsName() + ".java").toTextEditor();
+ /* test content assist proposal */
ContentAssistHelper.checkContentAssistContent(bot,
getWsName() + ".java", PATH_PARAM_NAVIGATION,
PATH_PARAM_NAVIGATION.length() +
CORRECT_PATH_PARAM.length() + 1,
@@ -75,14 +82,14 @@
@Test
public void testWithValidPrefixInTheBeginning() {
- packageExplorer.openFile(getWsProjectName(), "src",
- getWsPackage(), getWsName() + ".java").toTextEditor();
- resourceHelper.copyResourceToClass(bot.editorByTitle(getWsName() + ".java"),
- RESTfulCompletionTest.class.getResourceAsStream(SIMPLE_REST_WS_RESOURCE),
- false, getWsPackage(), getWsName(), GET_METHOD_PATH, CORRECT_PATH_PARAM);
+ /* prepare project */
+ importRestWSProject(getWsProjectName());
+ prepareRestfulResource(editorForClass(getWsProjectName(), "src",
+ "org.rest.test", "RestService.java"), SIMPLE_REST_WS_RESOURCE,
+ "org.rest.test", "RestService",
+ GET_METHOD_PATH, CORRECT_PATH_PARAM);
- packageExplorer.openFile(getWsProjectName(), "src",
- getWsPackage(), getWsName() + ".java").toTextEditor();
+ /* test content assist proposal */
ContentAssistHelper.checkContentAssistContent(bot,
getWsName() + ".java", PATH_PARAM_NAVIGATION,
PATH_PARAM_NAVIGATION.length() + 1,
0, EXP_NON_EMPTY_COMPLETION_RESULT);
@@ -92,14 +99,14 @@
@Test
public void testWithInvalidPrefixAtTheEnd() {
- packageExplorer.openFile(getWsProjectName(), "src",
- getWsPackage(), getWsName() + ".java").toTextEditor();
- resourceHelper.copyResourceToClass(bot.editorByTitle(getWsName() + ".java"),
- RESTfulCompletionTest.class.getResourceAsStream(SIMPLE_REST_WS_RESOURCE),
- false, getWsPackage(), getWsName(), GET_METHOD_PATH, INCORRECT_PATH_PARAM);
+ /* prepare project */
+ importRestWSProject(getWsProjectName());
+ prepareRestfulResource(editorForClass(getWsProjectName(), "src",
+ "org.rest.test", "RestService.java"), SIMPLE_REST_WS_RESOURCE,
+ "org.rest.test", "RestService",
+ GET_METHOD_PATH, INCORRECT_PATH_PARAM);
- packageExplorer.openFile(getWsProjectName(), "src",
- getWsPackage(), getWsName() + ".java").toTextEditor();
+ /* test content assist proposal */
ContentAssistHelper.checkContentAssistContent(bot,
getWsName() + ".java", PATH_PARAM_NAVIGATION,
PATH_PARAM_NAVIGATION.length() +
INCORRECT_PATH_PARAM.length() + 1,
@@ -110,14 +117,14 @@
@Test
public void testWithInvalidPrefixInTheBeginning() {
- packageExplorer.openFile(getWsProjectName(), "src",
- getWsPackage(), getWsName() + ".java").toTextEditor();
- resourceHelper.copyResourceToClass(bot.editorByTitle(getWsName() + ".java"),
- RESTfulCompletionTest.class.getResourceAsStream(SIMPLE_REST_WS_RESOURCE),
- false, getWsPackage(), getWsName(), GET_METHOD_PATH, INCORRECT_PATH_PARAM);
+ /* prepare project */
+ importRestWSProject(getWsProjectName());
+ prepareRestfulResource(editorForClass(getWsProjectName(), "src",
+ "org.rest.test", "RestService.java"), SIMPLE_REST_WS_RESOURCE,
+ "org.rest.test", "RestService",
+ GET_METHOD_PATH, INCORRECT_PATH_PARAM);
- packageExplorer.openFile(getWsProjectName(), "src",
- getWsPackage(), getWsName() + ".java").toTextEditor();
+ /* test content assist proposal */
ContentAssistHelper.checkContentAssistContent(bot,
getWsName() + ".java", PATH_PARAM_NAVIGATION,
PATH_PARAM_NAVIGATION.length() + 1,
0, EXP_NON_EMPTY_COMPLETION_RESULT);
@@ -127,14 +134,14 @@
@Test
public void testWithAllInvalidParamSelection() {
- packageExplorer.openFile(getWsProjectName(), "src",
- getWsPackage(), getWsName() + ".java").toTextEditor();
- resourceHelper.copyResourceToClass(bot.editorByTitle(getWsName() + ".java"),
- RESTfulCompletionTest.class.getResourceAsStream(SIMPLE_REST_WS_RESOURCE),
- false, getWsPackage(), getWsName(), GET_METHOD_PATH, INCORRECT_PATH_PARAM);
+ /* prepare project */
+ importRestWSProject(getWsProjectName());
+ prepareRestfulResource(editorForClass(getWsProjectName(), "src",
+ "org.rest.test", "RestService.java"), SIMPLE_REST_WS_RESOURCE,
+ "org.rest.test", "RestService",
+ GET_METHOD_PATH, INCORRECT_PATH_PARAM);
- packageExplorer.openFile(getWsProjectName(), "src",
- getWsPackage(), getWsName() + ".java").toTextEditor();
+ /* test content assist proposal */
ContentAssistHelper.checkContentAssistContent(bot,
getWsName() + ".java", PATH_PARAM_NAVIGATION,
PATH_PARAM_NAVIGATION.length() + 1,
INCORRECT_PATH_PARAM.length(), EXP_NON_EMPTY_COMPLETION_RESULT);
Added:
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/explorer/RESTfulExplorerTest.java
===================================================================
---
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/explorer/RESTfulExplorerTest.java
(rev 0)
+++
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/explorer/RESTfulExplorerTest.java 2012-06-05
07:56:43 UTC (rev 41709)
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2011 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.ws.ui.bot.test.rest.explorer;
+
+import org.jboss.tools.ws.ui.bot.test.rest.RESTfulTestBase;
+import org.junit.Test;
+
+/**
+ * Test checks if context menu 'Add RESTful 1.1 Support' works properly
+ * @author jjankovi
+ *
+ */
+public class RESTfulExplorerTest extends RESTfulTestBase {
+
+ protected String getWsProjectName() {
+ return "RestExplorerTest";
+ }
+
+ @Test
+ public void testJaxRsExplorerSupport() {
+
+ /* create dynamic web project */
+ projectHelper.createProject(getWsProjectName());
+
+ /* add RESTful support into project */
+ restfulHelper.addRestSupport(getWsProjectName());
+
+ /* test if RESYful explorer is not missing */
+ assertRestFullSupport(getWsProjectName());
+
+ }
+
+}
Deleted:
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/explorer/RESTfulSupportTest.java
===================================================================
---
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/explorer/RESTfulSupportTest.java 2012-06-05
07:54:21 UTC (rev 41708)
+++
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/explorer/RESTfulSupportTest.java 2012-06-05
07:56:43 UTC (rev 41709)
@@ -1,45 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007-2011 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
- *
- * Contributor:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-
-package org.jboss.tools.ws.ui.bot.test.rest.explorer;
-
-import org.jboss.tools.ws.ui.bot.test.rest.RESTfulTestBase;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * Test checks if context menu 'Add RESTful 1.1 Support' works properly
- * @author jjankovi
- *
- */
-public class RESTfulSupportTest extends RESTfulTestBase {
-
- protected String getWsProjectName() {
- return "RestExplorerTest";
- }
-
- @Before
- public void setup() {
- if (!projectExists(getWsProjectName())) {
- projectHelper.createProject(getWsProjectName());
- }
- }
-
-
- @Test
- public void test_JAXRS_ExplorerSupport() {
-
- restfulHelper.addRestSupport(getWsProjectName());
- assertTrue(restfulHelper.isRestSupportEnabled(getWsProjectName()));
-
- }
-
-}
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-06-05
07:54:21 UTC (rev 41708)
+++
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/validation/RESTfulValidationTest.java 2012-06-05
07:56:43 UTC (rev 41709)
@@ -30,87 +30,96 @@
return "restEmpty";
}
+ @Override
+ public void cleanup() {
+ projectExplorer.deleteAllProjects();
+ }
+
@Test
public void testCorrectValueValidation() {
- packageExplorer.openFile(getWsProjectName(), "src",
- getWsPackage(), getWsName() + ".java").toTextEditor();
- resourceHelper.copyResourceToClass(bot.editorByTitle(getWsName() + ".java"),
- RESTfulValidationTest.class.getResourceAsStream(SIMPLE_REST_WS_RESOURCE),
- false, getWsPackage(), getWsName(), GET_METHOD_PATH, CORRECT_PATH_PARAM);
+ /* prepare project */
+ importRestWSProject(getWsProjectName());
+ prepareRestfulResource(editorForClass(getWsProjectName(), "src",
+ "org.rest.test", "RestService.java"), SIMPLE_REST_WS_RESOURCE,
+ "org.rest.test", "RestService",
+ GET_METHOD_PATH, CORRECT_PATH_PARAM);
- assertTrue(restfulHelper.getRESTValidationErrors(getWsProjectName()).length == 0);
+ /* test count of validation errors */
+ assertCoundOfValidationErrors(getWsProjectName(), 0);
}
+
+
@Test
public void testBadValueValidation() {
- packageExplorer.openFile(getWsProjectName(), "src",
- getWsPackage(), getWsName() + ".java").toTextEditor();
- resourceHelper.copyResourceToClass(bot.editorByTitle(getWsName() + ".java"),
- RESTfulValidationTest.class.getResourceAsStream(SIMPLE_REST_WS_RESOURCE),
- false, getWsPackage(), getWsName(), GET_METHOD_PATH, BAD_PATH_PARAM);
+ /* prepare project */
+ importRestWSProject(getWsProjectName());
+ prepareRestfulResource(editorForClass(getWsProjectName(), "src",
+ "org.rest.test", "RestService.java"), SIMPLE_REST_WS_RESOURCE,
+ "org.rest.test", "RestService",
+ GET_METHOD_PATH, BAD_PATH_PARAM);
- assertTrue("" +
restfulHelper.getRESTValidationErrors(getWsProjectName()).length,
- restfulHelper.getRESTValidationErrors(getWsProjectName()).length == 1);
+ /* test count of validation errors */
+ assertCoundOfValidationErrors(getWsProjectName(), 1);
}
@Test
public void testCorrectToBadValueValidation() {
- packageExplorer.openFile(getWsProjectName(), "src",
- getWsPackage(), getWsName() + ".java").toTextEditor();
- resourceHelper.copyResourceToClass(bot.editorByTitle(getWsName() + ".java"),
- RESTfulValidationTest.class.getResourceAsStream(SIMPLE_REST_WS_RESOURCE),
- false, getWsPackage(), getWsName(), GET_METHOD_PATH, CORRECT_PATH_PARAM);
+ /* prepare project */
+ importRestWSProject(getWsProjectName());
+ prepareRestfulResource(editorForClass(getWsProjectName(), "src",
+ "org.rest.test", "RestService.java"), SIMPLE_REST_WS_RESOURCE,
+ "org.rest.test", "RestService",
+ GET_METHOD_PATH, CORRECT_PATH_PARAM);
+ prepareRestfulResource(bot.activeEditor(), SIMPLE_REST_WS_RESOURCE,
+ "org.rest.test", "RestService",
+ GET_METHOD_PATH, BAD_PATH_PARAM);
- packageExplorer.openFile(getWsProjectName(), "src",
- getWsPackage(), getWsName() + ".java").toTextEditor();
- resourceHelper.copyResourceToClass(bot.editorByTitle(getWsName() + ".java"),
- RESTfulValidationTest.class.getResourceAsStream(SIMPLE_REST_WS_RESOURCE),
- false, getWsPackage(), getWsName(), GET_METHOD_PATH, BAD_PATH_PARAM);
-
- assertTrue("" +
restfulHelper.getRESTValidationErrors(getWsProjectName()).length,
- restfulHelper.getRESTValidationErrors(getWsProjectName()).length == 1);
+ /* test count of validation errors */
+ assertCoundOfValidationErrors(getWsProjectName(), 1);
}
@Test
public void testBadToCorrectValueValidation() {
- packageExplorer.openFile(getWsProjectName(), "src",
- getWsPackage(), getWsName() + ".java").toTextEditor();
- resourceHelper.copyResourceToClass(bot.editorByTitle(getWsName() + ".java"),
- RESTfulValidationTest.class.getResourceAsStream(SIMPLE_REST_WS_RESOURCE),
- false, getWsPackage(), getWsName(), GET_METHOD_PATH, BAD_PATH_PARAM);
+ /* prepare project */
+ importRestWSProject(getWsProjectName());
+ prepareRestfulResource(editorForClass(getWsProjectName(), "src",
+ "org.rest.test", "RestService.java"), SIMPLE_REST_WS_RESOURCE,
+ "org.rest.test", "RestService",
+ GET_METHOD_PATH, BAD_PATH_PARAM);
+ prepareRestfulResource(bot.activeEditor(), SIMPLE_REST_WS_RESOURCE,
+ "org.rest.test", "RestService",
+ GET_METHOD_PATH, CORRECT_PATH_PARAM);
- packageExplorer.openFile(getWsProjectName(), "src",
- getWsPackage(), getWsName() + ".java").toTextEditor();
- resourceHelper.copyResourceToClass(bot.editorByTitle(getWsName() + ".java"),
- RESTfulValidationTest.class.getResourceAsStream(SIMPLE_REST_WS_RESOURCE),
- false, getWsPackage(), getWsName(), GET_METHOD_PATH, CORRECT_PATH_PARAM);
-
- assertTrue("" +
restfulHelper.getRESTValidationErrors(getWsProjectName()).length,
- restfulHelper.getRESTValidationErrors(getWsProjectName()).length == 0);
+ /* test count of validation errors */
+ assertCoundOfValidationErrors(getWsProjectName(), 0);
}
@Test
- public void testJAX_RS_Validator() {
+ public void testJaxRsValidator() {
+ /* disable restful validation */
restfulHelper.disableRESTValidation();
- packageExplorer.openFile(getWsProjectName(), "src",
- getWsPackage(), getWsName() + ".java").toTextEditor();
- resourceHelper.copyResourceToClass(bot.editorByTitle(getWsName() + ".java"),
- RESTfulValidationTest.class.getResourceAsStream(SIMPLE_REST_WS_RESOURCE),
- false, getWsPackage(), getWsName(), GET_METHOD_PATH, BAD_PATH_PARAM);
+ /* prepare project */
+ importRestWSProject(getWsProjectName());
+ prepareRestfulResource(editorForClass(getWsProjectName(), "src",
+ "org.rest.test", "RestService.java"), SIMPLE_REST_WS_RESOURCE,
+ "org.rest.test", "RestService",
+ GET_METHOD_PATH, BAD_PATH_PARAM);
- assertTrue("" +
restfulHelper.getRESTValidationErrors(getWsProjectName()).length,
- restfulHelper.getRESTValidationErrors(getWsProjectName()).length == 0);
+ /* test count of validation errors */
+ assertCoundOfValidationErrors(getWsProjectName(), 0);
+ /* enable restful validation */
restfulHelper.enableRESTValidation();
- assertTrue("" +
restfulHelper.getRESTValidationErrors(getWsProjectName()).length,
- restfulHelper. getRESTValidationErrors(getWsProjectName()).length == 1);
+ /* test count of validation errors */
+ assertCoundOfValidationErrors(getWsProjectName(), 1);
}
}
Deleted:
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/uiutils/views/AnnotationProperties.java
===================================================================
---
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/uiutils/views/AnnotationProperties.java 2012-06-05
07:54:21 UTC (rev 41708)
+++
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/uiutils/views/AnnotationProperties.java 2012-06-05
07:56:43 UTC (rev 41709)
@@ -1,97 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010-2011 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.uiutils.views;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
-import org.jboss.tools.ui.bot.ext.gen.ActionItem;
-import org.jboss.tools.ui.bot.ext.view.ViewBase;
-
-/**
- *
- * @author jjankovi
- *
- */
-public class AnnotationProperties extends ViewBase {
-
- public AnnotationProperties() {
- viewObject = ActionItem.View.JAXWSAnnotationProperties.LABEL;
- }
-
- public List<SWTBotTreeItem> getAllAnnotations() {
-
- List<SWTBotTreeItem> annotations = new ArrayList<SWTBotTreeItem>();
- SWTBotTree annotationViewTree = null;
-
- annotationViewTree = show().bot().tree();
- for (SWTBotTreeItem ti : annotationViewTree.getAllItems()) {
- annotations.add(ti);
- }
-
- return annotations;
- }
-
- public List<SWTBotTreeItem> getAnnotationValues(SWTBotTreeItem annotation) {
-
- List<SWTBotTreeItem> annotValues = new ArrayList<SWTBotTreeItem>();
- for (SWTBotTreeItem ti : annotValues) {
- annotValues.add(ti);
- }
- return annotValues;
-
- }
-
- //!!!not working
- public boolean isAnnotationPresence(SWTBotTreeItem annotation) {
- return annotation.isChecked();
- }
-
- //!!!not working
- public List<SWTBotTreeItem> getAllActiveAnnotation() {
-
- List<SWTBotTreeItem> activeAnnotations = new ArrayList<SWTBotTreeItem>();
- for (SWTBotTreeItem ti : getAllAnnotations()) {
- if (isAnnotationPresence(ti)) {
- activeAnnotations.add(ti);
- }
- }
- return activeAnnotations;
-
- }
-
- //!!!not working
- public SWTBotTreeItem activateAnnotation(SWTBotTreeItem annotation) {
- annotation.check();
- return annotation;
- }
-
- //!!!not working
- public SWTBotTreeItem deactivateAnnotation(SWTBotTreeItem annotation) {
- annotation.uncheck();
- return annotation;
- }
-
- public SWTBotTreeItem changeAnnotationParamValue(SWTBotTreeItem annotation,
- String param, String newValue) {
- for (SWTBotTreeItem parameter : getAnnotationValues(annotation)) {
- if (parameter.equals(param)) {
- // change value of parameter no newValue
- break;
- }
- }
- return annotation;
- }
-
-}
Added:
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/uiutils/views/AnnotationPropertiesView.java
===================================================================
---
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/uiutils/views/AnnotationPropertiesView.java
(rev 0)
+++
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/uiutils/views/AnnotationPropertiesView.java 2012-06-05
07:56:43 UTC (rev 41709)
@@ -0,0 +1,97 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2011 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.uiutils.views;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
+import org.jboss.tools.ui.bot.ext.gen.ActionItem;
+import org.jboss.tools.ui.bot.ext.view.ViewBase;
+
+/**
+ *
+ * @author jjankovi
+ *
+ */
+public class AnnotationPropertiesView extends ViewBase {
+
+ public AnnotationPropertiesView() {
+ viewObject = ActionItem.View.JAXWSAnnotationProperties.LABEL;
+ }
+
+ public List<SWTBotTreeItem> getAllAnnotations() {
+
+ List<SWTBotTreeItem> annotations = new ArrayList<SWTBotTreeItem>();
+ SWTBotTree annotationViewTree = null;
+
+ annotationViewTree = show().bot().tree();
+ for (SWTBotTreeItem ti : annotationViewTree.getAllItems()) {
+ annotations.add(ti);
+ }
+
+ return annotations;
+ }
+
+ public List<SWTBotTreeItem> getAnnotationValues(SWTBotTreeItem annotation) {
+
+ List<SWTBotTreeItem> annotValues = new ArrayList<SWTBotTreeItem>();
+ for (SWTBotTreeItem ti : annotValues) {
+ annotValues.add(ti);
+ }
+ return annotValues;
+
+ }
+
+ //!!!not working
+ public boolean isAnnotationPresence(SWTBotTreeItem annotation) {
+ return annotation.isChecked();
+ }
+
+ //!!!not working
+ public List<SWTBotTreeItem> getAllActiveAnnotation() {
+
+ List<SWTBotTreeItem> activeAnnotations = new ArrayList<SWTBotTreeItem>();
+ for (SWTBotTreeItem ti : getAllAnnotations()) {
+ if (isAnnotationPresence(ti)) {
+ activeAnnotations.add(ti);
+ }
+ }
+ return activeAnnotations;
+
+ }
+
+ //!!!not working
+ public SWTBotTreeItem activateAnnotation(SWTBotTreeItem annotation) {
+ annotation.check();
+ return annotation;
+ }
+
+ //!!!not working
+ public SWTBotTreeItem deactivateAnnotation(SWTBotTreeItem annotation) {
+ annotation.uncheck();
+ return annotation;
+ }
+
+ public SWTBotTreeItem changeAnnotationParamValue(SWTBotTreeItem annotation,
+ String param, String newValue) {
+ for (SWTBotTreeItem parameter : getAnnotationValues(annotation)) {
+ if (parameter.equals(param)) {
+ // change value of parameter no newValue
+ break;
+ }
+ }
+ return annotation;
+ }
+
+}
Deleted:
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/utils/NodeContextUtil.java
===================================================================
---
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/utils/NodeContextUtil.java 2012-06-05
07:54:21 UTC (rev 41708)
+++
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/utils/NodeContextUtil.java 2012-06-05
07:56:43 UTC (rev 41709)
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 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.utils;
-
-import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;
-import org.eclipse.swtbot.swt.finder.results.Result;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
-import org.jboss.tools.ui.bot.ext.helper.ContextMenuHelper;
-
-public class NodeContextUtil {
-
- private NodeContextUtil() {
- throw new AssertionError();
- }
-
- public static SWTBotMenu nodeContextMenu(final SWTBotTree tree,
- SWTBotTreeItem item, final String... menu) {
- assert menu.length > 0;
- ContextMenuHelper.prepareTreeItemForContextMenu(tree, item);
- return UIThreadRunnable.syncExec(new Result<SWTBotMenu>() {
-
- public SWTBotMenu run() {
- SWTBotMenu m = new SWTBotMenu(ContextMenuHelper.getContextMenu(
- tree, menu[0], false));
- for (int i = 1; i < menu.length; i++) {
- m = m.menu(menu[i]);
- }
- return m;
- }
- });
- }
-
-}
Modified: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/todo.txt
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/todo.txt 2012-06-05 07:54:21 UTC (rev
41708)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/todo.txt 2012-06-05 07:56:43 UTC (rev
41709)
@@ -1,5 +1,29 @@
-* Find a way to get to checkbox in Tree/Table which is not in first column
-* Fix AnnotationProperties to be able to change Annotation parameter value
-* Complete AnnotationPropertiesTest
-* Complete multiple tests run (against AS 7 and EAP 5.1)
-* Complete maven integration
\ No newline at end of file
+refactoring - kazdy test (RESTful) bude mat importProject (ak potrebne) - ziadne dedenie
prepareWorkspace
+ - co najmenej pouzivat copy content from resource - hlavne import - co
najjednoduchsie
+ - testy nie tak dlhe - pomenovat co sa robi po krokoch => vytvaranie vela metod -
lahko vyuzivatelne
+ pre dalsie testy
+ - este neviem co bude v RESTfulTestBase - mozno ho celkovo zrusim - nepaci sa mi az
tak
+ ak tam ostane tak tam bude kopa jednoduchych metod ktore moze vyuzivat kazdy
+
+RESTfulHelper - zvlastna trieda nepaci sa mi - uvidim co s nou
+
+AnnotationPropertiesView - skusit to nejak rozchodit
+
+==> napisat AnnotationPropertiesTest
+
+co zmenit v uz existujucich testoch
+ - DefaultValueParamSupportTest:
+ - ovela kratsie a pridat aj na MatrixParam, PathParam - mam len QueryParam
+
+nove testy:
+
+1. Parameter Dialog in WS Tester:
+ - bude testovat ci dialog ponuka vsetko co ma: spravny typ, default, button OK,
validacie ...
+ - ked sa to potvrdi skontroluje sa URL
+ - potom by sa to mohlo aj deploynut a pozriet vysledok
+
+2. pomocou WSDL otvorit WS Tester
+
+
+* Find a way to get to checkbox in Tree/Table which is not in first column (validation)
+* Complete multiple tests run (against AS 7 and EAP 5.1)
\ No newline at end of file