Author: jjankovi
Date: 2012-01-10 04:17:46 -0500 (Tue, 10 Jan 2012)
New Revision: 37737
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/RESTfulSupportTest.java
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/explorer/RESTfulValidationTest.java
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/todo.txt
Removed:
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/EAPCompAllTests.launch
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/WSAllBotTests.launch
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/explorer/RESTfulExplorerSupportTest.java
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/explorer/RESTfulExplorerValidationTest.java
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/explorer/RESTfulServicesExplorerTest.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/RESTfulTestBase.java
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/validation/RESTfulValidationTest.java
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/sample/SampleRESTTestBase.java
Log:
Decomposition and moving RESTful-like bot tests + template of new RESTful-like bot test
added
Deleted: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/EAPCompAllTests.launch
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/EAPCompAllTests.launch 2012-01-10
09:08:41 UTC (rev 37736)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/EAPCompAllTests.launch 2012-01-10
09:17:46 UTC (rev 37737)
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"
standalone="no"?>
-<launchConfiguration
type="org.eclipse.swtbot.eclipse.ui.launcher.JunitLaunchConfig">
-<booleanAttribute key="append.args" value="true"/>
-<booleanAttribute key="askclear" value="false"/>
-<booleanAttribute key="automaticAdd" value="true"/>
-<booleanAttribute key="automaticValidate" value="false"/>
-<stringAttribute key="bootstrap" value=""/>
-<stringAttribute key="checked" value="[NONE]"/>
-<booleanAttribute key="clearConfig" value="true"/>
-<booleanAttribute key="clearws" value="true"/>
-<booleanAttribute key="clearwslog" value="false"/>
-<stringAttribute key="configLocation"
value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/pde-junit"/>
-<booleanAttribute key="default" value="true"/>
-<booleanAttribute key="includeOptional" value="true"/>
-<stringAttribute key="location"
value="${workspace_loc}/../junit-workspace"/>
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
-<listEntry
value="/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/webservice/eap/EAPCompAllTests.java"/>
-</listAttribute>
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
-<listEntry value="1"/>
-</listAttribute>
-<mapAttribute key="org.eclipse.debug.core.environmentVariables">
-<mapEntry key="DISPLAY" value=":1"/>
-</mapAttribute>
-<stringAttribute key="org.eclipse.jdt.junit.CONTAINER"
value=""/>
-<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR"
value="false"/>
-<stringAttribute key="org.eclipse.jdt.junit.TESTNAME"
value=""/>
-<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND"
value="org.eclipse.jdt.junit.loader.junit4"/>
-<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE"
value="org.jboss.tools.ws.ui.bot.test.webservice.eap.EAPCompAllTests"/>
-<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS"
value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl}
-consoleLog"/>
-<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR"
value="org.jboss.tools.ws.ui.bot.test"/>
-<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER"
value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
-<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS"
value="-Dosgi.requiredJavaVersion=1.5 -XX:MaxPermSize=256m -Xms256m -Xmx1024m
-Dswtbot.test.properties.file=${env_var:HOME}/swtbot.properties
-Dusage_reporting_enabled=false"/>
-<stringAttribute key="pde.version" value="3.3"/>
-<stringAttribute key="product"
value="com.jboss.jbds.product.product"/>
-<booleanAttribute key="show_selected_only" value="false"/>
-<stringAttribute key="templateConfig"
value="${target_home}/configuration/config.ini"/>
-<booleanAttribute key="tracing" value="false"/>
-<booleanAttribute key="useCustomFeatures" value="false"/>
-<booleanAttribute key="useDefaultConfig" value="true"/>
-<booleanAttribute key="useDefaultConfigArea" value="false"/>
-<booleanAttribute key="useProduct" value="true"/>
-</launchConfiguration>
Deleted: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/WSAllBotTests.launch
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/WSAllBotTests.launch 2012-01-10 09:08:41
UTC (rev 37736)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/WSAllBotTests.launch 2012-01-10 09:17:46
UTC (rev 37737)
@@ -1,49 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"
standalone="no"?>
-<launchConfiguration
type="org.eclipse.swtbot.eclipse.ui.launcher.JunitLaunchConfig">
-<booleanAttribute key="append.args" value="true"/>
-<booleanAttribute key="askclear" value="false"/>
-<booleanAttribute key="automaticAdd" value="true"/>
-<booleanAttribute key="automaticValidate" value="false"/>
-<stringAttribute key="bootstrap" value=""/>
-<stringAttribute key="checked" value="[NONE]"/>
-<booleanAttribute key="clearConfig" value="true"/>
-<booleanAttribute key="clearws" value="true"/>
-<booleanAttribute key="clearwslog" value="false"/>
-<booleanAttribute
key="com.mountainminds.eclemma.core.INPLACE_INSTRUMENTATION"
value="true"/>
-<listAttribute
key="com.mountainminds.eclemma.core.INSTRUMENTATION_PATHS">
-<listEntry value="/org.jboss.tools.ws.ui/target/classes"/>
-<listEntry value="/org.jboss.tools.ws.creation.ui/target/classes"/>
-<listEntry value="/org.jboss.tools.ws.core/target/classes"/>
-<listEntry value="/org.jboss.tools.ws.creation.core/bin"/>
-</listAttribute>
-<stringAttribute key="configLocation"
value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/pde-junit"/>
-<booleanAttribute key="default" value="true"/>
-<booleanAttribute key="includeOptional" value="true"/>
-<stringAttribute key="location"
value="${workspace_loc}/../junit-workspace"/>
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
-<listEntry
value="/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/WSAllBotTests.java"/>
-</listAttribute>
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
-<listEntry value="1"/>
-</listAttribute>
-<mapAttribute key="org.eclipse.debug.core.environmentVariables">
-<mapEntry key="DISPLAY" value=":1"/>
-</mapAttribute>
-<stringAttribute key="org.eclipse.jdt.junit.CONTAINER"
value=""/>
-<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR"
value="false"/>
-<stringAttribute key="org.eclipse.jdt.junit.TESTNAME"
value=""/>
-<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND"
value="org.eclipse.jdt.junit.loader.junit4"/>
-<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE"
value="org.jboss.tools.ws.ui.bot.test.WSAllBotTests"/>
-<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS"
value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl}
-consoleLog"/>
-<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR"
value="org.jboss.tools.ws.ui.bot.test"/>
-<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER"
value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
-<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS"
value="-Dosgi.requiredJavaVersion=1.5 -XX:MaxPermSize=256m -Xms256m -Xmx1024m
-Dswtbot.test.properties.file=${env_var:HOME}/swtbot.properties
-Dusage_reporting_enabled=false"/>
-<stringAttribute key="pde.version" value="3.3"/>
-<stringAttribute key="product"
value="org.eclipse.platform.ide"/>
-<booleanAttribute key="show_selected_only" value="false"/>
-<booleanAttribute key="tracing" value="false"/>
-<booleanAttribute key="useCustomFeatures" value="false"/>
-<booleanAttribute key="useDefaultConfig" value="true"/>
-<booleanAttribute key="useDefaultConfigArea" value="false"/>
-<booleanAttribute key="useProduct" value="true"/>
-</launchConfiguration>
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-01-10
09:08:41 UTC (rev 37736)
+++
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/WSAllBotTests.java 2012-01-10
09:17:46 UTC (rev 37737)
@@ -11,8 +11,8 @@
package org.jboss.tools.ws.ui.bot.test;
import org.jboss.tools.ui.bot.ext.RequirementAwareSuite;
-import org.jboss.tools.ws.ui.bot.test.rest.explorer.RESTfulExplorerSupportTest;
-import org.jboss.tools.ws.ui.bot.test.rest.explorer.RESTfulServicesExplorerTest;
+import org.jboss.tools.ws.ui.bot.test.rest.explorer.RESTfulExplorerTest;
+import org.jboss.tools.ws.ui.bot.test.rest.explorer.RESTfulSupportTest;
import org.jboss.tools.ws.ui.bot.test.rest.validation.RESTfulValidationTest;
import org.jboss.tools.ws.ui.bot.test.sample.test.SampleRESTWebServiceTest;
import org.jboss.tools.ws.ui.bot.test.sample.test.SampleSoapWebServiceTest;
@@ -52,9 +52,9 @@
SampleRESTWebServiceTest.class,
SimpleSoapWebServiceTest.class,
SimpleRESTWebServiceTest.class,
- RESTfulExplorerSupportTest.class,
- RESTfulServicesExplorerTest.class,
- RESTfulValidationTest.class,
+ RESTfulSupportTest.class,
+ RESTfulExplorerTest.class,
+// RESTfulValidationTest.class,
BottomUpWSTest.class,
TopDownWSTest.class,
WsClientTest.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-01-10
09:08:41 UTC (rev 37736)
+++
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/WSTestBase.java 2012-01-10
09:17:46 UTC (rev 37737)
@@ -18,6 +18,7 @@
import org.jboss.tools.ui.bot.ext.SWTTestExt;
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.ServerType;
import org.jboss.tools.ws.ui.bot.test.uiutils.wizards.WsWizardBase.Slider_Level;
import org.jboss.tools.ws.ui.bot.test.utils.DeploymentHelper;
import org.jboss.tools.ws.ui.bot.test.utils.ProjectHelper;
@@ -33,7 +34,7 @@
* @author jjankovi
*
*/
-@Require(server=@Server(),perspective="Java EE")
+@Require(server=(a)Server(type=ServerType.EAP), perspective="Java EE")
@RunWith(RequirementAwareSuite.class)
@SuiteClasses({ WSAllBotTests.class })
public class WSTestBase extends SWTTestExt {
@@ -47,7 +48,7 @@
+ "<soap:Body>{0}</soap:Body>" +
"</soap:Envelope>";
protected static final Logger LOGGER = Logger
- .getLogger(WSTestBase.class.getName());
+ .getLogger(WSAllBotTests.class.getName());
protected final String LINE_SEPARATOR = System.getProperty("line.separator");
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-01-10
09:08:41 UTC (rev 37736)
+++
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/RESTfulTestBase.java 2012-01-10
09:17:46 UTC (rev 37737)
@@ -11,9 +11,18 @@
package org.jboss.tools.ws.ui.bot.test.rest;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.swtbot.swt.finder.SWTBot;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTable;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
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.gen.IPreference;
+import org.jboss.tools.ui.bot.ext.view.ProblemsView;
import org.jboss.tools.ws.ui.bot.test.WSTestBase;
import org.jboss.tools.ws.ui.bot.test.utils.NodeContextUtil;
@@ -22,8 +31,12 @@
* @author jjankovi
*
*/
+@Require(server=@Server(), perspective="Java EE")
public class RESTfulTestBase extends WSTestBase {
+ protected final String PATH_PARAM_VALID_ERROR = "Invalid @PathParam value";
+ protected final String VALIDATION_PREFERENCE = "Validation";
+ protected final String JAX_RS_VALIDATOR = "JAX-RS Metamodel Validator";
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...";
@@ -33,10 +46,48 @@
ADD, REMOVE;
}
- /**
- *
- * @param wsProjectName
- */
+ protected SWTBotTreeItem[] getRESTValidationErrorsAfterCleanBuild(String wsProjectName)
{
+ eclipse.cleanAllProjects();
+ return getRESTValidationErrors(wsProjectName);
+ }
+
+ protected SWTBotTreeItem[] getRESTValidationErrors(String wsProjectName) {
+ return ProblemsView.getFilteredErrorsTreeItems(bot, PATH_PARAM_VALID_ERROR,
"/"
+ + wsProjectName, null, null);
+ }
+
+ protected void enableRESTValidation() {
+ SWTBotTable validatorTable = preferenceDialog(VALIDATION_PREFERENCE, new
ArrayList<String>()).table();
+ int restValidationRow = -1;
+ for (int row = 0; row < validatorTable.rowCount(); row++) {
+ if (validatorTable.getTableItem(row).getText().equals(JAX_RS_VALIDATOR)) {
+ restValidationRow = row;
+ break;
+ }
+ }
+ assertTrue(restValidationRow >= 0);
+
+ }
+
+ protected void disableRESTValidation() {
+
+ }
+
+ protected SWTBot preferenceDialog(final String name, final List<String> path) {
+ return open.preferenceOpen(new IPreference() {
+
+ @Override
+ public String getName() {
+ return name;
+ }
+
+ @Override
+ public List<String> getGroupPath() {
+ return path;
+ }
+ });
+ }
+
protected void addRestSupport(String wsProjectName) {
configureRestSupport(wsProjectName, ConfigureOption.ADD);
}
@@ -70,4 +121,9 @@
RESTFulAnnotations.REST_EXPLORER_LABEL_BUILD.getLabel()));
}
+
+ protected static void addRestEasyLibs(String wsProjectName) {
+ assertTrue(configuredState.getServer().type.equals("EAP"));
+ }
+
}
Deleted:
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/explorer/RESTfulExplorerSupportTest.java
===================================================================
---
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/explorer/RESTfulExplorerSupportTest.java 2012-01-10
09:08:41 UTC (rev 37736)
+++
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/explorer/RESTfulExplorerSupportTest.java 2012-01-10
09:17:46 UTC (rev 37737)
@@ -1,53 +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 RESTfulExplorerSupportTest extends RESTfulTestBase {
-
- protected String getWsProjectName() {
- return "RestExplorerTest";
- }
-
- protected String getWsPackage() {
- return "org.rest.explorer.validation.test";
- }
-
- protected String getWsName() {
- return "RestService";
- }
-
- @Before
- public void setup() {
- if (!projectExists(getWsProjectName())) {
- projectHelper.createProject(getWsProjectName());
- }
- }
-
-
- @Test
- public void testSupportJAX_RS1_1_Explorer() {
-
- addRestSupport(getWsProjectName());
- assertTrue(isRestSupportEnabled(getWsProjectName()));
-
- }
-
-}
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-01-10
09:17:46 UTC (rev 37737)
@@ -0,0 +1,273 @@
+/*******************************************************************************
+ * 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.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
+import org.jboss.tools.ui.bot.ext.Timing;
+import org.jboss.tools.ws.ui.bot.test.rest.RESTFulAnnotations;
+import org.jboss.tools.ws.ui.bot.test.rest.RESTfulTestBase;
+import org.jboss.tools.ws.ui.bot.test.ti.wizard.RESTFullExplorerWizard;
+import org.junit.Test;
+
+/**
+ * Test operates on exploring RESTFul services in RESTful explorer
+ *
+ * @author jjankovi
+ *
+ */
+public class RESTfulExplorerTest extends RESTfulTestBase {
+
+ private RESTFullExplorerWizard restfulWizard = null;
+
+ protected String getWsProjectName() {
+ return "RestServicesExplorer";
+ }
+
+ protected String getWsPackage() {
+ return "org.rest.explorer.services.test";
+ }
+
+ protected String getWsName() {
+ return "RestService";
+ }
+
+ @Override
+ public void setup() {
+ if (!projectExists(getWsProjectName())) {
+ projectHelper.createProject(getWsProjectName());
+ }
+ if (!isRestSupportEnabled(getWsProjectName())) {
+ addRestSupport(getWsProjectName());
+ }
+ if (!projectExplorer.isFilePresent(getWsProjectName(), "Java Resources",
+ "src", getWsPackage(), getWsName() + ".java")) {
+ projectHelper.createClass(getWsProjectName(), getWsPackage(), getWsName());
+ }
+ }
+
+ @Override
+ public void cleanup() {
+ if (projectExists(getWsProjectName())) {
+ removeRestSupport(getWsProjectName());
+ }
+ }
+
+ @Test
+ public void testAddingSimpleRESTMethods() {
+
+ resourceHelper.copyResourceToClass(bot.editorByTitle(getWsName() + ".java"),
+ RESTfulExplorerTest.class.
+ getResourceAsStream("/resources/restful/BasicRestfulWS.java.ws"),
+ false, getWsPackage(), getWsName());
+ /**
+ * workaround
+ */
+ eclipse.cleanAllProjects();
+ bot.sleep(Timing.time3S());
+
+ restfulWizard = new RESTFullExplorerWizard(getWsProjectName());
+ SWTBotTreeItem[] restServices = restfulWizard.getAllRestServices();
+
+ assertTrue(restServices.length == 4);
+ assertTrue(allRestServicesArePresent(restServices));
+
+ for (SWTBotTreeItem restService : restServices) {
+ assertTrue(restfulWizard.getPathForRestFulService(restService).equals("/rest"));
+ assertTrue(restfulWizard.getConsumesInfo(restService).equals("*/*"));
+ assertTrue(restfulWizard.getProducesInfo(restService).equals("*/*"));
+ }
+ }
+
+ @Test
+ public void testAddingAdvancedRESTMethods() {
+
+ resourceHelper.copyResourceToClass(bot.editorByTitle(getWsName() + ".java"),
+ RESTfulExplorerTest.class.
+
getResourceAsStream("/resources/restful/AdvancedRestfulWS.java.ws"),
+ false, getWsPackage(), getWsName());
+ /**
+ * workaround
+ */
+ eclipse.cleanAllProjects();
+ bot.sleep(Timing.time3S());
+
+ restfulWizard = new RESTFullExplorerWizard(getWsProjectName());
+ SWTBotTreeItem[] restServices = restfulWizard.getAllRestServices();
+
+ assertTrue(restServices.length == 4);
+ assertTrue(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
+ public void testEditingSimpleRESTMethods() {
+
+ resourceHelper.copyResourceToClass(bot.editorByTitle(getWsName() + ".java"),
+ RESTfulExplorerTest.class.
+ getResourceAsStream("/resources/restful/BasicRestfulWS.java.ws"),
+ false, getWsPackage(), getWsName());
+
+ /**
+ * workaround
+ */
+ eclipse.cleanAllProjects();
+ bot.sleep(Timing.time3S());
+
+ restfulWizard = new RESTFullExplorerWizard(getWsProjectName());
+ SWTBotTreeItem[] restServices = restfulWizard.getAllRestServices();
+
+ assertTrue(allRestServicesArePresent(restServices));
+
+ resourceHelper.replaceInEditor(bot.activeEditor().toTextEditor(), "@DELETE",
"@GET");
+
+ /**
+ * workaround
+ */
+ eclipse.cleanAllProjects();
+ bot.sleep(Timing.time3S());
+
+ restfulWizard = new RESTFullExplorerWizard(getWsProjectName());
+ restServices = restfulWizard.getAllRestServices();
+
+ assertFalse(allRestServicesArePresent(restServices));
+
+ for (SWTBotTreeItem restService : restServices) {
+ if
(restfulWizard.getRestServiceName(restService).equals(RESTFulAnnotations.DELETE.getLabel()))
{
+ fail("There should not be DELETE RESTful services");
+ }
+ }
+
+ }
+
+ @Test
+ public void testEditingAdvancedRESTMethods() {
+
+ resourceHelper.copyResourceToClass(bot.editorByTitle(getWsName() + ".java"),
+ RESTfulExplorerTest.class.
+ getResourceAsStream("/resources/restful/AdvancedRestfulWS.java.ws"),
+ false, getWsPackage(), getWsName());
+
+ /**
+ * workaround
+ */
+ eclipse.cleanAllProjects();
+ bot.sleep(Timing.time3S());
+
+ restfulWizard = new RESTFullExplorerWizard(getWsProjectName());
+ 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("*/*"));
+ }
+ }
+
+ resourceHelper.replaceInEditor(bot.activeEditor().toTextEditor(),
"/delete/{id}", "delete/edited/{id}");
+ resourceHelper.replaceInEditor(bot.activeEditor().toTextEditor(), "@DELETE",
+ "@DELETE" + LINE_SEPARATOR +
"@Produces(\"text/plain\")");
+
+ /**
+ * workaround
+ */
+ eclipse.cleanAllProjects();
+ bot.sleep(Timing.time3S());
+
+ restfulWizard = new RESTFullExplorerWizard(getWsProjectName());
+ restServices = restfulWizard.getAllRestServices();
+
+ for (SWTBotTreeItem restService : restServices) {
+ if
(restfulWizard.getRestServiceName(restService).equals(RESTFulAnnotations.DELETE.getLabel()))
{
+ assertTrue(restfulWizard.getPathForRestFulService(restService).equals("/rest/delete/edited/{id}"));
+ assertTrue(restfulWizard.getProducesInfo(restService).equals("text/plain"));
+ }
+ }
+ }
+
+ @Test
+ public void testDeletingRESTMethods() {
+
+ resourceHelper.copyResourceToClass(bot.editorByTitle(getWsName() + ".java"),
+ RESTfulExplorerTest.class.
+ getResourceAsStream("/resources/restful/BasicRestfulWS.java.ws"),
+ false, getWsPackage(), getWsName());
+
+ /**
+ * workaround
+ */
+ eclipse.cleanAllProjects();
+ bot.sleep(Timing.time3S());
+
+ restfulWizard = new RESTFullExplorerWizard(getWsProjectName());
+ SWTBotTreeItem[] restServices = restfulWizard.getAllRestServices();
+
+ assertTrue(restServices.length == 4);
+
+ resourceHelper.copyResourceToClass(bot.editorByTitle(getWsName() + ".java"),
+ RESTfulExplorerTest.class.
+ getResourceAsStream("/resources/restful/EmptyRestfulWS.java.ws"),
+ false, getWsPackage(), getWsName());
+
+ /**
+ * workaround
+ */
+ eclipse.cleanAllProjects();
+ bot.sleep(Timing.time3S());
+
+ restfulWizard = new RESTFullExplorerWizard(getWsProjectName());
+ restServices = restfulWizard.getAllRestServices();
+
+ assertTrue(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;
+ }
+ return true;
+ }
+
+}
Deleted:
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/explorer/RESTfulExplorerValidationTest.java
===================================================================
---
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/explorer/RESTfulExplorerValidationTest.java 2012-01-10
09:08:41 UTC (rev 37736)
+++
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/explorer/RESTfulExplorerValidationTest.java 2012-01-10
09:17:46 UTC (rev 37737)
@@ -1,79 +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.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
-import org.jboss.tools.ui.bot.ext.Timing;
-import org.jboss.tools.ws.ui.bot.test.WSTestBase;
-import org.jboss.tools.ws.ui.bot.test.utils.NodeContextUtil;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- *
- * @author jjankovi
- *
- */
-public class RESTfulExplorerValidationTest extends WSTestBase {
-
- private static final String CONFIGURE_MENU_LABEL = "Configure";
- private static final String REST_SUPPORT_MENU_LABEL_ADD = "Add JAX-RS 1.1
support...";
- private static final String REST_SUPPORT_MENU_LABEL_REMOVE = "Remove JAX-RS 1.1
support...";
- private static final String REST_EXPLORER_LABEL = "JAX-RS REST Web Services";
-
- protected String getWsProjectName() {
- return "RestExplorerTest";
- }
-
- protected String getWsPackage() {
- return "org.rest.explorer.validation.test";
- }
-
- protected String getWsName() {
- return "RestService";
- }
-
- @Before
- public void setup() {
- if (!projectExists(getWsProjectName())) {
- projectHelper.createProject(getWsProjectName());
- }
- }
-
-
- @Test
- public void testSupportJAX_RS1_1_Explorer() {
-
- addRestSupport(getWsProjectName());
-
- projectExplorer.selectProject(getWsProjectName());
- SWTBotTree tree = projectExplorer.bot().tree();
- SWTBotTreeItem item = tree.getTreeItem(getWsProjectName());
- assertTrue(NodeContextUtil.nodeContextMenu(tree, item, CONFIGURE_MENU_LABEL,
- REST_SUPPORT_MENU_LABEL_REMOVE).isVisible());
- assertTrue(projectExplorer.isFilePresent(getWsProjectName(), REST_EXPLORER_LABEL));
-
- }
-
- private void addRestSupport(String wsProjectName) {
- projectExplorer.selectProject(wsProjectName);
- SWTBotTree tree = projectExplorer.bot().tree();
- SWTBotTreeItem item = tree.getTreeItem(wsProjectName);
- item.expand();
- NodeContextUtil.nodeContextMenu(tree, item, CONFIGURE_MENU_LABEL,
- REST_SUPPORT_MENU_LABEL_ADD).click();
- bot.sleep(Timing.time2S());
- util.waitForNonIgnoredJobs();
- }
-
-}
Deleted:
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/explorer/RESTfulServicesExplorerTest.java
===================================================================
---
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/explorer/RESTfulServicesExplorerTest.java 2012-01-10
09:08:41 UTC (rev 37736)
+++
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/explorer/RESTfulServicesExplorerTest.java 2012-01-10
09:17:46 UTC (rev 37737)
@@ -1,287 +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.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
-import org.jboss.tools.ui.bot.ext.Timing;
-import org.jboss.tools.ws.ui.bot.test.rest.RESTFulAnnotations;
-import org.jboss.tools.ws.ui.bot.test.rest.RESTfulTestBase;
-import org.jboss.tools.ws.ui.bot.test.ti.wizard.RESTFullExplorerWizard;
-import org.junit.Test;
-
-/**
- * Test operates on exploring RESTFul services in RESTful explorer
- *
- * TO DO: I have to add rest libraries for EAP 5.1
- * @author jjankovi
- *
- */
-public class RESTfulServicesExplorerTest extends RESTfulTestBase {
-
- private RESTFullExplorerWizard restfulWizard = null;
-
- protected String getWsProjectName() {
- return "RestServicesExplorer";
- }
-
- protected String getWsPackage() {
- return "org.rest.explorer.services.test";
- }
-
- protected String getWsName() {
- return "RestService";
- }
-
- @Override
- public void setup() {
- if (!projectExists(getWsProjectName())) {
- projectHelper.createProject(getWsProjectName());
- }
- if (!isRestSupportEnabled(getWsProjectName())) {
- addRestSupport(getWsProjectName());
- }
- }
-
- @Override
- public void cleanup() {
- if (projectExists(getWsProjectName())) {
- removeRestSupport(getWsProjectName());
- }
- }
-
- @Test
- public void testAddingSimpleRESTMethods() {
-
- if (!projectExplorer.isFilePresent(getWsProjectName(), "Java Resources",
"src", getWsPackage(), getWsName() + ".java")) {
- projectHelper.createClass(getWsProjectName(), getWsPackage(), getWsName());
- }
-
- resourceHelper.copyResourceToClass(bot.editorByTitle(getWsName() + ".java"),
- RESTfulServicesExplorerTest.class.
- getResourceAsStream("/resources/restful/BasicRestfulWS.java.ws"),
- false, getWsPackage(), getWsName());
- /**
- * workaround
- */
- eclipse.cleanAllProjects();
- bot.sleep(Timing.time3S());
-
- restfulWizard = new RESTFullExplorerWizard(getWsProjectName());
- SWTBotTreeItem[] restServices = restfulWizard.getAllRestServices();
-
- assertTrue(restServices.length == 4);
- assertTrue(areAllRestServicesPresent(restServices));
-
- for (SWTBotTreeItem restService : restServices) {
- assertTrue(restfulWizard.getPathForRestFulService(restService).equals("/rest"));
- assertTrue(restfulWizard.getConsumesInfo(restService).equals("*/*"));
- assertTrue(restfulWizard.getProducesInfo(restService).equals("*/*"));
- }
- }
-
- @Test
- public void testAddingAdvancedRESTMethods() {
-
- if (!projectExplorer.isFilePresent(getWsProjectName(), "Java Resources",
"src", getWsPackage(), getWsName() + ".java")) {
- projectHelper.createClass(getWsProjectName(), getWsPackage(), getWsName());
- }
-
- resourceHelper.copyResourceToClass(bot.editorByTitle(getWsName() + ".java"),
- RESTfulServicesExplorerTest.class.
-
getResourceAsStream("/resources/restful/AdvancedRestfulWS.java.ws"),
- false, getWsPackage(), getWsName());
- /**
- * workaround
- */
- eclipse.cleanAllProjects();
- bot.sleep(Timing.time3S());
-
- restfulWizard = new RESTFullExplorerWizard(getWsProjectName());
- SWTBotTreeItem[] restServices = restfulWizard.getAllRestServices();
-
- assertTrue(restServices.length == 4);
- assertTrue(areAllRestServicesPresent(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
- public void testEditingSimpleRESTMethods() {
- if (!projectExplorer.isFilePresent(getWsProjectName(), "Java Resources",
"src", getWsPackage(), getWsName() + ".java")) {
- projectHelper.createClass(getWsProjectName(), getWsPackage(), getWsName());
- }
-
- resourceHelper.copyResourceToClass(bot.editorByTitle(getWsName() + ".java"),
- RESTfulServicesExplorerTest.class.
- getResourceAsStream("/resources/restful/BasicRestfulWS.java.ws"),
- false, getWsPackage(), getWsName());
-
- /**
- * workaround
- */
- eclipse.cleanAllProjects();
- bot.sleep(Timing.time3S());
-
- restfulWizard = new RESTFullExplorerWizard(getWsProjectName());
- SWTBotTreeItem[] restServices = restfulWizard.getAllRestServices();
-
- assertTrue(areAllRestServicesPresent(restServices));
-
- resourceHelper.replaceInEditor(bot.activeEditor().toTextEditor(), "@DELETE",
"@GET");
-
- /**
- * workaround
- */
- eclipse.cleanAllProjects();
- bot.sleep(Timing.time3S());
-
- restfulWizard = new RESTFullExplorerWizard(getWsProjectName());
- restServices = restfulWizard.getAllRestServices();
-
- assertFalse(areAllRestServicesPresent(restServices));
-
- for (SWTBotTreeItem restService : restServices) {
- if
(restfulWizard.getRestServiceName(restService).equals(RESTFulAnnotations.DELETE.getLabel()))
{
- fail("There should not be DELETE RESTful services");
- }
- }
-
- }
-
- @Test
- public void testEditingAdvancedRESTMethods() {
- if (!projectExplorer.isFilePresent(getWsProjectName(), "Java Resources",
"src", getWsPackage(), getWsName() + ".java")) {
- projectHelper.createClass(getWsProjectName(), getWsPackage(), getWsName());
- }
-
- resourceHelper.copyResourceToClass(bot.editorByTitle(getWsName() + ".java"),
- RESTfulServicesExplorerTest.class.
- getResourceAsStream("/resources/restful/AdvancedRestfulWS.java.ws"),
- false, getWsPackage(), getWsName());
-
- /**
- * workaround
- */
- eclipse.cleanAllProjects();
- bot.sleep(Timing.time3S());
-
- restfulWizard = new RESTFullExplorerWizard(getWsProjectName());
- 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("*/*"));
- }
- }
-
- resourceHelper.replaceInEditor(bot.activeEditor().toTextEditor(),
"/delete/{id}", "delete/edited/{id}");
- resourceHelper.replaceInEditor(bot.activeEditor().toTextEditor(), "@DELETE",
- "@DELETE" + LINE_SEPARATOR +
"@Produces(\"text/plain\")");
-
- /**
- * workaround
- */
- eclipse.cleanAllProjects();
- bot.sleep(Timing.time3S());
-
- restfulWizard = new RESTFullExplorerWizard(getWsProjectName());
- restServices = restfulWizard.getAllRestServices();
-
- for (SWTBotTreeItem restService : restServices) {
- if
(restfulWizard.getRestServiceName(restService).equals(RESTFulAnnotations.DELETE.getLabel()))
{
- assertTrue(restfulWizard.getPathForRestFulService(restService).equals("/rest/delete/edited/{id}"));
- assertTrue(restfulWizard.getProducesInfo(restService).equals("text/plain"));
- }
- }
- }
-
- @Test
- public void testDeletingRESTMethods() {
- if (!projectExplorer.isFilePresent(getWsProjectName(), "Java Resources",
"src", getWsPackage(), getWsName() + ".java")) {
- projectHelper.createClass(getWsProjectName(), getWsPackage(), getWsName());
- }
-
- resourceHelper.copyResourceToClass(bot.editorByTitle(getWsName() + ".java"),
- RESTfulServicesExplorerTest.class.
- getResourceAsStream("/resources/restful/BasicRestfulWS.java.ws"),
- false, getWsPackage(), getWsName());
-
- /**
- * workaround
- */
- eclipse.cleanAllProjects();
- bot.sleep(Timing.time3S());
-
- restfulWizard = new RESTFullExplorerWizard(getWsProjectName());
- SWTBotTreeItem[] restServices = restfulWizard.getAllRestServices();
-
- assertTrue(restServices.length == 4);
-
- resourceHelper.copyResourceToClass(bot.editorByTitle(getWsName() + ".java"),
- RESTfulServicesExplorerTest.class.
- getResourceAsStream("/resources/restful/EmptyRestfulWS.java.ws"),
- false, getWsPackage(), getWsName());
-
- /**
- * workaround
- */
- eclipse.cleanAllProjects();
- bot.sleep(Timing.time3S());
-
- restfulWizard = new RESTFullExplorerWizard(getWsProjectName());
- restServices = restfulWizard.getAllRestServices();
-
- assertTrue(restServices.length == 0);
-
- }
-
- private boolean areAllRestServicesPresent(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;
- }
- return true;
- }
-
-}
Added:
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
(rev 0)
+++
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/explorer/RESTfulSupportTest.java 2012-01-10
09:17:46 UTC (rev 37737)
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * 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";
+ }
+
+ protected String getWsPackage() {
+ return "org.rest.explorer.validation.test";
+ }
+
+ protected String getWsName() {
+ return "RestService";
+ }
+
+ @Before
+ public void setup() {
+ if (!projectExists(getWsProjectName())) {
+ projectHelper.createProject(getWsProjectName());
+ }
+ }
+
+
+ @Test
+ public void testJAXRSExplorerSupport() {
+
+ addRestSupport(getWsProjectName());
+ assertTrue(isRestSupportEnabled(getWsProjectName()));
+
+ }
+
+}
Added:
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/explorer/RESTfulValidationTest.java
===================================================================
---
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/explorer/RESTfulValidationTest.java
(rev 0)
+++
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/explorer/RESTfulValidationTest.java 2012-01-10
09:17:46 UTC (rev 37737)
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * 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.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
+import org.jboss.tools.ui.bot.ext.Timing;
+import org.jboss.tools.ws.ui.bot.test.WSTestBase;
+import org.jboss.tools.ws.ui.bot.test.utils.NodeContextUtil;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ *
+ * @author jjankovi
+ *
+ */
+public class RESTfulValidationTest extends WSTestBase {
+
+ private static final String CONFIGURE_MENU_LABEL = "Configure";
+ private static final String REST_SUPPORT_MENU_LABEL_ADD = "Add JAX-RS 1.1
support...";
+ private static final String REST_SUPPORT_MENU_LABEL_REMOVE = "Remove JAX-RS 1.1
support...";
+ private static final String REST_EXPLORER_LABEL = "JAX-RS REST Web Services";
+
+ protected String getWsProjectName() {
+ return "RestExplorerTest";
+ }
+
+ protected String getWsPackage() {
+ return "org.rest.explorer.validation.test";
+ }
+
+ protected String getWsName() {
+ return "RestService";
+ }
+
+ @Before
+ public void setup() {
+ if (!projectExists(getWsProjectName())) {
+ projectHelper.createProject(getWsProjectName());
+ }
+ }
+
+
+ @Test
+ public void testSupportJAX_RS1_1_Explorer() {
+
+ addRestSupport(getWsProjectName());
+
+ projectExplorer.selectProject(getWsProjectName());
+ SWTBotTree tree = projectExplorer.bot().tree();
+ SWTBotTreeItem item = tree.getTreeItem(getWsProjectName());
+ assertTrue(NodeContextUtil.nodeContextMenu(tree, item, CONFIGURE_MENU_LABEL,
+ REST_SUPPORT_MENU_LABEL_REMOVE).isVisible());
+ assertTrue(projectExplorer.isFilePresent(getWsProjectName(), REST_EXPLORER_LABEL));
+
+ }
+
+ private void addRestSupport(String wsProjectName) {
+ projectExplorer.selectProject(wsProjectName);
+ SWTBotTree tree = projectExplorer.bot().tree();
+ SWTBotTreeItem item = tree.getTreeItem(wsProjectName);
+ item.expand();
+ NodeContextUtil.nodeContextMenu(tree, item, CONFIGURE_MENU_LABEL,
+ REST_SUPPORT_MENU_LABEL_ADD).click();
+ bot.sleep(Timing.time2S());
+ util.waitForNonIgnoredJobs();
+ }
+
+}
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-01-10
09:08:41 UTC (rev 37736)
+++
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/validation/RESTfulValidationTest.java 2012-01-10
09:17:46 UTC (rev 37737)
@@ -12,6 +12,8 @@
package org.jboss.tools.ws.ui.bot.test.rest.validation;
import org.jboss.tools.ws.ui.bot.test.rest.RESTfulTestBase;
+import org.jboss.tools.ws.ui.bot.test.rest.explorer.RESTfulExplorerTest;
+import org.junit.Ignore;
/**
* Test operates on JAX-RS validation
@@ -32,22 +34,50 @@
return "RestService";
}
+ @Override
+ public void setup() {
+ if (!projectExists(getWsProjectName())) {
+ projectHelper.createProject(getWsProjectName());
+ }
+ if (!projectExplorer.isFilePresent(getWsProjectName(), "Java Resources",
+ "src", getWsPackage(), getWsName() + ".java")) {
+ projectHelper.createClass(getWsProjectName(), getWsPackage(), getWsName());
+ }
+ }
+ @Ignore
public void testCorrectValueValidation() {
- //not implemented yet
+
+ resourceHelper.copyResourceToClass(bot.editorByTitle(getWsName() + ".java"),
+ RESTfulExplorerTest.class.
+ getResourceAsStream("/resources/restful/CorrectRestWS.java.ws"),
+ false, getWsPackage(), getWsName());
+
+ assertTrue(getRESTValidationErrorsAfterCleanBuild(getWsProjectName()).length == 0);
+
}
-
+ @Ignore
public void testBadValueValidation() {
- //not implemented yet
+ resourceHelper.copyResourceToClass(bot.editorByTitle(getWsName() + ".java"),
+ RESTfulExplorerTest.class.
+ getResourceAsStream("/resources/restful/BadRestWS.java.ws"),
+ false, getWsPackage(), getWsName());
+
+ assertTrue("" +
getRESTValidationErrorsAfterCleanBuild(getWsProjectName()).length,
+ getRESTValidationErrorsAfterCleanBuild(getWsProjectName()).length == 1);
}
-
+ @Ignore
public void testCorrectToBadValueValidation() {
//not implemented yet
}
-
+ @Ignore
+ public void testBadToCorrectValueValidation() {
+ //not implemented yet
+ }
+ @Ignore
public void testValidatorDisabling() {
//not implemented yet
}
-
+ @Ignore
public void testValidatorReenabling() {
//not implemented yet
}
Modified:
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/sample/SampleRESTTestBase.java
===================================================================
---
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/sample/SampleRESTTestBase.java 2012-01-10
09:08:41 UTC (rev 37736)
+++
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/sample/SampleRESTTestBase.java 2012-01-10
09:17:46 UTC (rev 37737)
@@ -11,6 +11,8 @@
package org.jboss.tools.ws.ui.bot.test.sample;
+import org.jboss.tools.ui.bot.ext.config.Annotations.Require;
+import org.jboss.tools.ui.bot.ext.config.Annotations.Server;
import org.jboss.tools.ws.ui.bot.test.uiutils.wizards.Type;
/**
@@ -18,6 +20,7 @@
* @author jjankovi
*
*/
+@Require(server=@Server(), perspective="Java EE")
public class SampleRESTTestBase extends SampleWSBase {
protected void createSampleRESTWS(String project, String name, String pkg,
Added: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/todo.txt
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/todo.txt (rev
0)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/todo.txt 2012-01-10 09:17:46 UTC (rev
37737)
@@ -0,0 +1,3 @@
+* manually add resteasy libs to project with EAP target server (RESTfulTestBase)
+* enable/disable JAX-RS validator (RESTfulTestBase)
+* test operating on JAX-RS completion
\ No newline at end of file