JBoss Tools SVN: r40647 - in trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal: ui/wizard and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2012-04-30 11:19:06 -0400 (Mon, 30 Apr 2012)
New Revision: 40647
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/UserDelegate.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardPageModel.java
Log:
[JBIDE-11715] adding key to OpenShift when creating a domain. Storing new key with a default name "jbosstools"
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/UserDelegate.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/UserDelegate.java 2012-04-30 14:27:39 UTC (rev 40646)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/UserDelegate.java 2012-04-30 15:19:06 UTC (rev 40647)
@@ -29,8 +29,11 @@
import com.openshift.client.IDomain;
import com.openshift.client.IEmbeddableCartridge;
import com.openshift.client.IGearProfile;
+import com.openshift.client.IOpenShiftSSHKey;
+import com.openshift.client.ISSHPublicKey;
import com.openshift.client.IUser;
import com.openshift.client.OpenShiftException;
+import com.openshift.client.OpenShiftUnknonwSSHKeyTypeException;
public class UserDelegate {
private IUser delegate;
@@ -232,4 +235,13 @@
public void setConnected(boolean connected) {
this.connected = connected;
}
+
+ public IOpenShiftSSHKey getSSHKeyByPublicKey(String publicKey) throws SocketTimeoutException, OpenShiftUnknonwSSHKeyTypeException, OpenShiftException {
+ return delegate.getSSHKeyByPublicKey(publicKey);
+ }
+
+ public IOpenShiftSSHKey putSSHKey(String name, ISSHPublicKey key) throws OpenShiftException, SocketTimeoutException {
+ return delegate.putSSHKey(name, key);
+ }
+
}
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardPageModel.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardPageModel.java 2012-04-30 14:27:39 UTC (rev 40646)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardPageModel.java 2012-04-30 15:19:06 UTC (rev 40647)
@@ -22,6 +22,7 @@
import org.jboss.tools.openshift.express.internal.ui.utils.FileUtils;
import com.openshift.client.IDomain;
+import com.openshift.client.IOpenShiftSSHKey;
import com.openshift.client.ISSHPublicKey;
import com.openshift.client.OpenShiftException;
import com.openshift.client.SSHKeyPair;
@@ -35,6 +36,8 @@
public static final String LIBRA_KEY = "libra_id_rsa";
private static final String PUBLIC_KEY_SUFFIX = ".pub";
+ private static final String SSHKEY_DEFAULT_NAME = "jbosstools"; //$NON-NLS-1$
+
public static final String PROPERTY_DOMAIN_ID = "domainId";
public static final String PROPERTY_SSHKEY = "sshKey";
@@ -99,7 +102,12 @@
}
public void createDomain() throws OpenShiftException, IOException {
- IDomain domain = user.createDomain(domainId);
+ user.createDomain(domainId);
+ ISSHPublicKey sshKey = loadSshKey();
+ IOpenShiftSSHKey sshKeyResource = user.getSSHKeyByPublicKey(sshKey.getPublicKey());
+ if (sshKeyResource == null) {
+ user.putSSHKey(SSHKEY_DEFAULT_NAME, sshKey);
+ }
}
public String getSshKey() {
12 years, 7 months
JBoss Tools SVN: r40646 - trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test.
by jbosstools-commits@lists.jboss.org
Author: jjankovi
Date: 2012-04-30 10:27:39 -0400 (Mon, 30 Apr 2012)
New Revision: 40646
Modified:
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/WSAllBotTests.java
Log:
WSAllBotTests now includes new QueryParamSupportTest as well
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-04-30 14:27:10 UTC (rev 40645)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/WSAllBotTests.java 2012-04-30 14:27:39 UTC (rev 40646)
@@ -12,8 +12,9 @@
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.PathAnnotationSupportTest;
+import org.jboss.tools.ws.ui.bot.test.rest.QueryParamSupportTest;
import org.jboss.tools.ws.ui.bot.test.rest.completion.RESTfulCompletionTest;
-import org.jboss.tools.ws.ui.bot.test.rest.explorer.RESTfulExplorerTest;
import org.jboss.tools.ws.ui.bot.test.rest.explorer.RESTfulSupportTest;
import org.jboss.tools.ws.ui.bot.test.rest.validation.ApplicationPathParameterTest;
import org.jboss.tools.ws.ui.bot.test.rest.validation.RESTfulValidationTest;
@@ -57,7 +58,8 @@
SimpleRESTWebServiceTest.class,
AnnotationPropertiesTest.class,
RESTfulSupportTest.class,
- RESTfulExplorerTest.class,
+ PathAnnotationSupportTest.class,
+ QueryParamSupportTest.class,
RESTfulValidationTest.class,
RESTfulCompletionTest.class,
ApplicationPathParameterTest.class,
12 years, 7 months
JBoss Tools SVN: r40645 - trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest.
by jbosstools-commits@lists.jboss.org
Author: jjankovi
Date: 2012-04-30 10:27:10 -0400 (Mon, 30 Apr 2012)
New Revision: 40645
Added:
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/QueryParamSupportTest.java
Log:
new QueryParamSupportTest added
Added: 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 (rev 0)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/QueryParamSupportTest.java 2012-04-30 14:27:10 UTC (rev 40645)
@@ -0,0 +1,173 @@
+/*******************************************************************************
+ * 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";
+
+ @Override
+ protected String getWsProjectName() {
+ return projectName;
+ }
+
+ @Override
+ public void cleanup() {
+ bot.activeEditor().toTextEditor().save();
+ }
+
+ @Test
+ public void testSupportInExplorer() {
+
+ String queryParam1 = "param1";
+ String queryParam2 = "param2";
+ String queryType = "java.lang.String";
+
+
+ packageExplorer.openFile(getWsProjectName(), "src",
+ getWsPackage(), getWsName() + ".java").toTextEditor();
+ resourceHelper.copyResourceToClass(bot.editorByTitle(getWsName() + ".java"),
+ PathAnnotationSupportTest.class.getResourceAsStream(QUERY_ONE_PARAM_RESOURCE),
+ false, false, getWsPackage(), getWsName(), queryParam1, queryType);
+ 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 + ":" + queryType + "}", path);
+
+
+
+ resourceHelper.copyResourceToClass(bot.editorByTitle(getWsName() + ".java"),
+ PathAnnotationSupportTest.class.getResourceAsStream(QUERY_TWO_PARAM_RESOURCE),
+ false, false, getWsPackage(), getWsName(),
+ queryParam1, queryType, queryParam2, queryType);
+ 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 + "}&" +
+ queryParam2 + "={" + queryParam2 + ":" + queryType + "}", path);
+ }
+
+ @Test
+ public void testEditingQueryParam() {
+
+ String queryParam1 = "param1";
+ String queryParam1New = "newParam1";
+ String queryParam2 = "param2";
+ String queryParam2New = "newParam2";
+ String queryType = "java.lang.String";
+
+ packageExplorer.openFile(getWsProjectName(), "src",
+ getWsPackage(), getWsName() + ".java").toTextEditor();
+ resourceHelper.copyResourceToClass(bot.editorByTitle(getWsName() + ".java"),
+ PathAnnotationSupportTest.class.getResourceAsStream(QUERY_TWO_PARAM_RESOURCE),
+ false, false, getWsPackage(), getWsName(),
+ queryParam1, queryType, queryParam2, queryType);
+ bot.sleep(Timing.time2S());
+ 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 testEditingTypeOfParam() {
+
+ String queryParam1 = "param1";
+ String queryParam2 = "param2";
+ String queryType1 = "java.lang.String";
+ String queryType2 = "java.lang.Integer";
+ String queryTypeNew = "java.lang.Long";
+
+ packageExplorer.openFile(getWsProjectName(), "src",
+ getWsPackage(), getWsName() + ".java").toTextEditor();
+ resourceHelper.copyResourceToClass(bot.editorByTitle(getWsName() + ".java"),
+ PathAnnotationSupportTest.class.getResourceAsStream(QUERY_TWO_PARAM_RESOURCE),
+ false, false, getWsPackage(), getWsName(),
+ queryParam1, queryType1, queryParam2, queryType2);
+ bot.sleep(Timing.time2S());
+ 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);
+
+ }
+
+}
12 years, 7 months
JBoss Tools SVN: r40644 - trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/resources/restful.
by jbosstools-commits@lists.jboss.org
Author: jjankovi
Date: 2012-04-30 10:26:42 -0400 (Mon, 30 Apr 2012)
New Revision: 40644
Added:
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/resources/restful/QueryOneParam.java.ws
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/resources/restful/QueryTwoParam.java.ws
Log:
resource files for QueryParamSupportTest added
Added: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/resources/restful/QueryOneParam.java.ws
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/resources/restful/QueryOneParam.java.ws (rev 0)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/resources/restful/QueryOneParam.java.ws 2012-04-30 14:26:42 UTC (rev 40644)
@@ -0,0 +1,15 @@
+package {0};
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.QueryParam;
+
+@Path("/rest")
+public class {1} '{'
+
+ @GET
+ public void method(@QueryParam("{2}") {3} parameter) '{'
+
+ '}'
+
+'}'
Added: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/resources/restful/QueryTwoParam.java.ws
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/resources/restful/QueryTwoParam.java.ws (rev 0)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/resources/restful/QueryTwoParam.java.ws 2012-04-30 14:26:42 UTC (rev 40644)
@@ -0,0 +1,16 @@
+package {0};
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.QueryParam;
+
+@Path("/rest")
+public class {1} '{'
+
+ @GET
+ public void method(@QueryParam("{2}") {3} parameter1,
+ @QueryParam("{4}") {5} parameter2) '{'
+
+ '}'
+
+'}'
12 years, 7 months
JBoss Tools SVN: r40643 - in trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest: validation and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: jjankovi
Date: 2012-04-30 10:26:05 -0400 (Mon, 30 Apr 2012)
New Revision: 40643
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/validation/RESTfulValidationTest.java
Log:
modifying name of class for which the resource file is needed
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-04-30 14:22:47 UTC (rev 40642)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/completion/RESTfulCompletionTest.java 2012-04-30 14:26:05 UTC (rev 40643)
@@ -16,7 +16,6 @@
import org.jboss.tools.ui.bot.ext.helper.ContentAssistHelper;
import org.jboss.tools.ws.ui.bot.test.rest.RESTfulTestBase;
-import org.jboss.tools.ws.ui.bot.test.rest.explorer.RESTfulExplorerTest;
import org.junit.Test;
/**
@@ -44,7 +43,7 @@
packageExplorer.openFile(getWsProjectName(), "src",
getWsPackage(), getWsName() + ".java").toTextEditor();
resourceHelper.copyResourceToClass(bot.editorByTitle(getWsName() + ".java"),
- RESTfulExplorerTest.class.getResourceAsStream(SIMPLE_REST_WS_RESOURCE),
+ RESTfulCompletionTest.class.getResourceAsStream(SIMPLE_REST_WS_RESOURCE),
false, getWsPackage(), getWsName(), GET_METHOD_PATH, "");
packageExplorer.openFile(getWsProjectName(), "src",
@@ -61,7 +60,7 @@
packageExplorer.openFile(getWsProjectName(), "src",
getWsPackage(), getWsName() + ".java").toTextEditor();
resourceHelper.copyResourceToClass(bot.editorByTitle(getWsName() + ".java"),
- RESTfulExplorerTest.class.getResourceAsStream(SIMPLE_REST_WS_RESOURCE),
+ RESTfulCompletionTest.class.getResourceAsStream(SIMPLE_REST_WS_RESOURCE),
false, getWsPackage(), getWsName(), GET_METHOD_PATH, CORRECT_PATH_PARAM);
packageExplorer.openFile(getWsProjectName(), "src",
@@ -79,7 +78,7 @@
packageExplorer.openFile(getWsProjectName(), "src",
getWsPackage(), getWsName() + ".java").toTextEditor();
resourceHelper.copyResourceToClass(bot.editorByTitle(getWsName() + ".java"),
- RESTfulExplorerTest.class.getResourceAsStream(SIMPLE_REST_WS_RESOURCE),
+ RESTfulCompletionTest.class.getResourceAsStream(SIMPLE_REST_WS_RESOURCE),
false, getWsPackage(), getWsName(), GET_METHOD_PATH, CORRECT_PATH_PARAM);
packageExplorer.openFile(getWsProjectName(), "src",
@@ -96,7 +95,7 @@
packageExplorer.openFile(getWsProjectName(), "src",
getWsPackage(), getWsName() + ".java").toTextEditor();
resourceHelper.copyResourceToClass(bot.editorByTitle(getWsName() + ".java"),
- RESTfulExplorerTest.class.getResourceAsStream(SIMPLE_REST_WS_RESOURCE),
+ RESTfulCompletionTest.class.getResourceAsStream(SIMPLE_REST_WS_RESOURCE),
false, getWsPackage(), getWsName(), GET_METHOD_PATH, INCORRECT_PATH_PARAM);
packageExplorer.openFile(getWsProjectName(), "src",
@@ -114,7 +113,7 @@
packageExplorer.openFile(getWsProjectName(), "src",
getWsPackage(), getWsName() + ".java").toTextEditor();
resourceHelper.copyResourceToClass(bot.editorByTitle(getWsName() + ".java"),
- RESTfulExplorerTest.class.getResourceAsStream(SIMPLE_REST_WS_RESOURCE),
+ RESTfulCompletionTest.class.getResourceAsStream(SIMPLE_REST_WS_RESOURCE),
false, getWsPackage(), getWsName(), GET_METHOD_PATH, INCORRECT_PATH_PARAM);
packageExplorer.openFile(getWsProjectName(), "src",
@@ -131,7 +130,7 @@
packageExplorer.openFile(getWsProjectName(), "src",
getWsPackage(), getWsName() + ".java").toTextEditor();
resourceHelper.copyResourceToClass(bot.editorByTitle(getWsName() + ".java"),
- RESTfulExplorerTest.class.getResourceAsStream(SIMPLE_REST_WS_RESOURCE),
+ RESTfulCompletionTest.class.getResourceAsStream(SIMPLE_REST_WS_RESOURCE),
false, getWsPackage(), getWsName(), GET_METHOD_PATH, INCORRECT_PATH_PARAM);
packageExplorer.openFile(getWsProjectName(), "src",
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-04-30 14:22:47 UTC (rev 40642)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/validation/RESTfulValidationTest.java 2012-04-30 14:26:05 UTC (rev 40643)
@@ -12,7 +12,6 @@
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.Test;
/**
@@ -37,7 +36,7 @@
packageExplorer.openFile(getWsProjectName(), "src",
getWsPackage(), getWsName() + ".java").toTextEditor();
resourceHelper.copyResourceToClass(bot.editorByTitle(getWsName() + ".java"),
- RESTfulExplorerTest.class.getResourceAsStream(SIMPLE_REST_WS_RESOURCE),
+ RESTfulValidationTest.class.getResourceAsStream(SIMPLE_REST_WS_RESOURCE),
false, getWsPackage(), getWsName(), GET_METHOD_PATH, CORRECT_PATH_PARAM);
assertTrue(restfulHelper.getRESTValidationErrors(getWsProjectName()).length == 0);
@@ -49,7 +48,7 @@
packageExplorer.openFile(getWsProjectName(), "src",
getWsPackage(), getWsName() + ".java").toTextEditor();
resourceHelper.copyResourceToClass(bot.editorByTitle(getWsName() + ".java"),
- RESTfulExplorerTest.class.getResourceAsStream(SIMPLE_REST_WS_RESOURCE),
+ RESTfulValidationTest.class.getResourceAsStream(SIMPLE_REST_WS_RESOURCE),
false, getWsPackage(), getWsName(), GET_METHOD_PATH, BAD_PATH_PARAM);
assertTrue("" + restfulHelper.getRESTValidationErrors(getWsProjectName()).length,
@@ -62,13 +61,13 @@
packageExplorer.openFile(getWsProjectName(), "src",
getWsPackage(), getWsName() + ".java").toTextEditor();
resourceHelper.copyResourceToClass(bot.editorByTitle(getWsName() + ".java"),
- RESTfulExplorerTest.class.getResourceAsStream(SIMPLE_REST_WS_RESOURCE),
+ RESTfulValidationTest.class.getResourceAsStream(SIMPLE_REST_WS_RESOURCE),
false, getWsPackage(), getWsName(), GET_METHOD_PATH, CORRECT_PATH_PARAM);
packageExplorer.openFile(getWsProjectName(), "src",
getWsPackage(), getWsName() + ".java").toTextEditor();
resourceHelper.copyResourceToClass(bot.editorByTitle(getWsName() + ".java"),
- RESTfulExplorerTest.class.getResourceAsStream(SIMPLE_REST_WS_RESOURCE),
+ RESTfulValidationTest.class.getResourceAsStream(SIMPLE_REST_WS_RESOURCE),
false, getWsPackage(), getWsName(), GET_METHOD_PATH, BAD_PATH_PARAM);
assertTrue("" + restfulHelper.getRESTValidationErrors(getWsProjectName()).length,
@@ -81,13 +80,13 @@
packageExplorer.openFile(getWsProjectName(), "src",
getWsPackage(), getWsName() + ".java").toTextEditor();
resourceHelper.copyResourceToClass(bot.editorByTitle(getWsName() + ".java"),
- RESTfulExplorerTest.class.getResourceAsStream(SIMPLE_REST_WS_RESOURCE),
+ RESTfulValidationTest.class.getResourceAsStream(SIMPLE_REST_WS_RESOURCE),
false, getWsPackage(), getWsName(), GET_METHOD_PATH, BAD_PATH_PARAM);
packageExplorer.openFile(getWsProjectName(), "src",
getWsPackage(), getWsName() + ".java").toTextEditor();
resourceHelper.copyResourceToClass(bot.editorByTitle(getWsName() + ".java"),
- RESTfulExplorerTest.class.getResourceAsStream(SIMPLE_REST_WS_RESOURCE),
+ RESTfulValidationTest.class.getResourceAsStream(SIMPLE_REST_WS_RESOURCE),
false, getWsPackage(), getWsName(), GET_METHOD_PATH, CORRECT_PATH_PARAM);
assertTrue("" + restfulHelper.getRESTValidationErrors(getWsProjectName()).length,
@@ -102,7 +101,7 @@
packageExplorer.openFile(getWsProjectName(), "src",
getWsPackage(), getWsName() + ".java").toTextEditor();
resourceHelper.copyResourceToClass(bot.editorByTitle(getWsName() + ".java"),
- RESTfulExplorerTest.class.getResourceAsStream(SIMPLE_REST_WS_RESOURCE),
+ RESTfulValidationTest.class.getResourceAsStream(SIMPLE_REST_WS_RESOURCE),
false, getWsPackage(), getWsName(), GET_METHOD_PATH, BAD_PATH_PARAM);
assertTrue("" + restfulHelper.getRESTValidationErrors(getWsProjectName()).length,
12 years, 7 months
JBoss Tools SVN: r40642 - trunk/build/aggregate.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2012-04-30 10:22:47 -0400 (Mon, 30 Apr 2012)
New Revision: 40642
Modified:
trunk/build/aggregate/pom.xml
Log:
remove deprecated bottests-site ref from pom
Modified: trunk/build/aggregate/pom.xml
===================================================================
--- trunk/build/aggregate/pom.xml 2012-04-30 14:22:04 UTC (rev 40641)
+++ trunk/build/aggregate/pom.xml 2012-04-30 14:22:47 UTC (rev 40642)
@@ -20,7 +20,6 @@
mvn clean install -f site/pom.xml -Dcollect.zips.skip
mvn clean install -f soa-site/pom.xml -Dcollect.zips.skip
mvn clean install -f webtools-site/pom.xml
- mvn clean install -f bottests-site/pom.xml
mvn clean install -f coretests-site/pom.xml
mvn clean install -f soatests-site/pom.xml
...
12 years, 7 months
JBoss Tools SVN: r40641 - in trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest: explorer and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: jjankovi
Date: 2012-04-30 10:22:04 -0400 (Mon, 30 Apr 2012)
New Revision: 40641
Added:
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/PathAnnotationSupportTest.java
Removed:
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/explorer/RESTfulExplorerTest.java
Log:
renaming and replacing the location of RESTfulExplorerTest
Added: 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 (rev 0)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/PathAnnotationSupportTest.java 2012-04-30 14:22:04 UTC (rev 40641)
@@ -0,0 +1,230 @@
+/*******************************************************************************
+ * 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;
+
+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;
+
+/**
+ * Test operates on exploring RESTFul services in RESTful explorer
+ *
+ * @author jjankovi
+ *
+ */
+public class PathAnnotationSupportTest extends RESTfulTestBase {
+
+ private RESTFullExplorerWizard restfulWizard = null;
+
+ private String restEmptyProjectName = "restEmpty";
+
+ @Override
+ protected String getWsProjectName() {
+ return restEmptyProjectName;
+ }
+
+ @Override
+ public void cleanup() {
+ bot.activeEditor().toTextEditor().save();
+ }
+
+ @Test
+ public void testAddingSimpleRESTMethods() {
+
+ packageExplorer.openFile(getWsProjectName(), "src",
+ getWsPackage(), getWsName() + ".java").toTextEditor();
+ resourceHelper.copyResourceToClass(bot.editorByTitle(getWsName() + ".java"),
+ PathAnnotationSupportTest.class.getResourceAsStream(BASIC_WS_RESOURCE),
+ false, false, getWsPackage(), getWsName());
+ bot.sleep(Timing.time2S());
+
+ restfulWizard = new RESTFullExplorerWizard(getWsProjectName());
+ 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
+ public void testAddingAdvancedRESTMethods() {
+
+ packageExplorer.openFile(getWsProjectName(), "src",
+ getWsPackage(), getWsName() + ".java").toTextEditor();
+ resourceHelper.copyResourceToClass(bot.editorByTitle(getWsName() + ".java"),
+ PathAnnotationSupportTest.class.getResourceAsStream(ADVANCED_WS_RESOURCE),
+ false, false, getWsPackage(), getWsName());
+ bot.sleep(Timing.time2S());
+
+ restfulWizard = new RESTFullExplorerWizard(getWsProjectName());
+ 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
+ public void testEditingSimpleRESTMethods() {
+
+ packageExplorer.openFile(getWsProjectName(), "src",
+ getWsPackage(), getWsName() + ".java").toTextEditor();
+ resourceHelper.copyResourceToClass(bot.editorByTitle(getWsName() + ".java"),
+ PathAnnotationSupportTest.class.getResourceAsStream(BASIC_WS_RESOURCE),
+ false, false, getWsPackage(), getWsName());
+
+ 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);
+
+ 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));
+
+ for (SWTBotTreeItem restService : restServices) {
+ if (restfulWizard.getRestServiceName(restService).equals(RESTFulAnnotations.DELETE.getLabel())) {
+ fail("There should not be DELETE RESTful services");
+ }
+ }
+ }
+
+ @Test
+ public void testEditingAdvancedRESTMethods() {
+
+ packageExplorer.openFile(getWsProjectName(), "src",
+ getWsPackage(), getWsName() + ".java").toTextEditor();
+ resourceHelper.copyResourceToClass(bot.editorByTitle(getWsName() + ".java"),
+ PathAnnotationSupportTest.class.getResourceAsStream(ADVANCED_WS_RESOURCE),
+ false, false, getWsPackage(), getWsName());
+
+ restfulWizard = new RESTFullExplorerWizard(getWsProjectName());
+ SWTBotTreeItem[] restServices = restfulWizard.getAllRestServices();
+
+ assertTrue(restServices.length > 0);
+
+ 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("*/*"));
+ }
+ }
+
+ 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);
+
+ bot.sleep(Timing.time2S());
+ 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() {
+
+ packageExplorer.openFile(getWsProjectName(), "src",
+ getWsPackage(), getWsName() + ".java").toTextEditor();
+ resourceHelper.copyResourceToClass(bot.editorByTitle(getWsName() + ".java"),
+ PathAnnotationSupportTest.class.getResourceAsStream(BASIC_WS_RESOURCE),
+ false, false, getWsPackage(), getWsName());
+
+ 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.copyResourceToClass(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;
+ }
+ return true;
+ }
+
+}
Deleted: 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 2012-04-30 14:11:13 UTC (rev 40640)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/explorer/RESTfulExplorerTest.java 2012-04-30 14:22:04 UTC (rev 40641)
@@ -1,232 +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
- *
- * @author jjankovi
- *
- */
-public class RESTfulExplorerTest extends RESTfulTestBase {
-
- private RESTFullExplorerWizard restfulWizard = null;
-
- private String restEmptyProjectName = "restEmpty";
-
- @Override
- protected String getWsProjectName() {
- return restEmptyProjectName;
- }
-
- @Override
- public void cleanup() {
- bot.activeEditor().toTextEditor().save();
- }
-
- @Test
- public void testAddingSimpleRESTMethods() {
-
- packageExplorer.openFile(getWsProjectName(), "src",
- getWsPackage(), getWsName() + ".java").toTextEditor();
- resourceHelper.copyResourceToClass(bot.editorByTitle(getWsName() + ".java"),
- RESTfulExplorerTest.class.getResourceAsStream(BASIC_WS_RESOURCE),
- false, false, getWsPackage(), getWsName());
- bot.sleep(Timing.time2S());
-
- restfulWizard = new RESTFullExplorerWizard(getWsProjectName());
- 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
- public void testAddingAdvancedRESTMethods() {
-
- packageExplorer.openFile(getWsProjectName(), "src",
- getWsPackage(), getWsName() + ".java").toTextEditor();
- resourceHelper.copyResourceToClass(bot.editorByTitle(getWsName() + ".java"),
- RESTfulExplorerTest.class.getResourceAsStream(ADVANCED_WS_RESOURCE),
- false, false, getWsPackage(), getWsName());
- bot.sleep(Timing.time2S());
-
- restfulWizard = new RESTFullExplorerWizard(getWsProjectName());
- 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
- public void testEditingSimpleRESTMethods() {
-
- packageExplorer.openFile(getWsProjectName(), "src",
- getWsPackage(), getWsName() + ".java").toTextEditor();
- resourceHelper.copyResourceToClass(bot.editorByTitle(getWsName() + ".java"),
- RESTfulExplorerTest.class.getResourceAsStream(BASIC_WS_RESOURCE),
- false, false, getWsPackage(), getWsName());
-
- 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);
-
- 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));
-
- for (SWTBotTreeItem restService : restServices) {
- if (restfulWizard.getRestServiceName(restService).equals(RESTFulAnnotations.DELETE.getLabel())) {
- fail("There should not be DELETE RESTful services");
- }
- }
- }
-
- @Test
- public void testEditingAdvancedRESTMethods() {
-
- packageExplorer.openFile(getWsProjectName(), "src",
- getWsPackage(), getWsName() + ".java").toTextEditor();
- resourceHelper.copyResourceToClass(bot.editorByTitle(getWsName() + ".java"),
- RESTfulExplorerTest.class.getResourceAsStream(ADVANCED_WS_RESOURCE),
- false, false, getWsPackage(), getWsName());
-
- restfulWizard = new RESTFullExplorerWizard(getWsProjectName());
- SWTBotTreeItem[] restServices = restfulWizard.getAllRestServices();
-
- assertTrue(restServices.length > 0);
-
- 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("*/*"));
- }
- }
-
- 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);
-
- bot.sleep(Timing.time2S());
- 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() {
-
- packageExplorer.openFile(getWsProjectName(), "src",
- getWsPackage(), getWsName() + ".java").toTextEditor();
- resourceHelper.copyResourceToClass(bot.editorByTitle(getWsName() + ".java"),
- RESTfulExplorerTest.class.getResourceAsStream(BASIC_WS_RESOURCE),
- false, false, getWsPackage(), getWsName());
-
- 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.copyResourceToClass(bot.editorByTitle(getWsName() + ".java"),
- RESTfulExplorerTest.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;
- }
- return true;
- }
-
-}
12 years, 7 months
JBoss Tools SVN: r40640 - trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java.
by jbosstools-commits@lists.jboss.org
Author: dgeraskov
Date: 2012-04-30 10:11:13 -0400 (Mon, 30 Apr 2012)
New Revision: 40640
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/JpaUtil.java
Log:
https://issues.jboss.org/browse/JBIDE-11368
Fix NPEs. Previous commit went to JBIDE-11364 by mistake
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/JpaUtil.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/JpaUtil.java 2012-04-30 14:07:04 UTC (rev 40639)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/JpaUtil.java 2012-04-30 14:11:13 UTC (rev 40640)
@@ -32,7 +32,7 @@
* @throws JavaModelException
*/
public static Boolean isTypeImplementsInterface(IJavaProject javaProject, IType type, String interfaceName) throws JavaModelException{
- if (type == null) return false;
+ if (type == null) return null;
boolean hasInconsistency = false;
String[] interfaces = type.getSuperInterfaceNames();
List<String> resolvedInterfaceNames = new LinkedList<String>();
@@ -58,10 +58,11 @@
if (interfaceName.equals(fullName))
return true;
IType parentType = javaProject.findType(fullName);
- if (parentType != null){
- if (isTypeImplementsInterface(javaProject, parentType, interfaceName)){
- return true;
- }
+ Boolean recursiveResult = isTypeImplementsInterface(javaProject, parentType, interfaceName);
+ if (recursiveResult == null){
+ hasInconsistency = true;
+ } else if (recursiveResult == true){
+ return true;
}
} else {
hasInconsistency = true;
@@ -69,7 +70,10 @@
}
for (String interface_ : resolvedInterfaceNames) {
IType parentInterface = javaProject.findType(interface_);
- if (isTypeImplementsInterface(javaProject, parentInterface, interfaceName)){
+ Boolean recursiveResult = isTypeImplementsInterface(javaProject, parentInterface, interfaceName);
+ if (recursiveResult == null){
+ hasInconsistency = true;
+ } else if (recursiveResult == true){
return true;
}
}
12 years, 7 months
JBoss Tools SVN: r40639 - trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard.
by jbosstools-commits@lists.jboss.org
Author: dgeraskov
Date: 2012-04-30 10:07:04 -0400 (Mon, 30 Apr 2012)
New Revision: 40639
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateDdlWizard.java
Log:
https://issues.jboss.org/browse/JBIDE-11364
Reverted wrong change
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateDdlWizard.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateDdlWizard.java 2012-04-30 13:48:39 UTC (rev 40638)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateDdlWizard.java 2012-04-30 14:07:04 UTC (rev 40639)
@@ -63,7 +63,6 @@
prop.put("format", "true"); //$NON-NLS-1$ //$NON-NLS-2$
prop.put("scriptToConsole", "false"); //$NON-NLS-1$ //$NON-NLS-2$
prop.put("exportToDatabase", Boolean.toString(initPage.isExportToDB()));//$NON-NLS-1$
- prop.put("haltOnError", "true");//$NON-NLS-1$ //$NON-NLS-2$
wc.setAttribute(HibernateJpaPlatformUi.full_exporter_id + ".properties", prop); //$NON-NLS-1$
wc.setAttribute(HibernateJpaPlatformUi.full_exporter_id + ".extension_id", HibernateLaunchConstants.ATTR_PREFIX + "hbm2ddl"); //$NON-NLS-1$ //$NON-NLS-2$
12 years, 7 months
JBoss Tools SVN: r40638 - in trunk/hibernatetools/plugins: org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: dgeraskov
Date: 2012-04-30 09:48:39 -0400 (Mon, 30 Apr 2012)
New Revision: 40638
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/Messages.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/Messages.properties
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/JavaTypeDefImpl.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/JpaUtil.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/TypeImpl.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/GeneratedAnnotationImpl.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateDdlWizard.java
Log:
https://issues.jboss.org/browse/JBIDE-11364
Provide another message when class hierarchy is inconsistent
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/Messages.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/Messages.java 2012-04-30 12:56:41 UTC (rev 40637)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/Messages.java 2012-04-30 13:48:39 UTC (rev 40638)
@@ -38,6 +38,8 @@
public static final String IMPLEMENT_USER_TYPE_INTERFACE = "USER_TYPE_INTERFACE"; //$NON-NLS-1$
+ public static final String INCONSISTENT_TYPE_HIERARCHY = "INCONSISTENT_TYPE_HIERARCHY"; //$NON-NLS-1$
+
public static final String TYPE_CLASS_NOT_FOUND = "TYPE_CLASS_NOT_FOUND"; //$NON-NLS-1$
public static final String NAME_CANT_BE_EMPTY = "NAME_CANT_BE_EMPTY";//$NON-NLS-1$
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/Messages.properties
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/Messages.properties 2012-04-30 12:56:41 UTC (rev 40637)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/Messages.properties 2012-04-30 13:48:39 UTC (rev 40638)
@@ -9,6 +9,7 @@
TYPE_CANT_BE_EMPTY=Type could not be empty.
USER_TYPE_INTERFACE = Type class \"{0}\" should implement one of interfaces \"org.hibernate.type.Type\",\
\"org.hibernate.usertype.UserType\", \"org.hibernate.usertype.CompositeUserType\", \"org.hibernate.usertype.UserCollectionType\".
+INCONSISTENT_TYPE_HIERARCHY = Type hierarchy of the type \"{0}\" is inconsistent
TYPE_CLASS_NOT_FOUND = Type class \"{0}\" could not be found.
NAME_CANT_BE_EMPTY = Name could not be empty.
TYPE_DEF_DUPLICATE_NAME=Duplicate type definition named \"{0}\" defined in this persistence unit
\ No newline at end of file
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/JavaTypeDefImpl.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/JavaTypeDefImpl.java 2012-04-30 12:56:41 UTC (rev 40637)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/JavaTypeDefImpl.java 2012-04-30 13:48:39 UTC (rev 40638)
@@ -310,9 +310,13 @@
messages.add(HibernateJpaValidationMessage.buildMessage(
IMessage.HIGH_SEVERITY,TYPE_CLASS_NOT_FOUND, new String[]{typeClass}, this, this.getTypeClassTextRange(astRoot)));
} else {
- if (!JpaUtil.isTypeImplementsOneOfInterfaces(getJpaProject().getJavaProject(), lwType,
- JavaTypeDef.POSSIBLE_INTERFACES)){
+ Boolean isImplements = JpaUtil.isTypeImplementsOneOfInterfaces(getJpaProject().getJavaProject(), lwType,
+ JavaTypeDef.POSSIBLE_INTERFACES);
+ if (isImplements == null){
messages.add(HibernateJpaValidationMessage.buildMessage(
+ IMessage.HIGH_SEVERITY,INCONSISTENT_TYPE_HIERARCHY, new String[]{typeClass}, this, this.getTypeClassTextRange(astRoot)));
+ } else if (!isImplements){
+ messages.add(HibernateJpaValidationMessage.buildMessage(
IMessage.HIGH_SEVERITY,IMPLEMENT_USER_TYPE_INTERFACE, new String[]{typeClass}, this, this.getTypeClassTextRange(astRoot)));
}
}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/JpaUtil.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/JpaUtil.java 2012-04-30 12:56:41 UTC (rev 40637)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/JpaUtil.java 2012-04-30 13:48:39 UTC (rev 40638)
@@ -28,11 +28,12 @@
* @param javaProject
* @param type
* @param interfaceName
- * @return <code>true</code> if the type implements interface interfaceName.
+ * @return <code>true</code> if the type implements interface interfaceName. Returns null if class hierarchy is inconsistent.
* @throws JavaModelException
*/
- public static boolean isTypeImplementsInterface(IJavaProject javaProject, IType type, String interfaceName) throws JavaModelException{
+ public static Boolean isTypeImplementsInterface(IJavaProject javaProject, IType type, String interfaceName) throws JavaModelException{
if (type == null) return false;
+ boolean hasInconsistency = false;
String[] interfaces = type.getSuperInterfaceNames();
List<String> resolvedInterfaceNames = new LinkedList<String>();
for (int i = 0; i < interfaces.length; i++) {
@@ -46,6 +47,8 @@
if (interfaceName.equals(fullName))
return true;
}
+ } else {
+ hasInconsistency = true;
}
}
if (type.getSuperclassName() != null){
@@ -60,6 +63,8 @@
return true;
}
}
+ } else {
+ hasInconsistency = true;
}
}
for (String interface_ : resolvedInterfaceNames) {
@@ -68,16 +73,28 @@
return true;
}
}
- return false;
+ return hasInconsistency ? null : false;
}
- public static boolean isTypeImplementsOneOfInterfaces(IJavaProject javaProject, IType type, String... interfacesName) throws JavaModelException{
+ /**
+ *
+ * @param javaProject
+ * @param type
+ * @param interfacesName
+ * @return if the type implements one of the interfaces. Returns null if class hierarchy is inconsistent.
+ * @throws JavaModelException
+ */
+ public static Boolean isTypeImplementsOneOfInterfaces(IJavaProject javaProject, IType type, String... interfacesName) throws JavaModelException{
+ boolean hasInconsistency = false;
for (String interfaceName : interfacesName) {
- if (isTypeImplementsInterface(javaProject, type, interfaceName)){
+ Boolean implementsThis = isTypeImplementsInterface(javaProject, type, interfaceName);
+ if (implementsThis == null ){
+ hasInconsistency = true;
+ } else if (implementsThis == true){
return true;
}
}
- return false;
+ return hasInconsistency ? null : false;
}
}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/TypeImpl.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/TypeImpl.java 2012-04-30 12:56:41 UTC (rev 40637)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/TypeImpl.java 2012-04-30 13:48:39 UTC (rev 40638)
@@ -148,9 +148,13 @@
messages.add(HibernateJpaValidationMessage.buildMessage(
IMessage.HIGH_SEVERITY,TYPE_CLASS_NOT_FOUND, new String[]{type}, this, range));
} else {
- if (!JpaUtil.isTypeImplementsOneOfInterfaces(getJpaProject().getJavaProject(), lwType,
- JavaTypeDef.POSSIBLE_INTERFACES)){
+ Boolean isImplements = JpaUtil.isTypeImplementsOneOfInterfaces(getJpaProject().getJavaProject(), lwType,
+ JavaTypeDef.POSSIBLE_INTERFACES);
+ if (isImplements == null){
messages.add(HibernateJpaValidationMessage.buildMessage(
+ IMessage.HIGH_SEVERITY,INCONSISTENT_TYPE_HIERARCHY, new String[]{type}, this, range));
+ } else if (!isImplements){
+ messages.add(HibernateJpaValidationMessage.buildMessage(
IMessage.HIGH_SEVERITY,IMPLEMENT_USER_TYPE_INTERFACE, new String[]{type}, this, range));
}
}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/GeneratedAnnotationImpl.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/GeneratedAnnotationImpl.java 2012-04-30 12:56:41 UTC (rev 40637)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/GeneratedAnnotationImpl.java 2012-04-30 13:48:39 UTC (rev 40638)
@@ -33,7 +33,7 @@
* @author Dmitry Geraskov
*
*/
-public class GeneratedAnnotationImpl extends SourceAnnotation<Attribute> implements
+public class GeneratedAnnotationImpl extends SourceAnnotation implements
GeneratedAnnotation {
public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateDdlWizard.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateDdlWizard.java 2012-04-30 12:56:41 UTC (rev 40637)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateDdlWizard.java 2012-04-30 13:48:39 UTC (rev 40638)
@@ -63,6 +63,7 @@
prop.put("format", "true"); //$NON-NLS-1$ //$NON-NLS-2$
prop.put("scriptToConsole", "false"); //$NON-NLS-1$ //$NON-NLS-2$
prop.put("exportToDatabase", Boolean.toString(initPage.isExportToDB()));//$NON-NLS-1$
+ prop.put("haltOnError", "true");//$NON-NLS-1$ //$NON-NLS-2$
wc.setAttribute(HibernateJpaPlatformUi.full_exporter_id + ".properties", prop); //$NON-NLS-1$
wc.setAttribute(HibernateJpaPlatformUi.full_exporter_id + ".extension_id", HibernateLaunchConstants.ATTR_PREFIX + "hbm2ddl"); //$NON-NLS-1$ //$NON-NLS-2$
12 years, 7 months