JBoss Tools SVN: r36540 - trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext.
by jbosstools-commits@lists.jboss.org
Author: vpakan(a)redhat.com
Date: 2011-11-22 12:42:29 -0500 (Tue, 22 Nov 2011)
New Revision: 36540
Modified:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTJBTExt.java
Log:
Fix method isJBDSRun().
Modified: trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTJBTExt.java
===================================================================
--- trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTJBTExt.java 2011-11-22 17:40:40 UTC (rev 36539)
+++ trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTJBTExt.java 2011-11-22 17:42:29 UTC (rev 36540)
@@ -56,7 +56,7 @@
*/
public static boolean isJBDSRun (){
IProduct prod = Platform.getProduct();
- return prod != null;
+ return ((prod != null) && (prod.getId().startsWith("com.jboss.jbds.")));
}
/*
*
13 years, 1 month
JBoss Tools SVN: r36539 - trunk/build/aggregate/site.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2011-11-22 12:40:40 -0500 (Tue, 22 Nov 2011)
New Revision: 36539
Modified:
trunk/build/aggregate/site/site.xml
Log:
fixed Details description for JBoss Tools update site categories. CR and Tabs were removed to make description looks better.
Modified: trunk/build/aggregate/site/site.xml
===================================================================
--- trunk/build/aggregate/site/site.xml 2011-11-22 17:27:26 UTC (rev 36538)
+++ trunk/build/aggregate/site/site.xml 2011-11-22 17:40:40 UTC (rev 36539)
@@ -181,18 +181,11 @@
</feature>
<category-def name="AbridgedTools" label="Abridged JBoss Tools 3.3">
- <description>Contains most of the JBoss Tools features.
- Excluded are those related to integration with 3rd party
- plugins. Selecting this category will give you all tools
- needed for Web and Seam Development.
- </description>
+ <description>Contains most of the JBoss Tools features. Excluded are those related to integration with 3rd party plugins. Selecting this category will give you all tools needed for Web and Seam Development.</description>
</category-def>
<category-def name="WebTools" label="JBoss Web and Java EE Development">
- <description>Tools to help create web and enterprise applications,
- using JSF, Facelets,
- Seam, Hibernate/JPA, CSS, Webservices and more.
- </description>
+ <description>Tools to help create web and enterprise applications, using JSF, Facelets, Seam, Hibernate/JPA, CSS, Webservices and more.</description>
</category-def>
<category-def name="GeneralTools" label="JBoss Application Development">
@@ -205,17 +198,13 @@
<!-- Only in JBT -->
<category-def name="MavenTools" label="JBoss Maven Support">
- <description>Plugins related to Maven and m2eclipse support. Use these
- to enable use of Maven.</description>
+ <description>Plugins related to Maven and m2eclipse support. Use these to enable use of Maven.</description>
</category-def>
<category-def name="ReportTools" label="JBoss Business Intelligence, Reporting and Charting">
- <description>Business Intelligence, Reporting and Charting. Use these
- if you plan to integrate Hibernate or Seam with Eclipse BIRT.
- </description>
+ <description>Business Intelligence, Reporting and Charting. Use these if you plan to integrate Hibernate or Seam with Eclipse BIRT.</description>
</category-def>
<category-def name="CloudTools" label="JBoss Cloud Development Tools">
- <description>Tools for Cloud Development.
- </description>
+ <description>Tools for Cloud Development.</description>
</category-def>
</site>
13 years, 1 month
JBoss Tools SVN: r36538 - in trunk/cdi/tests/org.jboss.tools.cdi.bot.test: resources/jsf and 8 other directories.
by jbosstools-commits@lists.jboss.org
Author: jjankovi
Date: 2011-11-22 12:27:26 -0500 (Tue, 22 Nov 2011)
New Revision: 36538
Added:
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/resources/jsf/
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/resources/jsf/ManagedBean.java.cdi
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/resources/jsf/index.xhtml
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/annotations/JSFEnvironment.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/annotations/JSFTemplate.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/jsf/
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/jsf/ELNamedRefactoring.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/jsf/JSFTestBase.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/CDIWizardHelper.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/actions/NewJSFProjectWizard.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/wizards/JSFWebProjectWizard.java
Removed:
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/wizards/CDIWizard.java
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/CDIAllBotTests.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/CDITestBase.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/openon/OpenOnBase.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/BeansXMLValidationHelper.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/CDIProjectHelper.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/wizards/DynamicWebProjectWizard.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/wizards/Wizard.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/wizard/ConfigurationPresetTest.java
Log:
Resources + Other needed classes for new CDI test for EL refactoring added
Added: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/resources/jsf/ManagedBean.java.cdi
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/resources/jsf/ManagedBean.java.cdi (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/resources/jsf/ManagedBean.java.cdi 2011-11-22 17:27:26 UTC (rev 36538)
@@ -0,0 +1,16 @@
+package cdi;
+
+import javax.inject.Named;
+
+@Named("bean")
+public class ManagedBean {
+
+ public ManagedBean() {
+
+ }
+
+ public String submit() {
+ return "OK";
+ }
+
+}
\ No newline at end of file
Added: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/resources/jsf/index.xhtml
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/resources/jsf/index.xhtml (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/resources/jsf/index.xhtml 2011-11-22 17:27:26 UTC (rev 36538)
@@ -0,0 +1,14 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets">
+
+<h:head></h:head>
+<body>
+ <h:form>
+ <h:commandButton action="#{bean.submit()}" value="Submit" />
+ </h:form>
+
+</body>
+</html>
Modified: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/CDIAllBotTests.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/CDIAllBotTests.java 2011-11-22 16:44:21 UTC (rev 36537)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/CDIAllBotTests.java 2011-11-22 17:27:26 UTC (rev 36538)
@@ -12,6 +12,7 @@
import org.jboss.tools.cdi.bot.test.beansxml.BeansXMLValidationTest;
import org.jboss.tools.cdi.bot.test.editor.BeansEditorTest;
+import org.jboss.tools.cdi.bot.test.jsf.ELNamedRefactoring;
import org.jboss.tools.cdi.bot.test.openon.FindObserverForEventTest;
import org.jboss.tools.cdi.bot.test.openon.OpenOnTest;
import org.jboss.tools.cdi.bot.test.quickfix.BeanValidationQuickFixTest;
@@ -48,7 +49,7 @@
* JAVA=1.6,/space/java/sdk/jdk1.6.0_22
*
*
- * Suite duration: aprox. 21min
+ * Suite duration: aprox. 22min
*
* @author Lukas Jungmann
* @author Jaroslav Jankovic
@@ -60,6 +61,7 @@
FacetTest.class,
WizardTest.class,
BeansEditorTest.class,
+ ELNamedRefactoring.class,
BeansXMLValidationTest.class,
// BeansXMLCompletionTest.class,
StereotypeValidationQuickFixTest.class,
Modified: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/CDITestBase.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/CDITestBase.java 2011-11-22 16:44:21 UTC (rev 36537)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/CDITestBase.java 2011-11-22 17:27:26 UTC (rev 36538)
@@ -8,14 +8,15 @@
* Contributors:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
+
package org.jboss.tools.cdi.bot.test;
import org.jboss.tools.cdi.bot.test.uiutils.BeansXMLValidationHelper;
import org.jboss.tools.cdi.bot.test.uiutils.CDIProjectHelper;
+import org.jboss.tools.cdi.bot.test.uiutils.CDIWizardHelper;
import org.jboss.tools.cdi.bot.test.uiutils.EditorResourceHelper;
import org.jboss.tools.cdi.bot.test.uiutils.LibraryHelper;
import org.jboss.tools.cdi.bot.test.uiutils.OpenOnHelper;
-import org.jboss.tools.cdi.bot.test.uiutils.wizards.CDIWizard;
import org.junit.After;
import org.junit.Before;
@@ -27,7 +28,7 @@
protected static CDIProjectHelper projectHelper = new CDIProjectHelper();
protected static BeansXMLValidationHelper beansHelper = new BeansXMLValidationHelper();
- protected static CDIWizard wizard = new CDIWizard();
+ protected static CDIWizardHelper wizard = new CDIWizardHelper();
protected static OpenOnHelper openOnUtil = new OpenOnHelper();
protected static LibraryHelper libraryUtil = new LibraryHelper();
protected static EditorResourceHelper editResourceUtil = new EditorResourceHelper();
Added: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/annotations/JSFEnvironment.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/annotations/JSFEnvironment.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/annotations/JSFEnvironment.java 2011-11-22 17:27:26 UTC (rev 36538)
@@ -0,0 +1,21 @@
+package org.jboss.tools.cdi.bot.test.annotations;
+
+public enum JSFEnvironment {
+
+ JSF_11, JSF_12, JSF_12_FACETS, JSF_20;
+
+ public String getName() {
+ switch (this) {
+ case JSF_11:
+ return "JSF 1.1.02 - Reference Implementation";
+ case JSF_12:
+ return "JSF 1.2";
+ case JSF_12_FACETS:
+ return "JSF 1.2 with Facets";
+ case JSF_20:
+ return "JSF 2.0";
+ default:
+ throw new AssertionError("Unknown type");
+ }
+ }
+}
Added: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/annotations/JSFTemplate.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/annotations/JSFTemplate.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/annotations/JSFTemplate.java 2011-11-22 17:27:26 UTC (rev 36538)
@@ -0,0 +1,18 @@
+package org.jboss.tools.cdi.bot.test.annotations;
+
+public enum JSFTemplate {
+
+ BLANK, KICKSTART;
+
+ public String getName() {
+ switch (this) {
+ case BLANK:
+ return "JSFBlankWithoutLibs";
+ case KICKSTART:
+ return "JSFKickStartWithoutLibs";
+ default:
+ throw new AssertionError("Unknown type");
+ }
+ }
+
+}
Added: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/jsf/ELNamedRefactoring.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/jsf/ELNamedRefactoring.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/jsf/ELNamedRefactoring.java 2011-11-22 17:27:26 UTC (rev 36538)
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.cdi.bot.test.jsf;
+
+import org.jboss.tools.cdi.bot.test.CDIAllBotTests;
+import org.jboss.tools.ui.bot.ext.RequirementAwareSuite;
+import org.jboss.tools.ui.bot.ext.config.Annotations.Require;
+import org.jboss.tools.ui.bot.ext.config.Annotations.Server;
+import org.jboss.tools.ui.bot.ext.config.Annotations.ServerState;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite.SuiteClasses;
+
+/**
+ * Test operates on EL named refactoring
+ *
+ * @author Jaroslav Jankovic
+ *
+ */
+
+@Require(clearProjects = true, perspective = "Java EE", server = @Server(state = ServerState.NotRunning, version = "6.0", operator = ">="))
+(a)RunWith(RequirementAwareSuite.class)
+@SuiteClasses({ CDIAllBotTests.class })
+public class ELNamedRefactoring extends JSFTestBase {
+
+ @Override
+ public String getProjectName() {
+ return "CDIRefactoring";
+ }
+
+ @Test
+ public void testCreateJSFBlankProject() {
+
+ assertTrue(projectHelper.projectExists(getProjectName()));
+ assertTrue(projectHelper.checkCDISupport(getProjectName()));
+
+ }
+
+}
Added: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/jsf/JSFTestBase.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/jsf/JSFTestBase.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/jsf/JSFTestBase.java 2011-11-22 17:27:26 UTC (rev 36538)
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.cdi.bot.test.jsf;
+
+import org.jboss.tools.cdi.bot.test.CDITestBase;
+import org.jboss.tools.cdi.bot.test.annotations.JSFEnvironment;
+import org.jboss.tools.cdi.bot.test.annotations.JSFTemplate;
+import org.jboss.tools.cdi.bot.test.uiutils.actions.NewJSFProjectWizard;
+import org.junit.Before;
+
+public class JSFTestBase extends CDITestBase {
+
+ private JSFEnvironment env = JSFEnvironment.JSF_11;
+
+ public JSFEnvironment getEnv() {
+ return env;
+ }
+
+ @Before
+ public void checkAndCreateProject() {
+
+ if (!projectHelper.projectExists(getProjectName())) {
+ createJSFProjectWithCDISupport(getProjectName(), getEnv());
+ }
+
+ }
+
+ private void createJSFProjectWithCDISupport(String projectName, JSFEnvironment env) {
+
+ createJSFProject(projectName, env);
+ projectHelper.addCDISupport(projectName);
+
+ }
+
+ private void createJSFProject(String projectName, JSFEnvironment env) {
+ new NewJSFProjectWizard().run().
+ setName(getProjectName()).
+ setEnvironment(env).
+ setJSFTemplate(JSFTemplate.BLANK).finish();
+ util.waitForNonIgnoredJobs();
+ }
+
+}
\ No newline at end of file
Modified: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/openon/OpenOnBase.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/openon/OpenOnBase.java 2011-11-22 16:44:21 UTC (rev 36537)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/openon/OpenOnBase.java 2011-11-22 17:27:26 UTC (rev 36538)
@@ -14,7 +14,14 @@
import org.jboss.tools.cdi.bot.test.CDITestBase;
import org.jboss.tools.cdi.bot.test.annotations.CDIWizardType;
-public class OpenOnBase extends CDITestBase{
+/**
+ * test base for OpenOn-like CDI tests
+ *
+ * @author jjankovi
+ *
+ */
+
+public class OpenOnBase extends CDITestBase {
protected static final String[] events = { "myBean1Q1Event", "myBean1AnyEvent",
"myBean2Q1Event", "myBean2AnyEvent", "myBean1Q2Event",
Modified: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/BeansXMLValidationHelper.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/BeansXMLValidationHelper.java 2011-11-22 16:44:21 UTC (rev 36537)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/BeansXMLValidationHelper.java 2011-11-22 17:27:26 UTC (rev 36538)
@@ -29,8 +29,7 @@
/**
* Method checks if there is validation problem with text
- * specified by parameter validationErrors for entered project
- *
+ * specified by parameter validationErrors for entered project
* @param validationError
* @return
*/
@@ -59,8 +58,7 @@
/**
* Method checks if there is no validation problem when
* creating interceptor component with entered className
- * packageName for project with name projectName
- *
+ * packageName for project with name projectName
* @param projectName
* @param packageName
* @param className
@@ -76,7 +74,6 @@
* Method checks if there is no validation problem when
* creating decorator component with entered className
* packageName for project with name projectName
- *
* @param projectName
* @param packageName
* @param className
@@ -91,8 +88,7 @@
/**
* Method checks if there is no validation problem when
* creating alternative bean component with entered className
- * packageName for project with name projectName
- *
+ * packageName for project with name projectName
* @param projectName
* @param packageName
* @param className
@@ -107,7 +103,6 @@
/**
* Method gets all beans.xml validation errors showed in Problems View
* for entered project
- *
* @return
*/
public SWTBotTreeItem[] getBeansXMLValidationErrors(String projectName) {
@@ -116,8 +111,7 @@
}
/**
- * Methods creates beans.xml with no tags for entered project.
- *
+ * Methods creates beans.xml with no tags for entered project.
* @param projectName
*/
public void createClearBeansXML(String projectName) {
@@ -129,8 +123,7 @@
/**
* Methods creates beans.xml with interceptor tags in it for entered project.
* Package and interceptor component name which should be showed in tag is
- * determined by parameters
- *
+ * determined by parameters
* @param projectName
* @param packageName
* @param className
@@ -147,8 +140,7 @@
/**
* Methods creates beans.xml with decorator tags in it for entered project.
* Package and decorator component name which should be showed in tag is
- * determined by parameters
- *
+ * determined by parameters
* @param projectName
* @param packageName
* @param className
@@ -164,8 +156,7 @@
/**
* Methods creates beans.xml with alternative tags in it for entered project.
* Package and alternative bean component name which should be showed in tag is
- * determined by parameters
- *
+ * determined by parameters
* @param projectName
* @param packageName
* @param className
@@ -181,8 +172,7 @@
/**
* Methods create beans.xml for entered project with content of file
* determined by parameter path. If there is beans.xml in project, its
- * content is simply replaced
- *
+ * content is simply replaced
* @param projectName
* @param path
*/
Modified: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/CDIProjectHelper.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/CDIProjectHelper.java 2011-11-22 16:44:21 UTC (rev 36537)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/CDIProjectHelper.java 2011-11-22 17:27:26 UTC (rev 36538)
@@ -12,12 +12,14 @@
package org.jboss.tools.cdi.bot.test.uiutils;
import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
import org.jboss.tools.cdi.bot.test.CDIBase;
import org.jboss.tools.cdi.bot.test.uiutils.actions.NewFileWizardAction;
import org.jboss.tools.cdi.bot.test.uiutils.wizards.DynamicWebProjectWizard;
import org.jboss.tools.ui.bot.ext.Timing;
+import org.jboss.tools.ui.bot.ext.helper.ContextMenuHelper;
public class CDIProjectHelper extends CDIBase{
@@ -84,7 +86,7 @@
* Method adds CDI support to project with entered name
* @param projectName
*/
- private void addCDISupport(String projectName) {
+ public void addCDISupport(String projectName) {
projectExplorer.selectProject(projectName);
SWTBotTree tree = projectExplorer.bot().tree();
SWTBotTreeItem item = tree.getTreeItem(projectName);
@@ -97,4 +99,22 @@
util.waitForNonIgnoredJobs();
}
+ /**
+ * Method checks if entered project has CDI support set
+ * @param projectName
+ * @return
+ */
+ public boolean checkCDISupport(String projectName) {
+ projectExplorer.selectProject(projectName);
+
+ SWTBotTree tree = projectExplorer.bot().tree();
+ ContextMenuHelper.prepareTreeItemForContextMenu(tree);
+ new SWTBotMenu(ContextMenuHelper.getContextMenu(tree,"Properties",false)).click();
+
+ bot.tree().expandNode("CDI (Context and Dependency Injection) Settings").select();
+ boolean isCDISupported = bot.checkBox().isChecked();
+ bot.button("Cancel").click();
+ return isCDISupported;
+ }
+
}
Added: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/CDIWizardHelper.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/CDIWizardHelper.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/CDIWizardHelper.java 2011-11-22 17:27:26 UTC (rev 36538)
@@ -0,0 +1,134 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.cdi.bot.test.uiutils;
+
+import org.jboss.tools.cdi.bot.test.CDITestBase;
+import org.jboss.tools.cdi.bot.test.annotations.CDIWizardType;
+import org.jboss.tools.cdi.bot.test.uiutils.wizards.CDIWizardBaseExt;
+
+public class CDIWizardHelper extends CDITestBase{
+
+ private CDIWizardBaseExt wizardExt = new CDIWizardBaseExt();
+
+ /**
+ * Method creates Java Annotation with selected name and package
+ * @param name
+ * @param packageName
+ */
+ public void createAnnotation(String name, String packageName) {
+ wizardExt.annotation(open, util, packageName, name);
+ }
+
+ /**
+ * Method creates CDI component with workaround for beans.xml -
+ * if component is beans.xml, editor is not set (there is no active editor by default)
+ * @param component
+ * @param name
+ * @param packageName
+ * @param necessaryParam
+ */
+ public void createCDIComponent(CDIWizardType component, String name,
+ String packageName, String necessaryParam) {
+ createComponent(component, name, packageName, necessaryParam);
+ util.waitForNonIgnoredJobs();
+ /**
+ * if beans.xml is created as first component in project,
+ * it is not opened as default ==> there is no active editor
+ */
+ if (component != CDIWizardType.BEANS_XML) {
+ setEd(bot.activeEditor().toTextEditor());
+ }
+ }
+
+ /**
+ * Method creates larger number("amount") of the same component.
+ * @param component
+ * @param amount
+ * @param baseName
+ * @param packageBaseName
+ * @param necessaryParam
+ * @param differentPackages
+ */
+ public void createCDIComponents(CDIWizardType component, int amount, String baseName,
+ String packageBaseName, String necessaryParam, boolean differentPackages) {
+
+ for (int i = 1; i <= amount; i++) {
+ String packageName = (differentPackages) ? packageBaseName + i : packageBaseName;
+ createCDIComponent(component, baseName + i, packageName, necessaryParam);
+ }
+
+ }
+
+ /**
+ * Method that actually creates CDI component according to parameter
+ * @param component
+ * @param name
+ * @param packageName
+ * @param necessaryParam
+ */
+ private void createComponent(CDIWizardType component, String name,
+ String packageName, String necessaryParam) {
+ switch (component) {
+ case STEREOTYPE:
+ boolean alternative = false;
+ boolean regInBeansXml = false;
+ if (necessaryParam != null) {
+ if (necessaryParam.equals("alternative+beansxml")) {
+ alternative = true;
+ regInBeansXml = true;
+ } else if (necessaryParam.equals("alternative")) {
+ alternative = true;
+ }
+ }
+ wizardExt.stereotype(packageName, name, null, null, false, false, alternative, regInBeansXml,
+ false).finish();
+ break;
+ case QUALIFIER:
+ wizardExt.qualifier(packageName, name, false, false).finish();
+ break;
+ case SCOPE:
+ wizardExt.scope(packageName, name, false, false, true, false).finish();
+ break;
+ case BEAN:
+ alternative = false;
+ regInBeansXml = false;
+ if (necessaryParam != null) {
+ if (necessaryParam.equals("alternative+beansxml")) {
+ alternative = true;
+ regInBeansXml = true;
+ } else if (necessaryParam.equals("alternative")) {
+ alternative = true;
+ }
+ }
+ wizardExt.bean(packageName, name, true, false, false, false, alternative, regInBeansXml, null, null,
+ null, null).finish();
+ break;
+ case INTERCEPTOR:
+ wizardExt.interceptor(packageName, name, null, null, null, false).finish();
+ break;
+ case DECORATOR:
+ wizardExt.decorator(packageName, name, necessaryParam, null, true, false, false, false)
+ .finish();
+ break;
+ case ANNOTATION_LITERAL:
+ wizardExt.annLiteral(packageName, name, true, false, false, false, null).finish();
+ break;
+ case INTERCEPTOR_BINDING:
+ wizardExt.binding(packageName, name, null, true, false).finish();
+ break;
+ case BEANS_XML:
+ wizardExt.beansXML(packageName).finish();
+ break;
+ }
+ }
+
+}
Added: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/actions/NewJSFProjectWizard.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/actions/NewJSFProjectWizard.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/actions/NewJSFProjectWizard.java 2011-11-22 17:27:26 UTC (rev 36538)
@@ -0,0 +1,20 @@
+package org.jboss.tools.cdi.bot.test.uiutils.actions;
+
+import org.jboss.tools.cdi.bot.test.uiutils.wizards.JSFWebProjectWizard;
+import org.jboss.tools.cdi.bot.test.uiutils.wizards.Wizard;
+
+public class NewJSFProjectWizard extends NewFileWizardAction {
+
+ public NewJSFProjectWizard() {
+ super();
+ }
+
+ @Override
+ public JSFWebProjectWizard run() {
+ Wizard w = super.run();
+ w.selectTemplate("JBoss Tools Web", "JSF", "JSF Project");
+ w.next();
+ return new JSFWebProjectWizard();
+ }
+
+}
Deleted: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/wizards/CDIWizard.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/wizards/CDIWizard.java 2011-11-22 16:44:21 UTC (rev 36537)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/wizards/CDIWizard.java 2011-11-22 17:27:26 UTC (rev 36538)
@@ -1,137 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-
-package org.jboss.tools.cdi.bot.test.uiutils.wizards;
-
-import org.jboss.tools.cdi.bot.test.CDITestBase;
-import org.jboss.tools.cdi.bot.test.annotations.CDIWizardType;
-
-public class CDIWizard extends CDITestBase{
-
- private CDIWizardBaseExt wizardExt = new CDIWizardBaseExt();
-
- /**
- * Method creates Java Annotation with selected name and package
- *
- * @param name
- * @param packageName
- */
- public void createAnnotation(String name, String packageName) {
- wizardExt.annotation(open, util, packageName, name);
- }
-
- /**
- * Method creates CDI component with workaround for beans.xml -
- * if component is beans.xml, editor is not set (there is no active editor by default)
- *
- * @param component
- * @param name
- * @param packageName
- * @param necessaryParam
- */
- public void createCDIComponent(CDIWizardType component, String name,
- String packageName, String necessaryParam) {
- createComponent(component, name, packageName, necessaryParam);
- util.waitForNonIgnoredJobs();
- /**
- * if beans.xml is created as first component in project,
- * it is not opened as default ==> there is no active editor
- */
- if (component != CDIWizardType.BEANS_XML) {
- setEd(bot.activeEditor().toTextEditor());
- }
- }
-
- /**
- * Method creates larger number("amount") of the same component.
- *
- * @param component
- * @param amount
- * @param baseName
- * @param packageBaseName
- * @param necessaryParam
- * @param differentPackages
- */
- public void createCDIComponents(CDIWizardType component, int amount, String baseName,
- String packageBaseName, String necessaryParam, boolean differentPackages) {
-
- for (int i = 1; i <= amount; i++) {
- String packageName = (differentPackages) ? packageBaseName + i : packageBaseName;
- createCDIComponent(component, baseName + i, packageName, necessaryParam);
- }
-
- }
-
- /**
- * Method that actually creates CDI component according to parameter
- *
- * @param component
- * @param name
- * @param packageName
- * @param necessaryParam
- */
- private void createComponent(CDIWizardType component, String name,
- String packageName, String necessaryParam) {
- switch (component) {
- case STEREOTYPE:
- boolean alternative = false;
- boolean regInBeansXml = false;
- if (necessaryParam != null) {
- if (necessaryParam.equals("alternative+beansxml")) {
- alternative = true;
- regInBeansXml = true;
- } else if (necessaryParam.equals("alternative")) {
- alternative = true;
- }
- }
- wizardExt.stereotype(packageName, name, null, null, false, false, alternative, regInBeansXml,
- false).finish();
- break;
- case QUALIFIER:
- wizardExt.qualifier(packageName, name, false, false).finish();
- break;
- case SCOPE:
- wizardExt.scope(packageName, name, false, false, true, false).finish();
- break;
- case BEAN:
- alternative = false;
- regInBeansXml = false;
- if (necessaryParam != null) {
- if (necessaryParam.equals("alternative+beansxml")) {
- alternative = true;
- regInBeansXml = true;
- } else if (necessaryParam.equals("alternative")) {
- alternative = true;
- }
- }
- wizardExt.bean(packageName, name, true, false, false, false, alternative, regInBeansXml, null, null,
- null, null).finish();
- break;
- case INTERCEPTOR:
- wizardExt.interceptor(packageName, name, null, null, null, false).finish();
- break;
- case DECORATOR:
- wizardExt.decorator(packageName, name, necessaryParam, null, true, false, false, false)
- .finish();
- break;
- case ANNOTATION_LITERAL:
- wizardExt.annLiteral(packageName, name, true, false, false, false, null).finish();
- break;
- case INTERCEPTOR_BINDING:
- wizardExt.binding(packageName, name, null, true, false).finish();
- break;
- case BEANS_XML:
- wizardExt.beansXML(packageName).finish();
- break;
- }
- }
-
-}
Modified: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/wizards/DynamicWebProjectWizard.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/wizards/DynamicWebProjectWizard.java 2011-11-22 16:44:21 UTC (rev 36537)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/wizards/DynamicWebProjectWizard.java 2011-11-22 17:27:26 UTC (rev 36538)
@@ -12,6 +12,9 @@
package org.jboss.tools.cdi.bot.test.uiutils.wizards;
import org.eclipse.swtbot.swt.finder.SWTBot;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
+import org.jboss.tools.ui.bot.ext.Timing;
public class DynamicWebProjectWizard extends Wizard {
@@ -24,5 +27,31 @@
setText("Project name:", name);
return this;
}
+
+ public DynamicWebProjectWizard setCDIPreset() {
+ bot().comboBoxInGroup("Configuration", 0).
+ setSelection("Dynamic Web Project with CDI (Context and Dependency Injection)");
+ return this;
+ }
+
+ public DynamicWebProjectWizard setCDIFacet() {
+ clickButton("Modify...");
+ SWTBot bot = bot().shell("Project Facets").bot();
+ setCDIFacetInFacets(bot);
+ bot().sleep(Timing.time1S());
+ return this;
+ }
+
+ private void setCDIFacetInFacets(SWTBot bot) {
+ SWTBotTree tree= bot.tree();
+ for (SWTBotTreeItem ti: tree.getAllItems()) {
+ if (ti.cell(0).contains("CDI (Contexts and Dependency Injection)")) {
+ ti.check();
+ break;
+ }
+ }
+ bot.sleep(Timing.time1S());
+ bot.button("OK").click();
+ }
}
Added: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/wizards/JSFWebProjectWizard.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/wizards/JSFWebProjectWizard.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/wizards/JSFWebProjectWizard.java 2011-11-22 17:27:26 UTC (rev 36538)
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.cdi.bot.test.uiutils.wizards;
+
+import org.eclipse.swtbot.swt.finder.SWTBot;
+import org.jboss.tools.cdi.bot.test.annotations.JSFEnvironment;
+import org.jboss.tools.cdi.bot.test.annotations.JSFTemplate;
+
+public class JSFWebProjectWizard extends Wizard {
+
+ public JSFWebProjectWizard() {
+ super(new SWTBot().activeShell().widget);
+ assert ("New JSF Project").equals(getText());
+ }
+
+ public JSFWebProjectWizard setName(String name) {
+ setText("Project Name*", name);
+ return this;
+ }
+
+ public JSFWebProjectWizard setEnvironment(JSFEnvironment env) {
+ setTextInCombobox("JSF Environment*", env.getName());
+ return this;
+ }
+
+ public JSFWebProjectWizard setJSFTemplate(JSFTemplate template) {
+ setTextInCombobox("Template*", template.getName());
+ return this;
+ }
+
+}
Modified: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/wizards/Wizard.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/wizards/Wizard.java 2011-11-22 16:44:21 UTC (rev 36537)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/wizards/Wizard.java 2011-11-22 17:27:26 UTC (rev 36538)
@@ -12,7 +12,6 @@
package org.jboss.tools.cdi.bot.test.uiutils.wizards;
import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swtbot.swt.finder.SWTBot;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotText;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
@@ -62,38 +61,10 @@
public boolean canFinish() {
return canClick("Finish");
}
-
- public Wizard setCDIPreset() {
- bot().comboBoxInGroup("Configuration", 0).
- setSelection("Dynamic Web Project with CDI (Context and Dependency Injection)");
- return this;
- }
-
- public Wizard setCDIFacet() {
- clickButton("Modify...");
- SWTBot bot = bot().shell("Project Facets").bot();
- setCDIFacet(bot);
- bot().sleep(Timing.time1S());
- return this;
- }
-
- private void setCDIFacet(SWTBot bot) {
- SWTBotTree tree= bot.tree();
- for (SWTBotTreeItem ti: tree.getAllItems()) {
- if (ti.cell(0).contains("CDI (Contexts and Dependency Injection)")) {
- ti.check();
- break;
- }
- }
- bot.sleep(Timing.time1S());
- bot.button("OK").click();
- }
-
-
-
+
protected void clickButton(String text) {
bot().button(text).click();
- bot().sleep(500);
+ bot().sleep(Timing.time500MS());
}
protected void setText(String label, String text) {
@@ -105,4 +76,9 @@
protected boolean canClick(String button) {
return bot().button(button).isEnabled();
}
+
+ protected void setTextInCombobox(String combobox, String text) {
+ bot().comboBoxWithLabel(combobox).setSelection(text);
+ bot().sleep(Timing.time500MS());
+ }
}
Modified: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/wizard/ConfigurationPresetTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/wizard/ConfigurationPresetTest.java 2011-11-22 16:44:21 UTC (rev 36537)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/wizard/ConfigurationPresetTest.java 2011-11-22 17:27:26 UTC (rev 36538)
@@ -14,8 +14,6 @@
import java.util.logging.Logger;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
import org.jboss.tools.cdi.bot.test.CDIAllBotTests;
import org.jboss.tools.cdi.bot.test.CDISmokeBotTests;
import org.jboss.tools.cdi.bot.test.CDITestBase;
@@ -23,7 +21,6 @@
import org.jboss.tools.ui.bot.ext.config.Annotations.Require;
import org.jboss.tools.ui.bot.ext.config.Annotations.Server;
import org.jboss.tools.ui.bot.ext.config.Annotations.ServerState;
-import org.jboss.tools.ui.bot.ext.helper.ContextMenuHelper;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Suite.SuiteClasses;
@@ -56,21 +53,7 @@
@Test
public void testCDIPreset() {
LOGGER.info("Dynamic Web Project with CDI Configuration Preset created");
- assertTrue(checkCDISupport(getProjectName()));
+ assertTrue(projectHelper.checkCDISupport(getProjectName()));
}
- private boolean checkCDISupport(String projectName) {
- projectExplorer.selectProject(projectName);
-
- SWTBotTree tree = projectExplorer.bot().tree();
- ContextMenuHelper.prepareTreeItemForContextMenu(tree);
- new SWTBotMenu(ContextMenuHelper.getContextMenu(tree,"Properties",false)).click();
-
- bot.tree().expandNode("CDI (Context and Dependency Injection) Settings").select();
- boolean isCDISupported = bot.checkBox().isChecked();
- bot.button("Cancel").click();
- return isCDISupported;
- }
-
-
}
13 years, 1 month
JBoss Tools SVN: r36537 - in trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test: matcher and 4 other directories.
by jbosstools-commits@lists.jboss.org
Author: ljelinko
Date: 2011-11-22 11:44:21 -0500 (Tue, 22 Nov 2011)
New Revision: 36537
Added:
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/matcher/console/
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/matcher/console/ConsoleOutputMatcher.java
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/matcher/factory/
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/matcher/factory/DefaultMatchersFactory.java
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/matcher/factory/WorkspaceMatchersFactory.java
Removed:
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/matcher/problems/ProblemViewMatchersFactory.java
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/matcher/workspace/WorkspaceMatchersFactory.java
Modified:
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/create/CreateJavaPortlet.java
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/create/CreateJavaPortletProject.java
Log:
moved matchers factories to separate package
Modified: trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/create/CreateJavaPortlet.java
===================================================================
--- trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/create/CreateJavaPortlet.java 2011-11-22 16:43:49 UTC (rev 36536)
+++ trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/create/CreateJavaPortlet.java 2011-11-22 16:44:21 UTC (rev 36537)
@@ -2,9 +2,9 @@
import static org.jboss.tools.portlet.ui.bot.test.create.CreateJavaPortletProject.PROJECT_NAME;
import static org.jboss.tools.portlet.ui.bot.test.entity.EntityFactory.file;
-import static org.jboss.tools.portlet.ui.bot.test.matcher.problems.ProblemViewMatchersFactory.isNumberOfErrors;
-import static org.jboss.tools.portlet.ui.bot.test.matcher.workspace.WorkspaceMatchersFactory.containsNodes;
-import static org.jboss.tools.portlet.ui.bot.test.matcher.workspace.WorkspaceMatchersFactory.exists;
+import static org.jboss.tools.portlet.ui.bot.test.matcher.factory.DefaultMatchersFactory.isNumberOfErrors;
+import static org.jboss.tools.portlet.ui.bot.test.matcher.factory.WorkspaceMatchersFactory.containsNodes;
+import static org.jboss.tools.portlet.ui.bot.test.matcher.factory.WorkspaceMatchersFactory.exists;
import org.jboss.tools.portlet.ui.bot.test.entity.XMLNode;
import org.jboss.tools.portlet.ui.bot.test.task.SWTTask;
@@ -39,7 +39,6 @@
doAssertThat(file(PROJECT_NAME, "WebContent/WEB-INF/default-object.xml"), exists());
doAssertThat(file(PROJECT_NAME, "WebContent/WEB-INF/portlet-instances.xml"), exists());
doAssertThat(file(PROJECT_NAME, "WebContent/WEB-INF/portlet.xml"), containsNodes(new XMLNode("portlet-app/portlet/portlet-class", FULL_CLASS_NAME)));
- System.out.println("");
}
private SWTTask getCreatePortletTask() {
Modified: trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/create/CreateJavaPortletProject.java
===================================================================
--- trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/create/CreateJavaPortletProject.java 2011-11-22 16:43:49 UTC (rev 36536)
+++ trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/create/CreateJavaPortletProject.java 2011-11-22 16:44:21 UTC (rev 36537)
@@ -1,10 +1,10 @@
package org.jboss.tools.portlet.ui.bot.test.create;
import static org.jboss.tools.portlet.ui.bot.test.entity.EntityFactory.file;
-import static org.jboss.tools.portlet.ui.bot.test.matcher.problems.ProblemViewMatchersFactory.isNumberOfErrors;
-import static org.jboss.tools.portlet.ui.bot.test.matcher.workspace.WorkspaceMatchersFactory.exists;
-import static org.jboss.tools.portlet.ui.bot.test.matcher.workspace.WorkspaceMatchersFactory.hasFacets;
-import static org.jboss.tools.portlet.ui.bot.test.matcher.workspace.WorkspaceMatchersFactory.isExistingProject;
+import static org.jboss.tools.portlet.ui.bot.test.matcher.factory.DefaultMatchersFactory.isNumberOfErrors;
+import static org.jboss.tools.portlet.ui.bot.test.matcher.factory.WorkspaceMatchersFactory.exists;
+import static org.jboss.tools.portlet.ui.bot.test.matcher.factory.WorkspaceMatchersFactory.hasFacets;
+import static org.jboss.tools.portlet.ui.bot.test.matcher.factory.WorkspaceMatchersFactory.isExistingProject;
import org.jboss.tools.portlet.ui.bot.test.entity.FacetDefinition;
import org.jboss.tools.portlet.ui.bot.test.task.AbstractSWTTask;
Added: trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/matcher/console/ConsoleOutputMatcher.java
===================================================================
--- trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/matcher/console/ConsoleOutputMatcher.java (rev 0)
+++ trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/matcher/console/ConsoleOutputMatcher.java 2011-11-22 16:44:21 UTC (rev 36537)
@@ -0,0 +1,27 @@
+package org.jboss.tools.portlet.ui.bot.test.matcher.console;
+
+import org.hamcrest.Description;
+import org.jboss.tools.portlet.ui.bot.test.matcher.AbstractSWTMatcher;
+import org.jboss.tools.ui.bot.ext.SWTBotFactory;
+
+/**
+ * Checks if the console contains specified text.
+ *
+ * @author Lucia Jelinkova
+ *
+ */
+public class ConsoleOutputMatcher extends AbstractSWTMatcher<String> {
+
+ private String consoleText;
+
+ @Override
+ public boolean matchesSafely(String item) {
+ consoleText = SWTBotFactory.getConsole().getConsoleText();
+ return consoleText.contains(item);
+ }
+
+ @Override
+ public void describeTo(Description description) {
+ description.appendText("console contains specified text [" + consoleText + "]");
+ }
+}
Copied: trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/matcher/factory/DefaultMatchersFactory.java (from rev 36504, trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/matcher/problems/ProblemViewMatchersFactory.java)
===================================================================
--- trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/matcher/factory/DefaultMatchersFactory.java (rev 0)
+++ trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/matcher/factory/DefaultMatchersFactory.java 2011-11-22 16:44:21 UTC (rev 36537)
@@ -0,0 +1,26 @@
+package org.jboss.tools.portlet.ui.bot.test.matcher.factory;
+
+import org.jboss.tools.portlet.ui.bot.test.matcher.SWTMatcher;
+import org.jboss.tools.portlet.ui.bot.test.matcher.console.ConsoleOutputMatcher;
+import org.jboss.tools.portlet.ui.bot.test.matcher.problems.NumberOfErrorsMatcher;
+
+/**
+ * Factory of matchers for Problems View.
+ *
+ * @author Lucia Jelinkova
+ *
+ */
+public class DefaultMatchersFactory {
+
+ public DefaultMatchersFactory() {
+ // not to be instantiated
+ }
+
+ public static SWTMatcher<Integer> isNumberOfErrors(){
+ return new NumberOfErrorsMatcher();
+ }
+
+ public static SWTMatcher<String> inConsoleOutput(){
+ return new ConsoleOutputMatcher();
+ }
+}
Copied: trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/matcher/factory/WorkspaceMatchersFactory.java (from rev 36524, trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/matcher/workspace/WorkspaceMatchersFactory.java)
===================================================================
--- trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/matcher/factory/WorkspaceMatchersFactory.java (rev 0)
+++ trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/matcher/factory/WorkspaceMatchersFactory.java 2011-11-22 16:44:21 UTC (rev 36537)
@@ -0,0 +1,41 @@
+package org.jboss.tools.portlet.ui.bot.test.matcher.factory;
+
+import java.util.Arrays;
+
+import org.jboss.tools.portlet.ui.bot.test.entity.FacetDefinition;
+import org.jboss.tools.portlet.ui.bot.test.entity.WorkspaceFile;
+import org.jboss.tools.portlet.ui.bot.test.entity.XMLNode;
+import org.jboss.tools.portlet.ui.bot.test.matcher.SWTMatcher;
+import org.jboss.tools.portlet.ui.bot.test.matcher.workspace.ExistingProjectMatcher;
+import org.jboss.tools.portlet.ui.bot.test.matcher.workspace.ProjectFacetsMatcher;
+import org.jboss.tools.portlet.ui.bot.test.matcher.workspace.file.ExistingFileMatcher;
+import org.jboss.tools.portlet.ui.bot.test.matcher.workspace.file.xml.XMLFileNodeContentMatcher;
+
+/**
+ * Factory for workspace specific matchers (projects, files..)
+ *
+ * @author Lucia Jelinkova
+ *
+ */
+public class WorkspaceMatchersFactory {
+
+ private WorkspaceMatchersFactory(){
+ // not to be instantiated
+ }
+
+ public static SWTMatcher<String> isExistingProject(){
+ return new ExistingProjectMatcher();
+ }
+
+ public static SWTMatcher<WorkspaceFile> exists(){
+ return new ExistingFileMatcher();
+ }
+
+ public static SWTMatcher<String> hasFacets(FacetDefinition... facets){
+ return new ProjectFacetsMatcher(facets);
+ }
+
+ public static SWTMatcher<WorkspaceFile> containsNodes(XMLNode... nodes){
+ return new XMLFileNodeContentMatcher(Arrays.asList(nodes));
+ }
+}
Deleted: trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/matcher/problems/ProblemViewMatchersFactory.java
===================================================================
--- trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/matcher/problems/ProblemViewMatchersFactory.java 2011-11-22 16:43:49 UTC (rev 36536)
+++ trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/matcher/problems/ProblemViewMatchersFactory.java 2011-11-22 16:44:21 UTC (rev 36537)
@@ -1,20 +0,0 @@
-package org.jboss.tools.portlet.ui.bot.test.matcher.problems;
-
-import org.jboss.tools.portlet.ui.bot.test.matcher.SWTMatcher;
-
-/**
- * Factory of matchers for Problems View.
- *
- * @author Lucia Jelinkova
- *
- */
-public class ProblemViewMatchersFactory {
-
- public ProblemViewMatchersFactory() {
- // not to be instantiated
- }
-
- public static SWTMatcher<Integer> isNumberOfErrors(){
- return new NumberOfErrorsMatcher();
- }
-}
Deleted: trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/matcher/workspace/WorkspaceMatchersFactory.java
===================================================================
--- trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/matcher/workspace/WorkspaceMatchersFactory.java 2011-11-22 16:43:49 UTC (rev 36536)
+++ trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/matcher/workspace/WorkspaceMatchersFactory.java 2011-11-22 16:44:21 UTC (rev 36537)
@@ -1,39 +0,0 @@
-package org.jboss.tools.portlet.ui.bot.test.matcher.workspace;
-
-import java.util.Arrays;
-
-import org.jboss.tools.portlet.ui.bot.test.entity.FacetDefinition;
-import org.jboss.tools.portlet.ui.bot.test.entity.WorkspaceFile;
-import org.jboss.tools.portlet.ui.bot.test.entity.XMLNode;
-import org.jboss.tools.portlet.ui.bot.test.matcher.SWTMatcher;
-import org.jboss.tools.portlet.ui.bot.test.matcher.workspace.file.ExistingFileMatcher;
-import org.jboss.tools.portlet.ui.bot.test.matcher.workspace.file.xml.XMLFileNodeContentMatcher;
-
-/**
- * Factory for workspace specific matchers (projects, files..)
- *
- * @author Lucia Jelinkova
- *
- */
-public class WorkspaceMatchersFactory {
-
- private WorkspaceMatchersFactory(){
- // not to be instantiated
- }
-
- public static SWTMatcher<String> isExistingProject(){
- return new ExistingProjectMatcher();
- }
-
- public static SWTMatcher<WorkspaceFile> exists(){
- return new ExistingFileMatcher();
- }
-
- public static SWTMatcher<String> hasFacets(FacetDefinition... facets){
- return new ProjectFacetsMatcher(facets);
- }
-
- public static SWTMatcher<WorkspaceFile> containsNodes(XMLNode... nodes){
- return new XMLFileNodeContentMatcher(Arrays.asList(nodes));
- }
-}
13 years, 1 month
JBoss Tools SVN: r36536 - in trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/task: server and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: ljelinko
Date: 2011-11-22 11:43:49 -0500 (Tue, 22 Nov 2011)
New Revision: 36536
Added:
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/task/server/
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/task/server/RunninngProjectOnServerTask.java
Log:
created
Added: trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/task/server/RunninngProjectOnServerTask.java
===================================================================
--- trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/task/server/RunninngProjectOnServerTask.java (rev 0)
+++ trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/task/server/RunninngProjectOnServerTask.java 2011-11-22 16:43:49 UTC (rev 36536)
@@ -0,0 +1,29 @@
+package org.jboss.tools.portlet.ui.bot.test.task.server;
+
+import org.jboss.tools.portlet.ui.bot.test.task.AbstractSWTTask;
+import org.jboss.tools.ui.bot.ext.SWTBotFactory;
+import org.jboss.tools.ui.bot.ext.config.Annotations.Require;
+import org.jboss.tools.ui.bot.ext.config.Annotations.Server;
+import org.jboss.tools.ui.bot.ext.config.Annotations.ServerState;
+import org.jboss.tools.ui.bot.ext.config.Annotations.ServerType;
+
+/**
+ * Performs Run on Server on the specified project.
+ *
+ * @author Lucia Jelinkova
+ *
+ */
+public class RunninngProjectOnServerTask extends AbstractSWTTask {
+
+ private String project;
+
+ public RunninngProjectOnServerTask(String project) {
+ this.project = project;
+ }
+
+ @Override
+ public void perform() {
+ SWTBotFactory.getPackageexplorer().show();
+ SWTBotFactory.getPackageexplorer().runOnServer(project);
+ }
+}
13 years, 1 month
JBoss Tools SVN: r36535 - in trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/task: console and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: ljelinko
Date: 2011-11-22 11:43:35 -0500 (Tue, 22 Nov 2011)
New Revision: 36535
Added:
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/task/console/
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/task/console/ConsoleClearingTask.java
Log:
created
Added: trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/task/console/ConsoleClearingTask.java
===================================================================
--- trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/task/console/ConsoleClearingTask.java (rev 0)
+++ trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/task/console/ConsoleClearingTask.java 2011-11-22 16:43:35 UTC (rev 36535)
@@ -0,0 +1,31 @@
+package org.jboss.tools.portlet.ui.bot.test.task.console;
+
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarButton;
+import org.jboss.tools.portlet.ui.bot.test.task.AbstractSWTTask;
+import org.jboss.tools.ui.bot.ext.SWTBotFactory;
+import org.jboss.tools.ui.bot.ext.types.IDELabel;
+
+/**
+ * Clears the console.
+ *
+ * @author Lucia Jelinkova
+ *
+ */
+public class ConsoleClearingTask extends AbstractSWTTask {
+
+ @Override
+ public void perform() {
+ // does not use the ConsoleView.clear() funtionality because it didn't work for me
+ SWTBotView view = SWTBotFactory.getConsole().show();
+
+ for (SWTBotToolbarButton button : view.getToolbarButtons()){
+ System.out.println(button.getToolTipText());
+ if (IDELabel.ConsoleView.BUTTON_CLEAR_CONSOLE_TOOLTIP.equals(button.getToolTipText())){
+ System.out.println("Before click");
+ button.click();
+ System.out.println("After click");
+ }
+ }
+ }
+}
13 years, 1 month
JBoss Tools SVN: r36534 - in trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test: create and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: ljelinko
Date: 2011-11-22 11:43:24 -0500 (Tue, 22 Nov 2011)
New Revision: 36534
Added:
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/create/RunJavaPortletOnServer.java
Modified:
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/AllTestsSuite.java
Log:
created new test
Modified: trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/AllTestsSuite.java
===================================================================
--- trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/AllTestsSuite.java 2011-11-22 16:25:31 UTC (rev 36533)
+++ trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/AllTestsSuite.java 2011-11-22 16:43:24 UTC (rev 36534)
@@ -2,13 +2,15 @@
import org.jboss.tools.portlet.ui.bot.test.create.CreateJavaPortlet;
import org.jboss.tools.portlet.ui.bot.test.create.CreateJavaPortletProject;
+import org.jboss.tools.portlet.ui.bot.test.create.RunJavaPortletOnServer;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
@RunWith(RequirementAwareUsageWindowClosingSuite.class)
@Suite.SuiteClasses({
CreateJavaPortletProject.class,
- CreateJavaPortlet.class
+ CreateJavaPortlet.class,
+ RunJavaPortletOnServer.class
})
public class AllTestsSuite {
Added: trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/create/RunJavaPortletOnServer.java
===================================================================
--- trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/create/RunJavaPortletOnServer.java (rev 0)
+++ trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/create/RunJavaPortletOnServer.java 2011-11-22 16:43:24 UTC (rev 36534)
@@ -0,0 +1,35 @@
+package org.jboss.tools.portlet.ui.bot.test.create;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.jboss.tools.portlet.ui.bot.test.create.CreateJavaPortletProject.PROJECT_NAME;
+import static org.hamcrest.Matchers.not;
+import static org.jboss.tools.portlet.ui.bot.test.matcher.factory.DefaultMatchersFactory.inConsoleOutput;
+
+import org.jboss.tools.portlet.ui.bot.test.task.console.ConsoleClearingTask;
+import org.jboss.tools.portlet.ui.bot.test.task.server.RunninngProjectOnServerTask;
+import org.jboss.tools.portlet.ui.bot.test.testcase.SWTTaskBasedTestCase;
+import org.jboss.tools.ui.bot.ext.config.Annotations.Require;
+import org.jboss.tools.ui.bot.ext.config.Annotations.Server;
+import org.jboss.tools.ui.bot.ext.config.Annotations.ServerState;
+import org.jboss.tools.ui.bot.ext.config.Annotations.ServerType;
+import org.junit.Test;
+
+/**
+ * Performs Run on Server on the java portlet project and checks if there is no exception in the
+ * console.
+ *
+ * @author Lucia Jelinkova
+ *
+ */
+@Require(clearWorkspace=false, clearProjects=false, server=@Server(required=true, state=ServerState.Running, type=ServerType.EPP))
+public class RunJavaPortletOnServer extends SWTTaskBasedTestCase {
+
+ @Test
+ public void testRunOnServer(){
+ doPerform(new ConsoleClearingTask());
+ doPerform(new RunninngProjectOnServerTask(PROJECT_NAME));
+
+ assertThat("Exception", not(inConsoleOutput()));
+ System.out.println();
+ }
+}
13 years, 1 month
JBoss Tools SVN: r36533 - trunk/download.jboss.org/jbosstools/updates/requirements/springide.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2011-11-22 11:25:31 -0500 (Tue, 22 Nov 2011)
New Revision: 36533
Added:
trunk/download.jboss.org/jbosstools/updates/requirements/springide/build-...
trunk/download.jboss.org/jbosstools/updates/requirements/springide/pom-2....
Removed:
trunk/download.jboss.org/jbosstools/updates/requirements/springide/pom.xml
Modified:
trunk/download.jboss.org/jbosstools/updates/requirements/springide/build.xml
Log:
fetch latest spingide 2.8; update build scripts
Copied: trunk/download.jboss.org/jbosstools/updates/requirements/springide/build-... (from rev 36532, trunk/download.jboss.org/jbosstools/updates/requirements/springide/build.xml)
===================================================================
--- trunk/download.jboss.org/jbosstools/updates/requirements/springide/build-... (rev 0)
+++ trunk/download.jboss.org/jbosstools/updates/requirements/springide/build-... 2011-11-22 16:25:31 UTC (rev 36533)
@@ -0,0 +1,95 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project default="default">
+ <!-- run locally in Eclipse (to resolve p2 tasks) using these commandline options:
+
+ -os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl}
+ -consoleLog -nosplash -data /tmp
+ -application org.eclipse.ant.core.antRunner
+ -f "/home/nboldt/tru/download.jboss.org/jbosstools/updates/requirements/springide/build.xml"
+
+ or, run headless on qa01 server, where Eclipse is installed into ~/eclipse:
+
+ export JAVA_HOME=/opt/jdk1.6.0; \
+ ${JAVA_HOME}/bin/java -cp ~/eclipse/plugins/org.eclipse.equinox.launcher_*.jar \
+ org.eclipse.equinox.launcher.Main -vm ${JAVA_HOME} -consoleLog -nosplash -data /tmp \
+ -application org.eclipse.ant.core.antRunner \
+ -f ~/RHDS/updates/requirements/springide/build.xml -Ddestination=/tmp/pmd-repo
+
+ or, run local:
+
+ export JAVA_HOME=/opt/jdk1.6.0; \
+ java -cp ~/eclipse/eclipse370/plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar \
+ org.eclipse.equinox.launcher.Main -vm ${JAVA_HOME} -consoleLog -nosplash -data /tmp \
+ -application org.eclipse.ant.core.antRunner -f build.xml
+ -->
+ <target name="default" depends="init,mirror,apply.patch,regenerate.metadata" />
+ <target name="patch.and.regen" depends="init,apply.patch,regenerate.metadata" />
+
+ <target name="init">
+ <!-- Other URLs:
+ http://dist.springframework.org/release/IDE/
+ http://dist.springframework.org/snapshot/IDE/weekly/
+ http://dist.springsource.com/release/TOOLS/update/e3.6/
+ -->
+ <property name="URL" value="http://dist.springsource.com/release/TOOLS/update/e3.6/" />
+ <property name="destination" value="/home/nboldt/tru/download.jboss.org/jbosstools/updates/requirements/springide/" />
+ <property name="siteVersion" value="2.6.0.201103160035" />
+ <property name="compress" value="true" />
+ </target>
+
+ <target name="mirror">
+ <p2.mirror>
+ <repository location="file:${destination}/${siteVersion}/" name="springide plugins for Eclipse 3.6 - 3.7" />
+ <source>
+ <repository location="${URL}" />
+ </source>
+
+ <iu id="org.springframework.ide.eclipse.feature.feature.group" />
+ <iu id="org.springframework.ide.eclipse.aop.feature.feature.group" />
+ <iu id="org.springframework.ide.eclipse.osgi.feature.feature.group" />
+ <iu id="org.springframework.ide.eclipse.webflow.feature.feature.group" />
+ <iu id="org.springframework.ide.eclipse.batch.feature.feature.group" />
+ <iu id="org.springframework.ide.eclipse.integration.feature.feature.group" />
+ <iu id="org.springframework.ide.eclipse.security.feature.feature.group" />
+ <iu id="org.springframework.ide.eclipse.autowire.feature.feature.group" />
+ <iu id="org.springframework.ide.eclipse.mylyn.feature.feature.group" />
+
+ <slicingoptions includefeatures="true" followstrict="true" latestversiononly="false" platformfilter="true" />
+ </p2.mirror>
+ </target>
+
+ <target name="apply.patch">
+ <echo>JBDS-1838 :: Apply patch to disable SpringIDE welcome page</echo>
+ <!-- unzip jar
+ replace about.ini
+ replace MANIFEST.MF
+ delete welcome.xml META-INF/VMWARE.*
+ zip jar -->
+ <copy file="${destination}/${siteVersion}/plugins/org.springframework.ide.eclipse_${siteVersion}-RELEASE.jar" tofile="${destination}/${siteVersion}/plugins/org.springframework.ide.eclipse_${siteVersion}-RELEASE_ORIGINAL.jar" />
+ <unzip src="${destination}/${siteVersion}/plugins/org.springframework.ide.eclipse_${siteVersion}-RELEASE.jar" dest="${destination}/${siteVersion}/plugins/org.springframework.ide.eclipse" />
+ <echo file="${destination}/${siteVersion}/plugins/org.springframework.ide.eclipse/about.ini">
+aboutText=%title
+featureImage=feature_image.png
+</echo>
+ <echo file="${destination}/${siteVersion}/plugins/org.springframework.ide.eclipse/META-INF/MANIFEST.MF">Manifest-Version: 1.0
+Bundle-Name: %pluginName
+Bundle-Localization: plugin
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-Vendor: %providerName
+Bundle-Version: ${siteVersion}-RELEASE
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: org.springframework.ide.eclipse
+</echo>
+ <delete quiet="true">
+ <fileset dir="${destination}/${siteVersion}/plugins/org.springframework.ide.eclipse" includes="welcome.xml" />
+ <fileset dir="${destination}/${siteVersion}/plugins/org.springframework.ide.eclipse/META-INF" includes="eclipse.inf, VMWARE.RSA, VMWARE.SF" />
+ </delete>
+ <zip destfile="${destination}/${siteVersion}/plugins/org.springframework.ide.eclipse_${siteVersion}-RELEASE.jar" basedir="${destination}/${siteVersion}/plugins/org.springframework.ide.eclipse/" />
+ <delete dir="${destination}/${siteVersion}/plugins/org.springframework.ide.eclipse/" quiet="true" />
+ </target>
+
+ <target name="regenerate.metadata">
+ <p2.publish.featuresAndBundles metadataRepository="file:${destination}/${siteVersion}/" artifactRepository="file:${destination}/${siteVersion}/" publishartifacts="true" source="${destination}/${siteVersion}/" compress="${compress}" />
+ </target>
+
+</project>
Modified: trunk/download.jboss.org/jbosstools/updates/requirements/springide/build.xml
===================================================================
--- trunk/download.jboss.org/jbosstools/updates/requirements/springide/build.xml 2011-11-22 14:16:15 UTC (rev 36532)
+++ trunk/download.jboss.org/jbosstools/updates/requirements/springide/build.xml 2011-11-22 16:25:31 UTC (rev 36533)
@@ -29,17 +29,17 @@
<!-- Other URLs:
http://dist.springframework.org/release/IDE/
http://dist.springframework.org/snapshot/IDE/weekly/
- http://dist.springsource.com/release/TOOLS/update/e3.6/
+ http://dist.springsource.com/release/TOOLS/update/e3.7/
-->
- <property name="URL" value="http://dist.springsource.com/release/TOOLS/update/e3.6/" />
+ <property name="URL" value="http://dist.springsource.com/release/TOOLS/update/e3.7/" />
<property name="destination" value="/home/nboldt/tru/download.jboss.org/jbosstools/updates/requirements/springide/" />
- <property name="siteVersion" value="2.6.0.201103160035" />
+ <property name="siteVersion" value="2.8.0.201110170010-RELEASE" />
<property name="compress" value="true" />
</target>
<target name="mirror">
<p2.mirror>
- <repository location="file:${destination}/${siteVersion}/" name="springide plugins for Eclipse 3.6 - 3.7" />
+ <repository location="file:${destination}/${siteVersion}/" name="springide plugins for Eclipse 3.7" />
<source>
<repository location="${URL}" />
</source>
@@ -65,8 +65,8 @@
replace MANIFEST.MF
delete welcome.xml META-INF/VMWARE.*
zip jar -->
- <copy file="${destination}/${siteVersion}/plugins/org.springframework.ide.eclipse_${siteVersion}-RELEASE.jar" tofile="${destination}/${siteVersion}/plugins/org.springframework.ide.eclipse_${siteVersion}-RELEASE_ORIGINAL.jar" />
- <unzip src="${destination}/${siteVersion}/plugins/org.springframework.ide.eclipse_${siteVersion}-RELEASE.jar" dest="${destination}/${siteVersion}/plugins/org.springframework.ide.eclipse" />
+ <copy file="${destination}/${siteVersion}/plugins/org.springframework.ide.eclipse_${siteVersion}.jar" tofile="${destination}/${siteVersion}/plugins/org.springframework.ide.eclipse_${siteVersion}_ORIGINAL.jar" />
+ <unzip src="${destination}/${siteVersion}/plugins/org.springframework.ide.eclipse_${siteVersion}.jar" dest="${destination}/${siteVersion}/plugins/org.springframework.ide.eclipse" />
<echo file="${destination}/${siteVersion}/plugins/org.springframework.ide.eclipse/about.ini">
aboutText=%title
featureImage=feature_image.png
@@ -76,7 +76,7 @@
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-Vendor: %providerName
-Bundle-Version: ${siteVersion}-RELEASE
+Bundle-Version: ${siteVersion}
Bundle-ManifestVersion: 2
Bundle-SymbolicName: org.springframework.ide.eclipse
</echo>
@@ -84,7 +84,7 @@
<fileset dir="${destination}/${siteVersion}/plugins/org.springframework.ide.eclipse" includes="welcome.xml" />
<fileset dir="${destination}/${siteVersion}/plugins/org.springframework.ide.eclipse/META-INF" includes="eclipse.inf, VMWARE.RSA, VMWARE.SF" />
</delete>
- <zip destfile="${destination}/${siteVersion}/plugins/org.springframework.ide.eclipse_${siteVersion}-RELEASE.jar" basedir="${destination}/${siteVersion}/plugins/org.springframework.ide.eclipse/" />
+ <zip destfile="${destination}/${siteVersion}/plugins/org.springframework.ide.eclipse_${siteVersion}.jar" basedir="${destination}/${siteVersion}/plugins/org.springframework.ide.eclipse/" />
<delete dir="${destination}/${siteVersion}/plugins/org.springframework.ide.eclipse/" quiet="true" />
</target>
Copied: trunk/download.jboss.org/jbosstools/updates/requirements/springide/pom-2.... (from rev 36532, trunk/download.jboss.org/jbosstools/updates/requirements/springide/pom.xml)
===================================================================
--- trunk/download.jboss.org/jbosstools/updates/requirements/springide/pom-2.... (rev 0)
+++ trunk/download.jboss.org/jbosstools/updates/requirements/springide/pom-2.... 2011-11-22 16:25:31 UTC (rev 36533)
@@ -0,0 +1,120 @@
+<project
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+ xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.jboss.tools</groupId>
+ <artifactId>org.jboss.tools.requirements.springide</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ <packaging>pom</packaging>
+ <properties>
+ <!-- TODO: when there's enough of these scripts, externalize these to a
+ parent pom in ../ -->
+ <tychoVersion>0.13.0</tychoVersion>
+ <maven.antrun.plugin.version>1.3</maven.antrun.plugin.version>
+
+ <!-- TODO: update this every time you use this script against a new target
+ version + resulting folder -->
+ <sourceURL>http://dist.springsource.com/release/TOOLS/update/e3.7</sourceURL>
+ <siteVersion>2.7.2.201109122348</siteVersion>
+ <destination>${project.build.directory}/../${siteVersion}</destination>
+ </properties>
+
+ <build>
+ <plugins>
+ <plugin>
+ <!-- see http://wiki.eclipse.org/Tycho/Additional_Tools -->
+ <groupId>org.eclipse.tycho.extras</groupId>
+ <artifactId>tycho-p2-extras-plugin</artifactId>
+ <version>${tychoVersion}</version>
+ <executions>
+ <execution>
+ <phase>prepare-package</phase>
+ <goals>
+ <goal>mirror</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <source>
+ <repository>
+ <url>${sourceURL}</url>
+ <layout>p2</layout>
+ </repository>
+ </source>
+
+ <!-- List of IUs to mirror. If omitted, all IUs will be mirrored. -->
+ <!-- Omitted IU version element means latest version of the IU -->
+ <ius>
+ <iu>
+ <id>org.springframework.ide.eclipse.feature.feature.group</id>
+ </iu>
+ <iu>
+ <id>org.springframework.ide.eclipse.aop.feature.feature.group</id>
+ </iu>
+ <iu>
+ <id>org.springframework.ide.eclipse.osgi.feature.feature.group</id>
+ </iu>
+ <iu>
+ <id>org.springframework.ide.eclipse.webflow.feature.feature.group</id>
+ </iu>
+ <iu>
+ <id>org.springframework.ide.eclipse.batch.feature.feature.group</id>
+ </iu>
+ <iu>
+ <id>org.springframework.ide.eclipse.integration.feature.feature.group</id>
+ </iu>
+ <iu>
+ <id>org.springframework.ide.eclipse.security.feature.feature.group</id>
+ </iu>
+ <iu>
+ <id>org.springframework.ide.eclipse.autowire.feature.feature.group</id>
+ </iu>
+ <iu>
+ <id>org.springframework.ide.eclipse.mylyn.feature.feature.group</id>
+ </iu>
+ </ius>
+ <!-- The destination directory to mirror to. -->
+ <destination>${destination}</destination>
+ <!-- Whether only strict dependencies should be followed. -->
+ <!-- "strict" means perfect version match -->
+ <followStrictOnly>true</followStrictOnly>
+ <!-- Whether or not to follow optional requirements. -->
+ <includeOptional>true</includeOptional>
+ <!-- Whether or not to follow non-greedy requirements. -->
+ <includeNonGreedy>true</includeNonGreedy>
+ <!-- filter properties. E.g. filter only one platform -->
+ <!-- <filter> <osgi.os>linux</osgi.os> <osgi.ws>gtk</osgi.ws> <osgi.arch>x86_64</osgi.arch>
+ </filter> -->
+ <latestVersionOnly>true</latestVersionOnly>
+ <mirrorMetadataOnly>false</mirrorMetadataOnly>
+ <compress>true</compress>
+ <append>false</append>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <version>${maven.antrun.plugin.version}</version>
+ <executions>
+ <execution>
+ <id>install</id>
+ <phase>install</phase>
+ <configuration>
+ <quiet>true</quiet>
+ <tasks>
+ <!-- remove the target/ folder -->
+ <delete dir="${project.build.directory}" quiet="true" />
+ <echo>To apply patch to disable SpringIDE welcome page (JBDS-1838), run build.xml in this folder passing in these parameters:
+ patch.and.regen -DsiteVersion=${siteVersion} -DURL=${sourceURL}
+ </echo>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Deleted: trunk/download.jboss.org/jbosstools/updates/requirements/springide/pom.xml
===================================================================
--- trunk/download.jboss.org/jbosstools/updates/requirements/springide/pom.xml 2011-11-22 14:16:15 UTC (rev 36532)
+++ trunk/download.jboss.org/jbosstools/updates/requirements/springide/pom.xml 2011-11-22 16:25:31 UTC (rev 36533)
@@ -1,120 +0,0 @@
-<project
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
- xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.jboss.tools</groupId>
- <artifactId>org.jboss.tools.requirements.springide</artifactId>
- <version>0.0.1-SNAPSHOT</version>
- <packaging>pom</packaging>
- <properties>
- <!-- TODO: when there's enough of these scripts, externalize these to a
- parent pom in ../ -->
- <tychoVersion>0.13.0</tychoVersion>
- <maven.antrun.plugin.version>1.3</maven.antrun.plugin.version>
-
- <!-- TODO: update this every time you use this script against a new target
- version + resulting folder -->
- <sourceURL>http://dist.springsource.com/release/TOOLS/update/e3.7</sourceURL>
- <siteVersion>2.7.2.201109122348</siteVersion>
- <destination>${project.build.directory}/../${siteVersion}</destination>
- </properties>
-
- <build>
- <plugins>
- <plugin>
- <!-- see http://wiki.eclipse.org/Tycho/Additional_Tools -->
- <groupId>org.eclipse.tycho.extras</groupId>
- <artifactId>tycho-p2-extras-plugin</artifactId>
- <version>${tychoVersion}</version>
- <executions>
- <execution>
- <phase>prepare-package</phase>
- <goals>
- <goal>mirror</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <source>
- <repository>
- <url>${sourceURL}</url>
- <layout>p2</layout>
- </repository>
- </source>
-
- <!-- List of IUs to mirror. If omitted, all IUs will be mirrored. -->
- <!-- Omitted IU version element means latest version of the IU -->
- <ius>
- <iu>
- <id>org.springframework.ide.eclipse.feature.feature.group</id>
- </iu>
- <iu>
- <id>org.springframework.ide.eclipse.aop.feature.feature.group</id>
- </iu>
- <iu>
- <id>org.springframework.ide.eclipse.osgi.feature.feature.group</id>
- </iu>
- <iu>
- <id>org.springframework.ide.eclipse.webflow.feature.feature.group</id>
- </iu>
- <iu>
- <id>org.springframework.ide.eclipse.batch.feature.feature.group</id>
- </iu>
- <iu>
- <id>org.springframework.ide.eclipse.integration.feature.feature.group</id>
- </iu>
- <iu>
- <id>org.springframework.ide.eclipse.security.feature.feature.group</id>
- </iu>
- <iu>
- <id>org.springframework.ide.eclipse.autowire.feature.feature.group</id>
- </iu>
- <iu>
- <id>org.springframework.ide.eclipse.mylyn.feature.feature.group</id>
- </iu>
- </ius>
- <!-- The destination directory to mirror to. -->
- <destination>${destination}</destination>
- <!-- Whether only strict dependencies should be followed. -->
- <!-- "strict" means perfect version match -->
- <followStrictOnly>true</followStrictOnly>
- <!-- Whether or not to follow optional requirements. -->
- <includeOptional>true</includeOptional>
- <!-- Whether or not to follow non-greedy requirements. -->
- <includeNonGreedy>true</includeNonGreedy>
- <!-- filter properties. E.g. filter only one platform -->
- <!-- <filter> <osgi.os>linux</osgi.os> <osgi.ws>gtk</osgi.ws> <osgi.arch>x86_64</osgi.arch>
- </filter> -->
- <latestVersionOnly>true</latestVersionOnly>
- <mirrorMetadataOnly>false</mirrorMetadataOnly>
- <compress>true</compress>
- <append>false</append>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-antrun-plugin</artifactId>
- <version>${maven.antrun.plugin.version}</version>
- <executions>
- <execution>
- <id>install</id>
- <phase>install</phase>
- <configuration>
- <quiet>true</quiet>
- <tasks>
- <!-- remove the target/ folder -->
- <delete dir="${project.build.directory}" quiet="true" />
- <echo>To apply patch to disable SpringIDE welcome page (JBDS-1838), run build.xml in this folder passing in these parameters:
- patch.and.regen -DsiteVersion=${siteVersion} -DURL=${sourceURL}
- </echo>
- </tasks>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-</project>
13 years, 1 month
JBoss Tools SVN: r36532 - in trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test: annotations and 7 other directories.
by jbosstools-commits@lists.jboss.org
Author: jjankovi
Date: 2011-11-22 09:16:15 -0500 (Tue, 22 Nov 2011)
New Revision: 36532
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/CDITestBase.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/annotations/BeansXMLValidationErrors.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/annotations/CDIWizardType.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/beansxml/BeansXMLValidationTest.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/openon/FindObserverForEventTest.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/openon/OpenOnBase.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/openon/OpenOnTest.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/BeanValidationQuickFixTest.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/DecoratorValidationQuickFixTest.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/IBindingValidationQuickFixTest.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/InterceptorValidationQuickFixTest.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/QualifierValidationQuickFixTest.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/QuickFixTestBase.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/ScopeValidationQuickFixTest.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/StereotypeValidationQuickFixTest.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/validators/AbstractValidationProvider.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/validators/BeanValidationProvider.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/validators/DecoratorValidationProvider.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/validators/InterceptorBindingValidationProvider.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/validators/InterceptorValidationProvider.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/validators/QualifierValidationProvider.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/validators/ScopeValidationProvider.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/validators/StereotypeValidationProvider.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/validators/ValidationErrorProvider.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/BeansXMLValidationHelper.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/NodeContextUtil.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/wizards/CDIWizard.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/wizards/CDIWizardBaseExt.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/wizard/FacetTest.java
Log:
JavaDoc completion
Modified: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/CDITestBase.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/CDITestBase.java 2011-11-22 13:26:39 UTC (rev 36531)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/CDITestBase.java 2011-11-22 14:16:15 UTC (rev 36532)
@@ -44,11 +44,11 @@
util.waitForNonIgnoredJobs();
}
- public String getProjectName() {
+ protected String getProjectName() {
return projectName;
}
- public String getPackageName() {
+ protected String getPackageName() {
return packageName;
}
Modified: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/annotations/BeansXMLValidationErrors.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/annotations/BeansXMLValidationErrors.java 2011-11-22 13:26:39 UTC (rev 36531)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/annotations/BeansXMLValidationErrors.java 2011-11-22 14:16:15 UTC (rev 36532)
@@ -1,3 +1,14 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
package org.jboss.tools.cdi.bot.test.annotations;
public enum BeansXMLValidationErrors {
Modified: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/annotations/CDIWizardType.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/annotations/CDIWizardType.java 2011-11-22 13:26:39 UTC (rev 36531)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/annotations/CDIWizardType.java 2011-11-22 14:16:15 UTC (rev 36532)
@@ -9,6 +9,7 @@
* Contributors:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
+
package org.jboss.tools.cdi.bot.test.annotations;
public enum CDIWizardType {
Modified: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/beansxml/BeansXMLValidationTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/beansxml/BeansXMLValidationTest.java 2011-11-22 13:26:39 UTC (rev 36531)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/beansxml/BeansXMLValidationTest.java 2011-11-22 14:16:15 UTC (rev 36532)
@@ -25,7 +25,8 @@
import org.junit.runners.Suite.SuiteClasses;
/**
- * Test operates on code completion in beans.xml
+ * Test operates on beans validation in config file
+ * beans.xml
*
* @author Jaroslav Jankovic
*
Modified: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/openon/FindObserverForEventTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/openon/FindObserverForEventTest.java 2011-11-22 13:26:39 UTC (rev 36531)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/openon/FindObserverForEventTest.java 2011-11-22 14:16:15 UTC (rev 36532)
@@ -26,7 +26,7 @@
import org.junit.runners.Suite.SuiteClasses;
/**
- * Test operates on CDI perspective
+ * Test operates on finding right observer for event and vice versa
*
* @author Jaroslav Jankovic
*/
Modified: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/openon/OpenOnBase.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/openon/OpenOnBase.java 2011-11-22 13:26:39 UTC (rev 36531)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/openon/OpenOnBase.java 2011-11-22 14:16:15 UTC (rev 36532)
@@ -31,7 +31,14 @@
"observeNoQualifierMyBean2", "observeAnyMyBean2",
"observeQ1MyBean2", "observeQ2MyBean1", "observeQ2MyBean2" };
-
+ /**
+ * Method creates Decorator component with entered name and package name.
+ * Then it opens beans.xml and simulates direct openOn through method openOnDirect.
+ * Finally it checks if the class which was opened-on to is correct.
+ * @param packageName
+ * @param className
+ * @return
+ */
protected boolean checkBeanXMLDecoratorOpenOn(String packageName, String className) {
wizard.createCDIComponent(CDIWizardType.DECORATOR, className, packageName,
"java.util.Set");
@@ -41,6 +48,15 @@
return getEd().getTitle().equals(className + ".java");
}
+
+ /**
+ * Method creates Interceptor component with entered name and package name.
+ * Then it opens beans.xml and simulates direct openOn through method openOnDirect.
+ * Finally it checks if the class which was opened-on to is correct.
+ * @param packageName
+ * @param className
+ * @return
+ */
protected boolean checkBeanXMLInterceptorOpenOn(String packageName, String className) {
wizard.createCDIComponent(CDIWizardType.INTERCEPTOR, className, packageName,
null);
@@ -50,6 +66,14 @@
return getEd().getTitle().equals(className + ".java");
}
+ /**
+ * Method creates Alternative Bean component with entered name and package name.
+ * Then it opens beans.xml and simulates direct openOn through method openOnDirect.
+ * Finally it checks if the class which was opened-on to is correct.
+ * @param packageName
+ * @param className
+ * @return
+ */
protected boolean checkBeanXMLAlternativeOpenOn(String packageName, String className) {
wizard.createCDIComponent(CDIWizardType.BEAN, className, packageName,
"alternative+beansxml");
Modified: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/openon/OpenOnTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/openon/OpenOnTest.java 2011-11-22 13:26:39 UTC (rev 36531)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/openon/OpenOnTest.java 2011-11-22 14:16:15 UTC (rev 36532)
@@ -26,7 +26,7 @@
import org.junit.runners.Suite.SuiteClasses;
/**
- * Test operates on hyperlinks-openons using CDI tools
+ * Test operates on hyperlinks-openons using CDI support
*
* @author Jaroslav Jankovic
*
@@ -73,9 +73,8 @@
}
- /**
- * https://issues.jboss.org/browse/JBIDE-6251
- */
+
+ // https://issues.jboss.org/browse/JBIDE-6251
@Test
public void testDisposerProducerOpenOn() {
Modified: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/BeanValidationQuickFixTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/BeanValidationQuickFixTest.java 2011-11-22 13:26:39 UTC (rev 36531)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/BeanValidationQuickFixTest.java 2011-11-22 14:16:15 UTC (rev 36532)
@@ -24,7 +24,7 @@
import org.junit.runners.Suite.SuiteClasses;
/**
- * Test operates on quick fixes of CDI components validation
+ * Test operates on quick fixes used for validation errors of CDI bean component
*
* @author Jaroslav Jankovic
*/
Modified: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/DecoratorValidationQuickFixTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/DecoratorValidationQuickFixTest.java 2011-11-22 13:26:39 UTC (rev 36531)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/DecoratorValidationQuickFixTest.java 2011-11-22 14:16:15 UTC (rev 36532)
@@ -24,7 +24,7 @@
import org.junit.runners.Suite.SuiteClasses;
/**
- * Test operates on quick fixes of CDI components validation
+ * Test operates on quick fixes used for validation errors of CDI Decorator component
*
* @author Jaroslav Jankovic
*/
Modified: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/IBindingValidationQuickFixTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/IBindingValidationQuickFixTest.java 2011-11-22 13:26:39 UTC (rev 36531)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/IBindingValidationQuickFixTest.java 2011-11-22 14:16:15 UTC (rev 36532)
@@ -24,7 +24,7 @@
import org.junit.runners.Suite.SuiteClasses;
/**
- * Test operates on quick fixes of CDI components validation
+ * Test operates on quick fixes used for validation errors of CDI Interceptor Binding component
*
* @author Jaroslav Jankovic
*/
Modified: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/InterceptorValidationQuickFixTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/InterceptorValidationQuickFixTest.java 2011-11-22 13:26:39 UTC (rev 36531)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/InterceptorValidationQuickFixTest.java 2011-11-22 14:16:15 UTC (rev 36532)
@@ -24,7 +24,7 @@
import org.junit.runners.Suite.SuiteClasses;
/**
- * Test operates on quick fixes of CDI components validation
+ * Test operates on quick fixes used for validation errors of CDI Interceptor component
*
* @author Jaroslav Jankovic
*/
Modified: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/QualifierValidationQuickFixTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/QualifierValidationQuickFixTest.java 2011-11-22 13:26:39 UTC (rev 36531)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/QualifierValidationQuickFixTest.java 2011-11-22 14:16:15 UTC (rev 36532)
@@ -24,7 +24,7 @@
import org.junit.runners.Suite.SuiteClasses;
/**
- * Test operates on quick fixes of CDI components validation
+ * Test operates on quick fixes used for validation errors of CDI Qualifier component
*
* @author Jaroslav Jankovic
*/
Modified: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/QuickFixTestBase.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/QuickFixTestBase.java 2011-11-22 13:26:39 UTC (rev 36531)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/QuickFixTestBase.java 2011-11-22 14:16:15 UTC (rev 36532)
@@ -120,7 +120,7 @@
/**
* Method resolves particular validation problem (parameter ti).
* It simply open context menu for param "ti", open menu "Quick Fix" and
- * chooses first option and confirms it
+ * chooses first option and confirms it (resolve it)
*
* @param ti
*/
Modified: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/ScopeValidationQuickFixTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/ScopeValidationQuickFixTest.java 2011-11-22 13:26:39 UTC (rev 36531)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/ScopeValidationQuickFixTest.java 2011-11-22 14:16:15 UTC (rev 36532)
@@ -24,7 +24,7 @@
import org.junit.runners.Suite.SuiteClasses;
/**
- * Test operates on quick fixes of CDI components validation
+ * Test operates on quick fixes used for validation errors of CDI Scope component
*
* @author Jaroslav Jankovic
*/
Modified: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/StereotypeValidationQuickFixTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/StereotypeValidationQuickFixTest.java 2011-11-22 13:26:39 UTC (rev 36531)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/StereotypeValidationQuickFixTest.java 2011-11-22 14:16:15 UTC (rev 36532)
@@ -24,7 +24,7 @@
import org.junit.runners.Suite.SuiteClasses;
/**
- * Test operates on quick fixes of CDI stereotype component validation
+ * Test operates on quick fixes used for validation errors of CDI Stereotype component
*
* @author Jaroslav Jankovic
*/
Modified: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/validators/AbstractValidationProvider.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/validators/AbstractValidationProvider.java 2011-11-22 13:26:39 UTC (rev 36531)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/validators/AbstractValidationProvider.java 2011-11-22 14:16:15 UTC (rev 36532)
@@ -1,3 +1,14 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
package org.jboss.tools.cdi.bot.test.quickfix.validators;
import java.util.ArrayList;
Modified: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/validators/BeanValidationProvider.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/validators/BeanValidationProvider.java 2011-11-22 13:26:39 UTC (rev 36531)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/validators/BeanValidationProvider.java 2011-11-22 14:16:15 UTC (rev 36532)
@@ -1,3 +1,14 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
package org.jboss.tools.cdi.bot.test.quickfix.validators;
import java.util.ArrayList;
Modified: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/validators/DecoratorValidationProvider.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/validators/DecoratorValidationProvider.java 2011-11-22 13:26:39 UTC (rev 36531)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/validators/DecoratorValidationProvider.java 2011-11-22 14:16:15 UTC (rev 36532)
@@ -1,3 +1,14 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
package org.jboss.tools.cdi.bot.test.quickfix.validators;
import java.util.ArrayList;
Modified: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/validators/InterceptorBindingValidationProvider.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/validators/InterceptorBindingValidationProvider.java 2011-11-22 13:26:39 UTC (rev 36531)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/validators/InterceptorBindingValidationProvider.java 2011-11-22 14:16:15 UTC (rev 36532)
@@ -1,3 +1,14 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
package org.jboss.tools.cdi.bot.test.quickfix.validators;
import java.util.ArrayList;
Modified: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/validators/InterceptorValidationProvider.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/validators/InterceptorValidationProvider.java 2011-11-22 13:26:39 UTC (rev 36531)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/validators/InterceptorValidationProvider.java 2011-11-22 14:16:15 UTC (rev 36532)
@@ -1,3 +1,14 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
package org.jboss.tools.cdi.bot.test.quickfix.validators;
import java.util.ArrayList;
Modified: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/validators/QualifierValidationProvider.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/validators/QualifierValidationProvider.java 2011-11-22 13:26:39 UTC (rev 36531)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/validators/QualifierValidationProvider.java 2011-11-22 14:16:15 UTC (rev 36532)
@@ -1,3 +1,14 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
package org.jboss.tools.cdi.bot.test.quickfix.validators;
import java.util.ArrayList;
Modified: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/validators/ScopeValidationProvider.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/validators/ScopeValidationProvider.java 2011-11-22 13:26:39 UTC (rev 36531)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/validators/ScopeValidationProvider.java 2011-11-22 14:16:15 UTC (rev 36532)
@@ -1,3 +1,14 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
package org.jboss.tools.cdi.bot.test.quickfix.validators;
import java.util.ArrayList;
Modified: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/validators/StereotypeValidationProvider.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/validators/StereotypeValidationProvider.java 2011-11-22 13:26:39 UTC (rev 36531)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/validators/StereotypeValidationProvider.java 2011-11-22 14:16:15 UTC (rev 36532)
@@ -1,3 +1,14 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
package org.jboss.tools.cdi.bot.test.quickfix.validators;
import java.util.ArrayList;
Modified: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/validators/ValidationErrorProvider.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/validators/ValidationErrorProvider.java 2011-11-22 13:26:39 UTC (rev 36531)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/validators/ValidationErrorProvider.java 2011-11-22 14:16:15 UTC (rev 36532)
@@ -1,3 +1,14 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
package org.jboss.tools.cdi.bot.test.quickfix.validators;
import org.jboss.tools.cdi.bot.test.annotations.CDIAnnotationsType;
@@ -7,13 +18,43 @@
public interface ValidationErrorProvider {
+ /**
+ * Method gets all validation errors showed in Problems View for actual component
+ * @return
+ */
Map<String, ArrayList<String>> getAllValidationErrors();
+ /**
+ * Method gets all validation errors showed in Problems View as warnings
+ * according to entered annotation
+ *
+ * @param annotationType
+ * @return
+ */
ArrayList<String> getAllWarningForAnnotationType(CDIAnnotationsType annotationType);
+ /**
+ * Method gets all validation errors showed in Problems View as errors
+ * according to entered annotation
+ *
+ * @param annotationType
+ * @return
+ */
ArrayList<String> getAllErrorsForAnnotationType(CDIAnnotationsType annotationType);
+ /**
+ * Method gets all annotations for which exist validation errors showed in Problems View
+ * marked as warning
+ *
+ * @return
+ */
ArrayList<CDIAnnotationsType> getAllWarningsAnnotation();
+ /**
+ * Method gets all annotations for which exist validation errors showed in Problems View
+ * marked as errors
+ *
+ * @return
+ */
ArrayList<CDIAnnotationsType> getAllErrorsAnnotation();
}
Modified: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/BeansXMLValidationHelper.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/BeansXMLValidationHelper.java 2011-11-22 13:26:39 UTC (rev 36531)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/BeansXMLValidationHelper.java 2011-11-22 14:16:15 UTC (rev 36532)
@@ -19,7 +19,7 @@
import org.jboss.tools.ui.bot.ext.view.ProblemsView;
/**
- * Test operates on code completion in beans.xml
+ * Helper for beans.xml validation
*
* @author Jaroslav Jankovic
*
@@ -28,6 +28,8 @@
public class BeansXMLValidationHelper extends CDITestBase {
/**
+ * Method checks if there is validation problem with text
+ * specified by parameter validationErrors for entered project
*
* @param validationError
* @return
@@ -55,6 +57,9 @@
}
/**
+ * Method checks if there is no validation problem when
+ * creating interceptor component with entered className
+ * packageName for project with name projectName
*
* @param projectName
* @param packageName
@@ -68,6 +73,9 @@
}
/**
+ * Method checks if there is no validation problem when
+ * creating decorator component with entered className
+ * packageName for project with name projectName
*
* @param projectName
* @param packageName
@@ -81,6 +89,9 @@
}
/**
+ * Method checks if there is no validation problem when
+ * creating alternative bean component with entered className
+ * packageName for project with name projectName
*
* @param projectName
* @param packageName
@@ -94,6 +105,8 @@
}
/**
+ * Method gets all beans.xml validation errors showed in Problems View
+ * for entered project
*
* @return
*/
@@ -103,9 +116,8 @@
}
/**
- * Methods creates beans.xml with no tags. Location is provided by parameter.
- * If beans.xml already exists, its content is replaced by pure beans.xml with no
- * tags in it.
+ * Methods creates beans.xml with no tags for entered project.
+ *
* @param projectName
*/
public void createClearBeansXML(String projectName) {
@@ -115,6 +127,9 @@
}
/**
+ * Methods creates beans.xml with interceptor tags in it for entered project.
+ * Package and interceptor component name which should be showed in tag is
+ * determined by parameters
*
* @param projectName
* @param packageName
@@ -130,6 +145,9 @@
}
/**
+ * Methods creates beans.xml with decorator tags in it for entered project.
+ * Package and decorator component name which should be showed in tag is
+ * determined by parameters
*
* @param projectName
* @param packageName
@@ -144,6 +162,9 @@
}
/**
+ * Methods creates beans.xml with alternative tags in it for entered project.
+ * Package and alternative bean component name which should be showed in tag is
+ * determined by parameters
*
* @param projectName
* @param packageName
@@ -158,6 +179,9 @@
}
/**
+ * Methods create beans.xml for entered project with content of file
+ * determined by parameter path. If there is beans.xml in project, its
+ * content is simply replaced
*
* @param projectName
* @param path
Modified: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/NodeContextUtil.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/NodeContextUtil.java 2011-11-22 13:26:39 UTC (rev 36531)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/NodeContextUtil.java 2011-11-22 14:16:15 UTC (rev 36532)
@@ -1,3 +1,14 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
package org.jboss.tools.cdi.bot.test.uiutils;
import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;
Modified: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/wizards/CDIWizard.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/wizards/CDIWizard.java 2011-11-22 13:26:39 UTC (rev 36531)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/wizards/CDIWizard.java 2011-11-22 14:16:15 UTC (rev 36532)
@@ -20,6 +20,7 @@
/**
* Method creates Java Annotation with selected name and package
+ *
* @param name
* @param packageName
*/
@@ -29,7 +30,8 @@
/**
* Method creates CDI component with workaround for beans.xml -
- * if component is beans.xml, editor is not set
+ * if component is beans.xml, editor is not set (there is no active editor by default)
+ *
* @param component
* @param name
* @param packageName
@@ -50,6 +52,7 @@
/**
* Method creates larger number("amount") of the same component.
+ *
* @param component
* @param amount
* @param baseName
@@ -69,6 +72,7 @@
/**
* Method that actually creates CDI component according to parameter
+ *
* @param component
* @param name
* @param packageName
Modified: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/wizards/CDIWizardBaseExt.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/wizards/CDIWizardBaseExt.java 2011-11-22 13:26:39 UTC (rev 36531)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/wizards/CDIWizardBaseExt.java 2011-11-22 14:16:15 UTC (rev 36532)
@@ -1,3 +1,14 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
package org.jboss.tools.cdi.bot.test.uiutils.wizards;
import org.eclipse.swtbot.swt.finder.SWTBot;
Modified: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/wizard/FacetTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/wizard/FacetTest.java 2011-11-22 13:26:39 UTC (rev 36531)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/wizard/FacetTest.java 2011-11-22 14:16:15 UTC (rev 36532)
@@ -25,7 +25,7 @@
import org.junit.runners.Suite.SuiteClasses;
/**
-* Test checks if beans.xml is created when selectin CDI Facet
+* Test checks if beans.xml is created when selecting CDI Facet
*
* @author Jaroslav Jankovic
*/
13 years, 1 month
JBoss Tools SVN: r36531 - in trunk/ws: plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/utils and 6 other directories.
by jbosstools-commits@lists.jboss.org
Author: xcoulon
Date: 2011-11-22 08:26:39 -0500 (Tue, 22 Nov 2011)
New Revision: 36531
Added:
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/jdt/JavaMethodSignaturesVisitor.java
Removed:
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/utils/CollectionFilterUtils.java
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/utils/MemberAnnotationBindingVisitor.java
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/utils/MemberAnnotationBindingsVisitor.java
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/utils/MethodBindingVisitor.java
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/jdt/JavaMethodSignatureVisitor.java
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/jdt/JavaMethodSignaturesVisitor.java
trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/AbstractBuildDelegateTestCase.java
Modified:
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsResourceMethod.java
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/jdt/Annotation.java
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/jdt/JavaAnnotationsVisitor.java
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/jdt/JdtUtils.java
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/metamodel/IJaxrsResourceMethod.java
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/contentassist/PathParamAnnotationValueCompletionProposalComputer.java
trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/WorkbenchUtils.java
trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JavaElementChangedProcessorTestCase.java
trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JaxrsElementChangedProcessorTestCase.java
trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JaxrsMetamodelFullBuildJobTestCase.java
trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/jdt/JdtUtilsTestCase.java
Log:
Moved content assist/validation into the core plugin - using the metamodel
Modified: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsResourceMethod.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsResourceMethod.java 2011-11-22 12:30:55 UTC (rev 36530)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsResourceMethod.java 2011-11-22 13:26:39 UTC (rev 36531)
@@ -334,4 +334,37 @@
return false;
}
+ @Override
+ public List<String> getPathParamValueProposals() {
+ List<String> proposals = new ArrayList<String>();
+ final Annotation methodPathAnnotation = getPathAnnotation();
+ if(methodPathAnnotation != null) {
+ final String value = methodPathAnnotation.getValue("value");
+ proposals.addAll(extractParamsFromUriTemplateFragment(value));
+ }
+ final Annotation typePathAnnotation = getParentResource().getPathAnnotation();
+ if(typePathAnnotation != null) {
+ final String value = typePathAnnotation.getValue("value");
+ proposals.addAll(extractParamsFromUriTemplateFragment(value));
+ }
+ return proposals;
+ }
+
+ /**
+ * Extracts all the character sequences inside of curly braces ('{' and '}') and returns them as a list of strings
+ * @param value the given value
+ * @return the list of character sequences, or an empty list
+ */
+ private static List<String> extractParamsFromUriTemplateFragment(String value) {
+ List<String> params = new ArrayList<String>();
+ int beginIndex = -1;
+ while ((beginIndex = value.indexOf("{", beginIndex + 1)) != -1) {
+ int semicolonIndex = value.indexOf(":", beginIndex);
+ int closingCurlyBraketIndex = value.indexOf("}", beginIndex);
+ int endIndex = semicolonIndex != -1 ? semicolonIndex : closingCurlyBraketIndex;
+ params.add(value.substring(beginIndex + 1, endIndex).trim());
+ }
+ return params;
+ }
+
}
Deleted: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/utils/CollectionFilterUtils.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/utils/CollectionFilterUtils.java 2011-11-22 12:30:55 UTC (rev 36530)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/utils/CollectionFilterUtils.java 2011-11-22 13:26:39 UTC (rev 36531)
@@ -1,5 +0,0 @@
-package org.jboss.tools.ws.jaxrs.core.internal.utils;
-
-public class CollectionFilterUtils {
-
-}
Deleted: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/utils/MemberAnnotationBindingVisitor.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/utils/MemberAnnotationBindingVisitor.java 2011-11-22 12:30:55 UTC (rev 36530)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/utils/MemberAnnotationBindingVisitor.java 2011-11-22 13:26:39 UTC (rev 36531)
@@ -1,5 +0,0 @@
-package org.jboss.tools.ws.jaxrs.core.internal.utils;
-
-public class MemberAnnotationBindingVisitor {
-
-}
Deleted: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/utils/MemberAnnotationBindingsVisitor.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/utils/MemberAnnotationBindingsVisitor.java 2011-11-22 12:30:55 UTC (rev 36530)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/utils/MemberAnnotationBindingsVisitor.java 2011-11-22 13:26:39 UTC (rev 36531)
@@ -1,5 +0,0 @@
-package org.jboss.tools.ws.jaxrs.core.internal.utils;
-
-public class MemberAnnotationBindingsVisitor {
-
-}
Deleted: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/utils/MethodBindingVisitor.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/utils/MethodBindingVisitor.java 2011-11-22 12:30:55 UTC (rev 36530)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/utils/MethodBindingVisitor.java 2011-11-22 13:26:39 UTC (rev 36531)
@@ -1,5 +0,0 @@
-package org.jboss.tools.ws.jaxrs.core.internal.utils;
-
-public class MethodBindingVisitor {
-
-}
Modified: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/jdt/Annotation.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/jdt/Annotation.java 2011-11-22 12:30:55 UTC (rev 36530)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/jdt/Annotation.java 2011-11-22 13:26:39 UTC (rev 36531)
@@ -32,45 +32,6 @@
this.region = region;
}
- /** convenient constructor: no typed region specified
- *
- * @param annotation
- * @param name
- * @param annotationElements */
- public Annotation(IAnnotation annotation, String name, Map<String, List<String>> annotationElements) {
- this.javaAnnotation = annotation;
- this.javaAnnotationName = name;
- this.javaAnnotationElements = new HashMap<String, List<String>>(annotationElements);
- this.region = null;
- }
-
- /** Convenient constructor : only one element named "value", whose value is
- * given in parameter
- *
- * @param annotation
- * @param name */
- public Annotation(IAnnotation annotation, String name) {
- this.javaAnnotation = annotation;
- this.javaAnnotationName = name;
- this.javaAnnotationElements = new HashMap<String, List<String>>();
- this.region = null;
- }
-
- /** Convenient constructor : no element provided
- *
- * @param annotation
- * @param name
- * @param singleElementValue */
- public Annotation(IAnnotation annotation, String name, String singleElementValue) {
- this.javaAnnotation = annotation;
- this.javaAnnotationName = name;
- this.javaAnnotationElements = new HashMap<String, List<String>>();
- if (singleElementValue != null) {
- this.javaAnnotationElements.put("value", Arrays.asList(singleElementValue));
- }
- this.region = null;
- }
-
public boolean update(Annotation annotation) {
assert annotation != null;
Modified: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/jdt/JavaAnnotationsVisitor.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/jdt/JavaAnnotationsVisitor.java 2011-11-22 12:30:55 UTC (rev 36530)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/jdt/JavaAnnotationsVisitor.java 2011-11-22 13:26:39 UTC (rev 36531)
@@ -28,6 +28,8 @@
import org.eclipse.jdt.core.dom.MethodDeclaration;
import org.eclipse.jdt.core.dom.TypeDeclaration;
import org.eclipse.jdt.core.dom.VariableDeclarationFragment;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.TypedRegion;
/** A visitor for a single annotation on a java member (can be a method or a
* type).
@@ -45,7 +47,7 @@
private final List<String> annotationNames = new ArrayList<String>();
/** the bindings for the matching annotation. */
- private final List<IAnnotationBinding> annotationBindings = new ArrayList<IAnnotationBinding>();
+ private final List<Annotation> annotations = new ArrayList<Annotation>();
/** Full Constructor to resolve a single annotation from its fully qualified
* name.
@@ -140,12 +142,18 @@
private void visitExtendedModifiers(final List<?> modifiers) {
for (Object modifier : modifiers) {
if (modifier instanceof org.eclipse.jdt.core.dom.Annotation) {
- IAnnotationBinding binding = ((org.eclipse.jdt.core.dom.Annotation) modifier)
+ final org.eclipse.jdt.core.dom.Annotation annotation = (org.eclipse.jdt.core.dom.Annotation) modifier;
+ IAnnotationBinding annotationBinding = ((org.eclipse.jdt.core.dom.Annotation) modifier)
.resolveAnnotationBinding();
- final String qualifiedName = binding.getAnnotationType().getQualifiedName();
- final String name = binding.getAnnotationType().getName();
+ final String qualifiedName = annotationBinding.getAnnotationType().getQualifiedName();
+ final String name = annotationBinding.getAnnotationType().getName();
if (annotationNames.contains(qualifiedName) || annotationNames.contains(name)) {
- annotationBindings.add(binding);
+ final String annotationName = annotationBinding.getAnnotationType().getQualifiedName();
+ final Map<String, List<String>> annotationElements = resolveAnnotationElements(annotationBinding);
+ final TypedRegion typedRegion = new TypedRegion(annotation.getStartPosition(),
+ annotation.getLength(), IDocument.DEFAULT_CONTENT_TYPE);
+ final IAnnotation javaAnnotation = (IAnnotation) annotationBinding.getJavaElement();
+ annotations.add(new Annotation(javaAnnotation, annotationName, annotationElements, typedRegion));
}
}
}
@@ -161,15 +169,10 @@
* in case of underlying exception */
public final Annotation getResolvedAnnotation() throws JavaModelException {
assert annotationNames.size() == 1;
- if (annotationBindings.size() == 0) {
+ if (annotations.size() == 0) {
return null;
}
- final IAnnotationBinding annotationBinding = annotationBindings.get(0);
- final IAnnotation annotation = (IAnnotation) annotationBinding.getJavaElement();
- final String annotationName = annotationBinding.getAnnotationType().getQualifiedName();
- final Map<String, List<String>> annotationElements = resolveAnnotationElements(annotationBinding);
- final Annotation resolvedJavaAnnotation = new Annotation(annotation, annotationName, annotationElements);
- return resolvedJavaAnnotation;
+ return annotations.get(0);
}
/** Returns the Annotation elements matching the annotations name given in
@@ -184,11 +187,8 @@
* in case of underlying exception */
public final Map<String, Annotation> getResolvedAnnotations() throws JavaModelException {
final Map<String, Annotation> resolvedJavaAnnotations = new HashMap<String, Annotation>();
- for (IAnnotationBinding annotationBinding : annotationBindings) {
- final IAnnotation annotation = (IAnnotation) annotationBinding.getJavaElement();
- final String annotationName = annotationBinding.getAnnotationType().getQualifiedName();
- final Map<String, List<String>> annotationElements = resolveAnnotationElements(annotationBinding);
- resolvedJavaAnnotations.put(annotationName, new Annotation(annotation, annotationName, annotationElements));
+ for (Annotation annotation: annotations) {
+ resolvedJavaAnnotations.put(annotation.getName(), annotation);
}
return resolvedJavaAnnotations;
}
Deleted: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/jdt/JavaMethodSignatureVisitor.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/jdt/JavaMethodSignatureVisitor.java 2011-11-22 12:30:55 UTC (rev 36530)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/jdt/JavaMethodSignatureVisitor.java 2011-11-22 13:26:39 UTC (rev 36531)
@@ -1,142 +0,0 @@
-package org.jboss.tools.ws.jaxrs.core.jdt;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.IMethod;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.dom.ASTVisitor;
-import org.eclipse.jdt.core.dom.Annotation;
-import org.eclipse.jdt.core.dom.IAnnotationBinding;
-import org.eclipse.jdt.core.dom.IMemberValuePairBinding;
-import org.eclipse.jdt.core.dom.IMethodBinding;
-import org.eclipse.jdt.core.dom.ITypeBinding;
-import org.eclipse.jdt.core.dom.IVariableBinding;
-import org.eclipse.jdt.core.dom.MethodDeclaration;
-import org.eclipse.jdt.core.dom.SingleVariableDeclaration;
-import org.eclipse.jface.text.TypedRegion;
-import org.jboss.tools.ws.jaxrs.core.internal.utils.Logger;
-
-public class JavaMethodSignatureVisitor extends ASTVisitor {
-
- private final ICompilationUnit compilationUnit;
-
- private final IMethod method;
-
- private JavaMethodSignature methodSignature = null;
-
- public JavaMethodSignatureVisitor(IMethod method) {
- this.compilationUnit = method.getCompilationUnit();
- this.method = method;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse
- * .jdt.core.dom.MethodDeclaration)
- */
- @Override
- public boolean visit(MethodDeclaration declaration) {
- try {
- IMethod method = (IMethod) compilationUnit.getElementAt(declaration.getStartPosition());
- if (!this.method.getHandleIdentifier().equals(method.getHandleIdentifier())) {
- return true;
- }
-
- final IMethodBinding methodBinding = declaration.resolveBinding();
- // sometimes, the binding cannot be resolved
- if (methodBinding == null) {
- Logger.warn("Could not resolve bindings form method " + method.getElementName());
- } else {
- final IType returnedType = methodBinding.getReturnType() != null ? (IType) methodBinding
- .getReturnType().getJavaElement() : null;
- final ITypeBinding[] parameterTypeBindings = methodBinding.getParameterTypes();
- List<JavaMethodParameter> methodParameters = new ArrayList<JavaMethodParameter>();
- @SuppressWarnings("unchecked")
- List<SingleVariableDeclaration> parameters = declaration.parameters();
- for (SingleVariableDeclaration parameter : parameters) {
- final String paramName = parameter.getName().getFullyQualifiedName();
- final IVariableBinding paramBinding = parameter.resolveBinding();
- final String paramTypeName = paramBinding.getType().getQualifiedName();
- final List<org.jboss.tools.ws.jaxrs.core.jdt.Annotation> paramAnnotations = new ArrayList<org.jboss.tools.ws.jaxrs.core.jdt.Annotation>();
- final List<?> modifiers = (List<?>) (parameter
- .getStructuralProperty(SingleVariableDeclaration.MODIFIERS2_PROPERTY));
- for (Object modifier : modifiers) {
- if (modifier instanceof Annotation) {
- final Annotation annotation = (Annotation) modifier;
- IAnnotationBinding annotationBinding = annotation.resolveAnnotationBinding();
- final String annotationName = annotationBinding.getAnnotationType().getQualifiedName();
- final Map<String, List<String>> annotationElements = resolveAnnotationElements(annotationBinding);
- final TypedRegion typedRegion = new TypedRegion(annotation.getStartPosition(),
- annotation.getLength(), parameter.getType().toString());
- paramAnnotations.add(new org.jboss.tools.ws.jaxrs.core.jdt.Annotation(null, annotationName,
- annotationElements, typedRegion));
- }
- }
- methodParameters.add(new JavaMethodParameter(paramName, paramTypeName, paramAnnotations));
- }
- /*
- * for (int i = 0; i < parameterTypeBindings.length; i++) {
- * final ITypeBinding parameterTypeBinding =
- * parameterTypeBindings[i];
- * final String paramTypeName =
- * parameterTypeBinding.getQualifiedName();
- * final List<Annotation> paramAnnotations = new
- * ArrayList<Annotation>();
- * final IAnnotationBinding[] parameterAnnotationBindings =
- * methodBinding.getParameterAnnotations(i);
- * for (IAnnotationBinding parameterAnnotationBinding :
- * parameterAnnotationBindings) {
- * parameterAnnotationBinding.getAnnotationType().getJavaElement(
- * );
- * final String annotationName =
- * parameterAnnotationBinding.getAnnotationType
- * ().getBinaryName();
- * final Map<String, List<String>> annotationElements =
- * resolveAnnotationElements(parameterAnnotationBinding);
- * final TypedRegion typedRegion = new
- * TypedRegion(annotation.getStartPosition(),
- * annotation.getLength(), param.getType().toString());
- *
- * paramAnnotations.add(new Annotation(null, annotationName,
- * annotationElements));
- * }
- * methodParameters.add(new JavaMethodParameter(paramName,
- * paramTypeName, paramAnnotations));
- * }
- */
- // TODO : add support for thrown exceptions
- this.methodSignature = new JavaMethodSignature(method, returnedType, methodParameters);
- }
- } catch (JavaModelException e) {
- Logger.error("Failed to analyse compilation unit methods", e);
- }
- return true;
- }
-
- private static Map<String, List<String>> resolveAnnotationElements(IAnnotationBinding annotationBinding) {
- final Map<String, List<String>> annotationElements = new HashMap<String, List<String>>();
- for (IMemberValuePairBinding binding : annotationBinding.getAllMemberValuePairs()) {
- final List<String> values = new ArrayList<String>();
- if (binding.getValue() instanceof Object[]) {
- for (Object v : (Object[]) binding.getValue()) {
- values.add(v.toString());
- }
- } else {
- values.add(binding.getValue().toString());
- }
- annotationElements.put(binding.getName(), values);
- }
- return annotationElements;
- }
-
- /** @return the methodDeclarations */
- public JavaMethodSignature getMethodSignature() {
- return methodSignature;
- }
-}
\ No newline at end of file
Deleted: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/jdt/JavaMethodSignaturesVisitor.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/jdt/JavaMethodSignaturesVisitor.java 2011-11-22 12:30:55 UTC (rev 36530)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/jdt/JavaMethodSignaturesVisitor.java 2011-11-22 13:26:39 UTC (rev 36531)
@@ -1,96 +0,0 @@
-package org.jboss.tools.ws.jaxrs.core.jdt;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.IMethod;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.dom.ASTVisitor;
-import org.eclipse.jdt.core.dom.IAnnotationBinding;
-import org.eclipse.jdt.core.dom.IMemberValuePairBinding;
-import org.eclipse.jdt.core.dom.IMethodBinding;
-import org.eclipse.jdt.core.dom.ITypeBinding;
-import org.eclipse.jdt.core.dom.MethodDeclaration;
-import org.eclipse.jdt.core.dom.SingleVariableDeclaration;
-import org.jboss.tools.ws.jaxrs.core.internal.utils.Logger;
-
-public class JavaMethodSignaturesVisitor extends ASTVisitor {
-
- private final ICompilationUnit compilationUnit;
-
- private final List<JavaMethodSignature> methodSignatures = new ArrayList<JavaMethodSignature>();
-
- public JavaMethodSignaturesVisitor(ICompilationUnit compilationUnit2) {
- this.compilationUnit = compilationUnit2;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse
- * .jdt.core.dom.MethodDeclaration)
- */
- @Override
- public boolean visit(MethodDeclaration declaration) {
- try {
- IMethod method = (IMethod) compilationUnit.getElementAt(declaration.getStartPosition());
- final IMethodBinding methodBinding = declaration.resolveBinding();
- // sometimes, the binding cannot be resolved
- if (methodBinding == null) {
- Logger.warn("Could not resolve bindings form method " + method.getElementName());
- } else {
- final IType returnedType = methodBinding.getReturnType() != null ? (IType) methodBinding
- .getReturnType().getJavaElement() : null;
- final ITypeBinding[] parameterTypeBindings = methodBinding.getParameterTypes();
- List<JavaMethodParameter> methodParameters = new ArrayList<JavaMethodParameter>();
- @SuppressWarnings("unchecked")
- List<SingleVariableDeclaration> parameters = declaration.parameters();
- for (int i = 0; i < parameterTypeBindings.length; i++) {
- final ITypeBinding parameterTypeBinding = parameterTypeBindings[i];
- final String paramTypeName = parameterTypeBinding.getQualifiedName();
- final String paramName = parameters.get(i).getName().getFullyQualifiedName();
- final List<Annotation> paramAnnotations = new ArrayList<Annotation>();
- final IAnnotationBinding[] parameterAnnotationBindings = methodBinding.getParameterAnnotations(i);
- for (IAnnotationBinding parameterAnnotationBinding : parameterAnnotationBindings) {
- final String annotationName = parameterAnnotationBinding.getAnnotationType().getBinaryName();
- // ((IType)parameterAnnotationBinding.getAnnotationType().getJavaElement()).getF
- final Map<String, List<String>> annotationElements = resolveAnnotationElements(parameterAnnotationBinding);
- // method parameters are not eligible java elements...
- paramAnnotations.add(new Annotation(null, annotationName, annotationElements));
- }
- methodParameters.add(new JavaMethodParameter(paramName, paramTypeName, paramAnnotations));
- }
- // TODO : add support for thrown exceptions
- methodSignatures.add(new JavaMethodSignature(method, returnedType, methodParameters));
- }
- } catch (JavaModelException e) {
- Logger.error("Failed to analyse compilation unit methods", e);
- }
- return true;
- }
-
- private static Map<String, List<String>> resolveAnnotationElements(IAnnotationBinding annotationBinding) {
- final Map<String, List<String>> annotationElements = new HashMap<String, List<String>>();
- for (IMemberValuePairBinding binding : annotationBinding.getAllMemberValuePairs()) {
- final List<String> values = new ArrayList<String>();
- if (binding.getValue() instanceof Object[]) {
- for (Object v : (Object[]) binding.getValue()) {
- values.add(v.toString());
- }
- } else {
- values.add(binding.getValue().toString());
- }
- annotationElements.put(binding.getName(), values);
- }
- return annotationElements;
- }
-
- /** @return the methodDeclarations */
- public List<JavaMethodSignature> getMethodSignatures() {
- return methodSignatures;
- }
-}
\ No newline at end of file
Copied: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/jdt/JavaMethodSignaturesVisitor.java (from rev 36520, trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/jdt/JavaMethodSignatureVisitor.java)
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/jdt/JavaMethodSignaturesVisitor.java (rev 0)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/jdt/JavaMethodSignaturesVisitor.java 2011-11-22 13:26:39 UTC (rev 36531)
@@ -0,0 +1,138 @@
+package org.jboss.tools.ws.jaxrs.core.jdt;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.dom.ASTVisitor;
+import org.eclipse.jdt.core.dom.Annotation;
+import org.eclipse.jdt.core.dom.IAnnotationBinding;
+import org.eclipse.jdt.core.dom.IMemberValuePairBinding;
+import org.eclipse.jdt.core.dom.IMethodBinding;
+import org.eclipse.jdt.core.dom.ITypeBinding;
+import org.eclipse.jdt.core.dom.IVariableBinding;
+import org.eclipse.jdt.core.dom.MethodDeclaration;
+import org.eclipse.jdt.core.dom.SingleVariableDeclaration;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.TypedRegion;
+import org.jboss.tools.ws.jaxrs.core.internal.utils.Logger;
+
+public class JavaMethodSignaturesVisitor extends ASTVisitor {
+
+ private final ICompilationUnit compilationUnit;
+
+ private final IMethod method;
+
+ private final List<JavaMethodSignature> methodSignatures = new ArrayList<JavaMethodSignature>();
+
+ /**
+ * Constructor to use when you need all Java Method signatures in the given
+ * compilation unit
+ *
+ * @param method
+ */
+ public JavaMethodSignaturesVisitor(ICompilationUnit compilationUnit) {
+ this.compilationUnit = compilationUnit;
+ this.method = null;
+ }
+
+ /**
+ * Constructor to use when you only need a single Java Method signature
+ *
+ * @param method
+ */
+ public JavaMethodSignaturesVisitor(IMethod method) {
+ this.compilationUnit = method.getCompilationUnit();
+ this.method = method;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse
+ * .jdt.core.dom.MethodDeclaration)
+ */
+ @Override
+ public boolean visit(MethodDeclaration declaration) {
+ try {
+ IMethod method = (IMethod) compilationUnit.getElementAt(declaration.getStartPosition());
+ if (this.method != null && !this.method.getHandleIdentifier().equals(method.getHandleIdentifier())) {
+ return true;
+ }
+
+ final IMethodBinding methodBinding = declaration.resolveBinding();
+ // sometimes, the binding cannot be resolved
+ if (methodBinding == null) {
+ Logger.warn("Could not resolve bindings form method " + method.getElementName());
+ } else {
+ final IType returnedType = methodBinding.getReturnType() != null ? (IType) methodBinding
+ .getReturnType().getJavaElement() : null;
+ List<JavaMethodParameter> methodParameters = new ArrayList<JavaMethodParameter>();
+ @SuppressWarnings("unchecked")
+ List<SingleVariableDeclaration> parameters = declaration.parameters();
+ for (SingleVariableDeclaration parameter : parameters) {
+ final String paramName = parameter.getName().getFullyQualifiedName();
+ final IVariableBinding paramBinding = parameter.resolveBinding();
+ final String paramTypeName = paramBinding.getType().getQualifiedName();
+ final List<org.jboss.tools.ws.jaxrs.core.jdt.Annotation> paramAnnotations = new ArrayList<org.jboss.tools.ws.jaxrs.core.jdt.Annotation>();
+ final List<?> modifiers = (List<?>) (parameter
+ .getStructuralProperty(SingleVariableDeclaration.MODIFIERS2_PROPERTY));
+ for (Object modifier : modifiers) {
+ if (modifier instanceof Annotation) {
+ final Annotation annotation = (Annotation) modifier;
+ IAnnotationBinding annotationBinding = annotation.resolveAnnotationBinding();
+ final String annotationName = annotationBinding.getAnnotationType().getQualifiedName();
+ final Map<String, List<String>> annotationElements = resolveAnnotationElements(annotationBinding);
+ final TypedRegion typedRegion = new TypedRegion(annotation.getStartPosition(),
+ annotation.getLength(), IDocument.DEFAULT_CONTENT_TYPE);
+ paramAnnotations.add(new org.jboss.tools.ws.jaxrs.core.jdt.Annotation(null, annotationName,
+ annotationElements, typedRegion));
+ }
+ }
+ methodParameters.add(new JavaMethodParameter(paramName, paramTypeName, paramAnnotations));
+ }
+
+ // TODO : add support for thrown exceptions
+ this.methodSignatures.add(new JavaMethodSignature(method, returnedType, methodParameters));
+ }
+ } catch (JavaModelException e) {
+ Logger.error("Failed to analyse compilation unit methods", e);
+ }
+ return true;
+ }
+
+ private static Map<String, List<String>> resolveAnnotationElements(IAnnotationBinding annotationBinding) {
+ final Map<String, List<String>> annotationElements = new HashMap<String, List<String>>();
+ for (IMemberValuePairBinding binding : annotationBinding.getAllMemberValuePairs()) {
+ final List<String> values = new ArrayList<String>();
+ if (binding.getValue() instanceof Object[]) {
+ for (Object v : (Object[]) binding.getValue()) {
+ values.add(v.toString());
+ }
+ } else {
+ values.add(binding.getValue().toString());
+ }
+ annotationElements.put(binding.getName(), values);
+ }
+ return annotationElements;
+ }
+
+ /** @return the methodDeclarations */
+ public JavaMethodSignature getMethodSignature() {
+ if (this.methodSignatures.size() == 0) {
+ return null;
+ }
+ return this.methodSignatures.get(0);
+
+ }
+
+ /** @return the methodDeclarations */
+ public List<JavaMethodSignature> getMethodSignatures() {
+ return this.methodSignatures;
+ }
+}
\ No newline at end of file
Modified: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/jdt/JdtUtils.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/jdt/JdtUtils.java 2011-11-22 12:30:55 UTC (rev 36530)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/jdt/JdtUtils.java 2011-11-22 13:26:39 UTC (rev 36531)
@@ -247,8 +247,8 @@
if (member.isBinary()) {
IAnnotatable javaElement = (IAnnotatable) member;
final IAnnotation annotation = javaElement.getAnnotation(annotationName);
- if (annotation.exists()) {
- return new Annotation(annotation, annotation.getElementName(), resolveAnnotationElements(annotation));
+ if (annotation != null && annotation.exists()) {
+ return new Annotation(annotation, annotation.getElementName(), resolveAnnotationElements(annotation), null);
}
return null;
}
@@ -291,7 +291,7 @@
final IAnnotation annotation = javaElement.getAnnotation(annotationName);
if (annotation.exists()) {
annotations.put(annotationName, new Annotation(annotation, annotation.getElementName(),
- resolveAnnotationElements(annotation)));
+ resolveAnnotationElements(annotation), null));
}
}
return annotations;
@@ -754,7 +754,7 @@
}
public static JavaMethodSignature resolveMethodSignature(IMethod method, CompilationUnit ast) {
- JavaMethodSignatureVisitor methodsVisitor = new JavaMethodSignatureVisitor(method);
+ JavaMethodSignaturesVisitor methodsVisitor = new JavaMethodSignaturesVisitor(method);
ast.accept(methodsVisitor);
return methodsVisitor.getMethodSignature();
}
Modified: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/metamodel/IJaxrsResourceMethod.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/metamodel/IJaxrsResourceMethod.java 2011-11-22 12:30:55 UTC (rev 36530)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/metamodel/IJaxrsResourceMethod.java 2011-11-22 13:26:39 UTC (rev 36531)
@@ -42,5 +42,12 @@
abstract List<String> getProducedMediaTypes();
List<JavaMethodParameter> getJavaMethodParameters();
+
+ /**
+ * Determines the proposals for the PathParam annotated method parameters of the underlying Java Method.
+ * This list is based on the @Path annotation found on the Java Method and on the parent Java Type.
+ * @return
+ */
+ List<String> getPathParamValueProposals();
}
\ No newline at end of file
Modified: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/contentassist/PathParamAnnotationValueCompletionProposalComputer.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/contentassist/PathParamAnnotationValueCompletionProposalComputer.java 2011-11-22 12:30:55 UTC (rev 36530)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/contentassist/PathParamAnnotationValueCompletionProposalComputer.java 2011-11-22 13:26:39 UTC (rev 36531)
@@ -22,8 +22,6 @@
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IMember;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.ui.text.IJavaPartitions;
import org.eclipse.jdt.ui.text.java.ContentAssistInvocationContext;
import org.eclipse.jdt.ui.text.java.IJavaCompletionProposalComputer;
@@ -46,10 +44,12 @@
import org.jboss.tools.ws.jaxrs.ui.JBossJaxrsUIPlugin;
import org.jboss.tools.ws.jaxrs.ui.internal.utils.Logger;
-/** Computes proposals for <code>java.ws.rs.PathParam</code> annotation values in
+/**
+ * Computes proposals for <code>java.ws.rs.PathParam</code> annotation values in
* the compilation unit context.
*
- * @author xcoulon */
+ * @author xcoulon
+ */
public class PathParamAnnotationValueCompletionProposalComputer implements IJavaCompletionProposalComputer {
/** Icon for completion proposals. */
@@ -101,7 +101,8 @@
return Collections.emptyList();
}
- /** Computes the valid proposals for the <code>javax.ws.rs.PathParam</code>
+ /**
+ * Computes the valid proposals for the <code>javax.ws.rs.PathParam</code>
* annotation value. The proposals are based on:
* <ul>
* <li>The values of the <code>javax.ws.rs.Path</code> annotations, both at
@@ -120,64 +121,46 @@
* @throws CoreException
* in case of underlying exception
* @throws BadLocationException
- * @throws org.eclipse.jface.text.BadLocationException */
+ * @throws org.eclipse.jface.text.BadLocationException
+ */
private List<ICompletionProposal> internalComputePathParamProposals(
final JavaContentAssistInvocationContext javaContext, final Annotation pathParamAnnotation,
final IJaxrsResourceMethod resourceMethod) throws CoreException, BadLocationException {
- ITypedRegion region = getRegion(javaContext);
+ final List<ICompletionProposal> completionProposals = new ArrayList<ICompletionProposal>();
+ final ITypedRegion region = getRegion(javaContext);
String matchValue = javaContext.getDocument().get(region.getOffset(),
javaContext.getInvocationOffset() - region.getOffset());
- // int cursorPosition = javaContext.getInvocationOffset();
- List<ICompletionProposal> completionProposals = new ArrayList<ICompletionProposal>();
- // compute proposals from @Path annotations on the method
- completionProposals.addAll(generateCompletionProposal(resourceMethod.getPathAnnotation(), region, matchValue));
- // compute proposals from @Path annotations on the type
- completionProposals.addAll(generateCompletionProposal(resourceMethod.getParentResource().getPathAnnotation(),
- region, matchValue));
- return completionProposals;
- }
+ if(matchValue.charAt(0) == '\"') {
+ matchValue = matchValue.substring(1);
+ }
+ List<String> proposals = resourceMethod.getPathParamValueProposals();
+ for (String proposal : proposals) {
+ if (proposal.startsWith(matchValue)) {
+ completionProposals.add(generateCompletionProposal(resourceMethod.getJavaElement(), region, proposal));
- private List<ICompletionProposal> generateCompletionProposal(Annotation annotation, ITypedRegion region,
- String matchValue) throws CoreException {
- final List<ICompletionProposal> completionProposals = new ArrayList<ICompletionProposal>();
- if (annotation != null) {
- final String pathAnnotationValue = annotation.getValue("value");
- if (pathAnnotationValue != null && pathAnnotationValue.contains("{") && pathAnnotationValue.contains("}")) {
- List<String> uriParams = extractParamsFromUriTemplateFragment(pathAnnotationValue);
- for (String uriParam : uriParams) {
- String replacementValue = "\"" + uriParam + "\"";
- if (replacementValue.startsWith(matchValue)) {
- String displayString = uriParam + " - JAX-RS Mapping";
- StyledString displayStyledString = new StyledString(displayString);
- displayStyledString.setStyle(uriParam.length(), displayString.length() - uriParam.length(),
- StyledString.QUALIFIER_STYLER);
- completionProposals.add(new AnnotationCompletionProposal(replacementValue, displayStyledString,
- region, icon, (IMember) annotation.getJavaParent()));
- }
- }
}
}
return completionProposals;
}
- private static List<String> extractParamsFromUriTemplateFragment(String fragment) {
- List<String> params = new ArrayList<String>();
- int beginIndex = -1;
- while ((beginIndex = fragment.indexOf("{", beginIndex + 1)) != -1) {
- int semicolonIndex = fragment.indexOf(":", beginIndex);
- int closingCurlyBraketIndex = fragment.indexOf("}", beginIndex);
- int endIndex = semicolonIndex != -1 ? semicolonIndex : closingCurlyBraketIndex;
- params.add(fragment.substring(beginIndex + 1, endIndex).trim());
- }
- return params;
+ private ICompletionProposal generateCompletionProposal(IMember member, ITypedRegion region, String proposalValue)
+ throws CoreException {
+ String replacementValue = "\"" + proposalValue + "\"";
+ String displayString = proposalValue + " - JAX-RS Mapping";
+ StyledString displayStyledString = new StyledString(displayString);
+ displayStyledString.setStyle(proposalValue.length(), displayString.length() - proposalValue.length(),
+ StyledString.QUALIFIER_STYLER);
+ return new AnnotationCompletionProposal(replacementValue, displayStyledString, region, icon, member);
}
- /** Resolves the typed region for the given java content assist invocation
+ /**
+ * Resolves the typed region for the given java content assist invocation
* context.
*
* @param javaContext
* the java content assist invocation context
- * @return the typed region */
+ * @return the typed region
+ */
private ITypedRegion getRegion(final JavaContentAssistInvocationContext javaContext) {
IDocument document = javaContext.getDocument();
IDocumentPartitioner documentPartitioner = ((IDocumentExtension3) document)
@@ -185,35 +168,6 @@
return documentPartitioner.getPartition(javaContext.getInvocationOffset());
}
- /** Returns the enclosing java type for the given java element.
- *
- * @param element
- * the element
- * @return the enclosing type, or null if the given element is neither a
- * method nor the type itself
- * @throws JavaModelException
- * in case of underlying exception */
- private IType getEnclosingType(final IJavaElement element) throws JavaModelException {
- if (element == null) {
- // no enclosing parent. For example, an annotation is set before the
- // method itself was written.
- return null;
- }
- switch (element.getElementType()) {
- case IJavaElement.TYPE:
- return (IType) element;
- case IJavaElement.METHOD:
- return (IType) element.getParent();
- case IJavaElement.FIELD:
- return null;
- default:
- break;
- }
- // Logger.error("Unexpected element type for " +
- // element.getElementName() + ": " + element.getElementType());
- return null;
- }
-
/** {@inheritDoc} */
@Override
public final List<IContextInformation> computeContextInformation(final ContentAssistInvocationContext context,
Modified: trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/WorkbenchUtils.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/WorkbenchUtils.java 2011-11-22 12:30:55 UTC (rev 36530)
+++ trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/WorkbenchUtils.java 2011-11-22 13:26:39 UTC (rev 36531)
@@ -22,8 +22,10 @@
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
+import java.util.Map;
import org.apache.commons.lang.ArrayUtils;
import org.apache.commons.lang.StringUtils;
@@ -63,6 +65,8 @@
import org.eclipse.jdt.core.compiler.IProblem;
import org.eclipse.jdt.core.dom.AST;
import org.eclipse.ui.internal.wizards.datatransfer.DataTransferMessages;
+import org.jboss.tools.ws.jaxrs.core.jdt.Annotation;
+import org.jboss.tools.ws.jaxrs.core.jdt.JdtUtils;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.osgi.framework.Bundle;
@@ -813,4 +817,25 @@
return found;
}
+ public static Annotation getAnnotation(final IMember member, final Class<?> annotationClass) throws JavaModelException {
+ if(annotationClass == null) {
+ return null;
+ }
+ return JdtUtils.resolveAnnotation(member, JdtUtils.parse(member, null), annotationClass);
+ }
+
+ public static Annotation getAnnotation(final IMember member, final Class<?> annotationClass, String... values)
+ throws JavaModelException {
+ Annotation annotation = JdtUtils.resolveAnnotation(member, JdtUtils.parse(member, null),
+ annotationClass);
+ Map<String, List<String>> elements = new HashMap<String, List<String>>();
+ elements.put("value", Arrays.asList(values));
+ annotation.update(new Annotation(annotation.getJavaAnnotation(), annotation.getName(), elements, null));
+ return annotation;
+ }
+
+ public static IType getType(String typeName, IJavaProject javaProject) throws CoreException {
+ return JdtUtils.resolveType(typeName, javaProject, null);
+ }
+
}
Deleted: trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/AbstractBuildDelegateTestCase.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/AbstractBuildDelegateTestCase.java 2011-11-22 12:30:55 UTC (rev 36530)
+++ trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/AbstractBuildDelegateTestCase.java 2011-11-22 13:26:39 UTC (rev 36531)
@@ -1,22 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Xavier Coulon - Initial API and implementation
- ******************************************************************************/
-
-package org.jboss.tools.ws.jaxrs.core.internal.metamodel.builder;
-
-import org.jboss.tools.ws.jaxrs.core.AbstractCommonTestCase;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public abstract class AbstractBuildDelegateTestCase extends AbstractCommonTestCase {
-
- protected static final Logger LOGGER = LoggerFactory.getLogger(AbstractBuildDelegateTestCase.class);
-
-}
\ No newline at end of file
Modified: trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JavaElementChangedProcessorTestCase.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JavaElementChangedProcessorTestCase.java 2011-11-22 12:30:55 UTC (rev 36530)
+++ trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JavaElementChangedProcessorTestCase.java 2011-11-22 13:26:39 UTC (rev 36531)
@@ -8,6 +8,9 @@
import static org.hamcrest.Matchers.everyItem;
import static org.hamcrest.Matchers.notNullValue;
import static org.hamcrest.Matchers.nullValue;
+import static org.jboss.tools.ws.jaxrs.core.WorkbenchUtils.getAnnotation;
+import static org.jboss.tools.ws.jaxrs.core.WorkbenchUtils.getMethod;
+import static org.jboss.tools.ws.jaxrs.core.WorkbenchUtils.getType;
import static org.jboss.tools.ws.jaxrs.core.internal.metamodel.builder.IJavaElementDeltaFlag.F_SIGNATURE;
import static org.jboss.tools.ws.jaxrs.core.internal.metamodel.builder.JaxrsElementChangedEvent.F_CONSUMED_MEDIATYPES_VALUE;
import static org.jboss.tools.ws.jaxrs.core.internal.metamodel.builder.JaxrsElementChangedEvent.F_ELEMENT_KIND;
@@ -49,6 +52,7 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jdt.core.IAnnotation;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IField;
import org.eclipse.jdt.core.IMember;
@@ -105,28 +109,20 @@
return httpMethod;
}
- private IType getType(String typeName) throws CoreException {
- return JdtUtils.resolveType(typeName, javaProject, progressMonitor);
+
+ private Annotation createAnnotation(IAnnotation annotation, String name) {
+ return createAnnotation(annotation, name, null);
}
- private IMethod getMethod(IType parentType, String methodName) throws JavaModelException {
- return WorkbenchUtils.getMethod(parentType, methodName);
+ private Annotation createAnnotation(Class<?> clazz, String value) {
+ return createAnnotation(null, clazz.getName(), value);
}
-
- private Annotation getAnnotation(final IMember member, final Class<?> annotationClass) throws JavaModelException {
- return JdtUtils.resolveAnnotation(member, JdtUtils.parse(member, progressMonitor), annotationClass);
+
+ private Annotation createAnnotation(IAnnotation annotation, String name, String value) {
+ Map<String, List<String>> values = new HashMap<String, List<String>>();
+ values.put("value", Arrays.asList(value));
+ return new Annotation(annotation, name, values, null);
}
-
- private Annotation getAnnotation(final IMember member, final Class<?> annotationClass, String... values)
- throws JavaModelException {
- Annotation annotation = JdtUtils.resolveAnnotation(member, JdtUtils.parse(member, progressMonitor),
- annotationClass);
- Map<String, List<String>> elements = new HashMap<String, List<String>>();
- elements.put("value", Arrays.asList(values));
- annotation.update(new Annotation(annotation.getJavaAnnotation(), annotation.getName(), elements));
- return annotation;
- }
-
private List<JaxrsElementChangedEvent> processEvent(JavaElementChangedEvent event, IProgressMonitor progressmonitor) {
return delegate.processEvents(Arrays.asList(event), progressmonitor);
}
@@ -411,7 +407,7 @@
@Test
public void shouldAddResourceWhenAddingSourceCompilationUnit() throws CoreException {
// pre-conditions
- IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource");
+ IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource", javaProject);
// operation
final JavaElementChangedEvent event = createEvent(type.getCompilationUnit(), ADDED);
final List<JaxrsElementChangedEvent> impacts = processEvent(event, progressMonitor);
@@ -426,7 +422,7 @@
// pre-conditions
final JaxrsHttpMethod httpMethod = createHttpMethod(GET.class);
metamodel.add(httpMethod);
- IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.BookResource");
+ IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.BookResource", javaProject);
// operation
final JavaElementChangedEvent event = createEvent(type.getCompilationUnit(), ADDED);
final List<JaxrsElementChangedEvent> impacts = processEvent(event, progressMonitor);
@@ -440,7 +436,7 @@
@Test
public void shouldAddSubresourceLocatorWhenAddingSourceCompilationUnit() throws CoreException {
// pre-conditions
- IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.ProductResourceLocator");
+ IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.ProductResourceLocator", javaProject);
// operation
final JavaElementChangedEvent event = createEvent(type.getCompilationUnit(), ADDED);
final List<JaxrsElementChangedEvent> impacts = processEvent(event, progressMonitor);
@@ -454,7 +450,7 @@
@Test
public void shouldAddResourceWhenAddingSourceType() throws CoreException {
// pre-conditions
- IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource");
+ IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource", javaProject);
// operation
final JavaElementChangedEvent event = createEvent(type, ADDED);
final List<JaxrsElementChangedEvent> impacts = processEvent(event, progressMonitor);
@@ -470,7 +466,7 @@
@Test
public void shouldAddResourceWhenAddingPathAnnotation() throws CoreException {
// pre-conditions
- final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource");
+ final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource", javaProject);
final Annotation annotation = getAnnotation(type, Path.class);
// operation
final JavaElementChangedEvent event = createEvent(annotation, ADDED);
@@ -491,7 +487,7 @@
@Test
public void shouldBecomeRootResourceWhenAddingPathAnnotation() throws CoreException {
// pre-conditions
- final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource");
+ final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource", javaProject);
final Annotation annotation = getAnnotation(type, Path.class);
final IJaxrsResource resource = new JaxrsResource.Builder(type, metamodel).build();
metamodel.add(resource);
@@ -507,7 +503,7 @@
@Test
public void shouldNotAddResourceWhenAddingAnotherAnnotation() throws CoreException {
// pre-conditions
- final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource");
+ final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource", javaProject);
final Annotation annotation = getAnnotation(type, Consumes.class);
// operation
final JavaElementChangedEvent event = createEvent(annotation, ADDED);
@@ -520,7 +516,7 @@
@Test
public void shouldUpdateResourceWhenChangingPathAnnotationValue() throws CoreException {
// pre-conditions
- final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource");
+ final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource", javaProject);
final Annotation annotation = getAnnotation(type, Path.class, "/bar");
final IJaxrsResource resource = new JaxrsResource.Builder(type, metamodel).pathTemplate(annotation).build();
metamodel.add(resource);
@@ -537,7 +533,7 @@
@Test
public void shouldUpdateResourceWhenAddingConsumesAnnotation() throws CoreException {
// pre-conditions
- final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource");
+ final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource", javaProject);
final Annotation annotation = getAnnotation(type, Consumes.class);
final Annotation pathAnnotation = getAnnotation(type, Path.class);
final JaxrsResource resource = new JaxrsResource.Builder(type, metamodel).pathTemplate(pathAnnotation).build();
@@ -554,7 +550,7 @@
@Test
public void shouldUpdateResourceWhenChangingConsumesAnnotationValue() throws CoreException {
// pre-conditions
- final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource");
+ final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource", javaProject);
final Annotation pathAnnotation = getAnnotation(type, Path.class);
final Annotation consumesAnnotation = getAnnotation(type, Consumes.class, "application/foo");
final JaxrsResource resource = new JaxrsResource.Builder(type, metamodel).pathTemplate(pathAnnotation)
@@ -572,7 +568,7 @@
@Test
public void shouldUpdateResourceWhenRemovingConsumesAnnotation() throws CoreException {
// pre-conditions
- final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource");
+ final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource", javaProject);
final Annotation pathAnnotation = getAnnotation(type, Path.class);
final Annotation consumesAnnotation = getAnnotation(type, Consumes.class);
final JaxrsResource resource = new JaxrsResource.Builder(type, metamodel).pathTemplate(pathAnnotation)
@@ -590,7 +586,7 @@
@Test
public void shouldUpdateResourceWhenAddingProducesAnnotation() throws CoreException {
// pre-conditions
- final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource");
+ final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource", javaProject);
final Annotation pathAnnotation = getAnnotation(type, Path.class);
final JaxrsResource resource = new JaxrsResource.Builder(type, metamodel).pathTemplate(pathAnnotation).build();
metamodel.add(resource);
@@ -607,7 +603,7 @@
@Test
public void shouldUpdateResourceWhenChangingProducesAnnotationValue() throws CoreException {
// pre-conditions
- final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource");
+ final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource", javaProject);
final Annotation annotation = getAnnotation(type, Produces.class, "application/foo");
final Annotation pathAnnotation = getAnnotation(type, Path.class);
final JaxrsResource resource = new JaxrsResource.Builder(type, metamodel).pathTemplate(pathAnnotation)
@@ -625,7 +621,7 @@
@Test
public void shouldUpdateResourceWhenRemovingProducesAnnotation() throws CoreException {
// pre-conditions
- final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource");
+ final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource", javaProject);
final Annotation annotation = getAnnotation(type, Produces.class);
final Annotation pathAnnotation = getAnnotation(type, Path.class);
final JaxrsResource resource = new JaxrsResource.Builder(type, metamodel).pathTemplate(pathAnnotation)
@@ -643,7 +639,7 @@
@Test
public void shouldAddResourceFieldWhenAddingPathParamAnnotationOnField() throws CoreException {
// pre-conditions
- final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.ProductResourceLocator");
+ final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.ProductResourceLocator", javaProject);
final Annotation pathAnnotation = getAnnotation(type, Path.class);
final JaxrsResource resource = new JaxrsResource.Builder(type, metamodel).pathTemplate(pathAnnotation).build();
metamodel.add(resource);
@@ -657,6 +653,7 @@
}
@Test
+ @Ignore
public void shouldAddResourceFieldWhenAddingImportPathParam() throws CoreException {
/*
* // pre-conditions final IType type =
@@ -676,7 +673,7 @@
@Test
public void shouldAddResourceFieldWhenAddingQueryParamAnnotationOnField() throws CoreException {
// pre-conditions
- final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.ProductResourceLocator");
+ final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.ProductResourceLocator", javaProject);
final Annotation pathAnnotation = getAnnotation(type, Path.class);
final JaxrsResource resource = new JaxrsResource.Builder(type, metamodel).pathTemplate(pathAnnotation).build();
metamodel.add(resource);
@@ -692,7 +689,7 @@
@Test
public void shouldAddResourceFieldWhenAddingMatrixParamAnnotationOnField() throws CoreException {
// pre-conditions
- final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.ProductResourceLocator");
+ final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.ProductResourceLocator", javaProject);
final Annotation pathAnnotation = getAnnotation(type, Path.class);
final JaxrsResource resource = new JaxrsResource.Builder(type, metamodel).pathTemplate(pathAnnotation).build();
metamodel.add(resource);
@@ -708,7 +705,7 @@
@Test
public void shouldAddResourceFieldWhenAddingFieldAnnotatedWithPathParam() throws CoreException {
// pre-conditions
- final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.ProductResourceLocator");
+ final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.ProductResourceLocator", javaProject);
final Annotation pathAnnotation = getAnnotation(type, Path.class);
final JaxrsResource resource = new JaxrsResource.Builder(type, metamodel).pathTemplate(pathAnnotation).build();
metamodel.add(resource);
@@ -724,7 +721,7 @@
@Test
public void shouldAddResourceFieldWhenAddingFieldAnnotatedWithQueryParam() throws CoreException {
// pre-conditions
- final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.ProductResourceLocator");
+ final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.ProductResourceLocator", javaProject);
final Annotation pathAnnotation = getAnnotation(type, Path.class);
final JaxrsResource resource = new JaxrsResource.Builder(type, metamodel).pathTemplate(pathAnnotation).build();
metamodel.add(resource);
@@ -740,7 +737,7 @@
@Test
public void shouldAddResourceFieldWhenAddingFieldAnnotatedWithMatrixParam() throws CoreException {
// pre-conditions
- final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.ProductResourceLocator");
+ final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.ProductResourceLocator", javaProject);
final Annotation pathAnnotation = getAnnotation(type, Path.class);
final JaxrsResource resource = new JaxrsResource.Builder(type, metamodel).pathTemplate(pathAnnotation).build();
metamodel.add(resource);
@@ -756,7 +753,7 @@
@Test
public void shouldDoNothingWhenAddingFieldWithAnyAnnotation() throws CoreException {
// pre-conditions
- final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource");
+ final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource", javaProject);
final Annotation pathAnnotation = getAnnotation(type, Path.class);
final JaxrsResource resource = new JaxrsResource.Builder(type, metamodel).pathTemplate(pathAnnotation).build();
metamodel.add(resource);
@@ -771,7 +768,7 @@
@Test
public void shouldDoNothingWhenAddingAnotherAnnotationOnField() throws CoreException {
// pre-conditions
- final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource");
+ final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource", javaProject);
final Annotation pathAnnotation = getAnnotation(type, Path.class);
final JaxrsResource resource = new JaxrsResource.Builder(type, metamodel).pathTemplate(pathAnnotation).build();
metamodel.add(resource);
@@ -786,7 +783,7 @@
@Test
public void shouldUpdateResourceFieldWhenChangingPathParamAnnotationValueOnField() throws CoreException {
// pre-conditions
- final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.ProductResourceLocator");
+ final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.ProductResourceLocator", javaProject);
final Annotation pathAnnotation = getAnnotation(type, Path.class);
final JaxrsResource resource = new JaxrsResource.Builder(type, metamodel).pathTemplate(pathAnnotation).build();
metamodel.add(resource);
@@ -805,7 +802,7 @@
@Test
public void shouldUpdateResourceFieldWhenChangingQueryParamAnnotationValueOnField() throws CoreException {
// pre-conditions
- final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.ProductResourceLocator");
+ final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.ProductResourceLocator", javaProject);
final Annotation pathAnnotation = getAnnotation(type, Path.class);
final JaxrsResource resource = new JaxrsResource.Builder(type, metamodel).pathTemplate(pathAnnotation).build();
metamodel.add(resource);
@@ -824,7 +821,7 @@
@Test
public void shouldUpdateResourceFieldWhenChangingMatrixParamAnnotationValueOnField() throws CoreException {
// pre-conditions
- final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.ProductResourceLocator");
+ final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.ProductResourceLocator", javaProject);
final Annotation pathAnnotation = getAnnotation(type, Path.class);
final JaxrsResource resource = new JaxrsResource.Builder(type, metamodel).pathTemplate(pathAnnotation).build();
metamodel.add(resource);
@@ -843,7 +840,7 @@
@Test
public void shouldDoNothingWhenChangingAnotherAnnotationValueOnField() throws CoreException {
// pre-conditions
- final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.ProductResourceLocator");
+ final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.ProductResourceLocator", javaProject);
final Annotation pathAnnotation = getAnnotation(type, Path.class);
final JaxrsResource resource = new JaxrsResource.Builder(type, metamodel).pathTemplate(pathAnnotation).build();
metamodel.add(resource);
@@ -861,7 +858,7 @@
@Test
public void shouldRemoveResourceFieldWhenRemovingPathParamAnnotatedOnField() throws CoreException {
// pre-conditions
- final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.ProductResourceLocator");
+ final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.ProductResourceLocator", javaProject);
final Annotation pathAnnotation = getAnnotation(type, Path.class);
final JaxrsResource resource = new JaxrsResource.Builder(type, metamodel).pathTemplate(pathAnnotation).build();
metamodel.add(resource);
@@ -880,7 +877,7 @@
@Test
public void shouldRemoveResourceFieldWhenRemovingQueryParamAnnotationOnField() throws CoreException {
// pre-conditions
- final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.ProductResourceLocator");
+ final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.ProductResourceLocator", javaProject);
final Annotation pathAnnotation = getAnnotation(type, Path.class);
final JaxrsResource resource = new JaxrsResource.Builder(type, metamodel).pathTemplate(pathAnnotation).build();
metamodel.add(resource);
@@ -899,7 +896,7 @@
@Test
public void shouldRemoveResourceFieldWhenRemovingMatrixParamAnnotationOnField() throws CoreException {
// pre-conditions
- final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.ProductResourceLocator");
+ final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.ProductResourceLocator", javaProject);
final Annotation pathAnnotation = getAnnotation(type, Path.class);
final JaxrsResource resource = new JaxrsResource.Builder(type, metamodel).pathTemplate(pathAnnotation).build();
metamodel.add(resource);
@@ -918,7 +915,7 @@
@Test
public void shouldRemoveResourceFieldWhenRemovingFieldAnnotatedWithQueryParam() throws CoreException {
// pre-conditions
- final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.ProductResourceLocator");
+ final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.ProductResourceLocator", javaProject);
final Annotation pathAnnotation = getAnnotation(type, Path.class);
final JaxrsResource resource = new JaxrsResource.Builder(type, metamodel).pathTemplate(pathAnnotation).build();
metamodel.add(resource);
@@ -937,7 +934,7 @@
@Test
public void shouldRemoveResourceFieldWhenRemovingFieldAnnotatedWithPathParam() throws CoreException {
// pre-conditions
- final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.ProductResourceLocator");
+ final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.ProductResourceLocator", javaProject);
final Annotation pathAnnotation = getAnnotation(type, Path.class);
final JaxrsResource resource = new JaxrsResource.Builder(type, metamodel).pathTemplate(pathAnnotation).build();
metamodel.add(resource);
@@ -957,7 +954,7 @@
@Test
public void shouldRemoveResourceFieldWhenRemovingFieldAnnotatedWithMatrixParam() throws CoreException {
// pre-conditions
- final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.ProductResourceLocator");
+ final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.ProductResourceLocator", javaProject);
final Annotation pathAnnotation = getAnnotation(type, Path.class);
final JaxrsResource resource = new JaxrsResource.Builder(type, metamodel).pathTemplate(pathAnnotation).build();
metamodel.add(resource);
@@ -976,7 +973,7 @@
@Test
public void shouldDoNothingWhenRemovingAnotherAnnotationOnField() throws CoreException {
// pre-conditions
- final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource");
+ final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource", javaProject);
final Annotation pathAnnotation = getAnnotation(type, Path.class);
final JaxrsResource resource = new JaxrsResource.Builder(type, metamodel).pathTemplate(pathAnnotation).build();
metamodel.add(resource);
@@ -991,7 +988,7 @@
@Test
public void shouldDoNothingWhenAnnotationValueRemainsSameOnResource() throws CoreException {
// pre-conditions
- final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource");
+ final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource", javaProject);
final Annotation annotation = JdtUtils.resolveAnnotation(type, JdtUtils.parse(type, progressMonitor),
Path.class);
final JaxrsResource resource = new JaxrsResource.Builder(type, metamodel).pathTemplate(annotation).build();
@@ -1006,7 +1003,7 @@
@Test
public void shouldDoNothingResourceWhenChangingAnotherAnnotationValue() throws CoreException {
// pre-conditions
- final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource");
+ final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource", javaProject);
final Annotation pathAnnotation = getAnnotation(type, Path.class);
final JaxrsResource resource = new JaxrsResource.Builder(type, metamodel).pathTemplate(pathAnnotation).build();
metamodel.add(resource);
@@ -1021,7 +1018,7 @@
@Test
public void shouldRemoveResourceWhenRemovingCompilationUnit() throws CoreException {
// pre-conditions
- final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource");
+ final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource", javaProject);
final IJaxrsResource resource = new JaxrsResource.Builder(type, metamodel).build();
metamodel.add(resource);
// operation
@@ -1037,7 +1034,7 @@
@Test
public void shouldRemoveResourceWhenRemovingSourceType() throws CoreException {
// pre-conditions
- final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource");
+ final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource", javaProject);
final IJaxrsResource resource = new JaxrsResource.Builder(type, metamodel).build();
metamodel.add(resource);
// operation
@@ -1053,7 +1050,7 @@
@Test
public void shouldRemoveResourceWhenRemovingAnnotation() throws CoreException {
// pre-conditions
- final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource");
+ final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource", javaProject);
final Annotation annotation = getAnnotation(type, Path.class);
final IJaxrsResource resource = new JaxrsResource.Builder(type, metamodel).pathTemplate(annotation).build();
metamodel.add(resource);
@@ -1076,7 +1073,7 @@
final JaxrsHttpMethod httpMethod = createHttpMethod(POST.class);
metamodel.add(httpMethod);
// Parent JAX-RS Resource
- final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource");
+ final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource", javaProject);
final Annotation pathAnnotation = getAnnotation(type, Path.class);
final JaxrsResource resource = new JaxrsResource.Builder(type, metamodel).pathTemplate(pathAnnotation).build();
metamodel.add(resource);
@@ -1101,7 +1098,7 @@
final JaxrsHttpMethod httpMethod = createHttpMethod(POST.class);
metamodel.add(httpMethod);
// JAX-RS Resource
- final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource");
+ final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource", javaProject);
final Annotation pathAnnotation = getAnnotation(type, Path.class);
final JaxrsResource resource = new JaxrsResource.Builder(type, metamodel).pathTemplate(pathAnnotation).build();
metamodel.add(resource);
@@ -1123,7 +1120,7 @@
@Test
public void shouldDoNothingWhenRemovingAnotherAnnotationOnResource() throws CoreException {
// pre-conditions
- final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource");
+ final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource", javaProject);
final IJaxrsResource resource = new JaxrsResource.Builder(type, metamodel).build();
metamodel.add(resource);
// in case it would be removed
@@ -1141,7 +1138,7 @@
// pre-conditions
final IPackageFragmentRoot sourceFolder = WorkbenchUtils.getPackageFragmentRoot(javaProject, "src/main/java",
progressMonitor);
- final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource");
+ final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource", javaProject);
final Annotation annotation = getAnnotation(type, Consumes.class);
final IJaxrsResource resource = new JaxrsResource.Builder(type, metamodel).pathTemplate(annotation).build();
metamodel.add(resource);
@@ -1165,7 +1162,7 @@
// JAX-RS HttpMethod
metamodel.add(createHttpMethod(POST.class));
// Parent JAX-RS Resource
- final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource");
+ final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource", javaProject);
final Annotation pathAnnotation = getAnnotation(type, Path.class);
final JaxrsResource resource = new JaxrsResource.Builder(type, metamodel).pathTemplate(pathAnnotation).build();
metamodel.add(resource);
@@ -1185,7 +1182,7 @@
// JAX-RS HttpMethod
metamodel.add(createHttpMethod(POST.class));
// Parent JAX-RS Resource
- final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource");
+ final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource", javaProject);
final Annotation pathAnnotation = getAnnotation(type, Path.class);
final JaxrsResource resource = new JaxrsResource.Builder(type, metamodel).pathTemplate(pathAnnotation).build();
metamodel.add(resource);
@@ -1202,7 +1199,7 @@
public void shouldAddSubresourceLocatorWhenAddingPathAnnotation() throws CoreException {
// pre-conditions
// Parent JAX-RS Resource
- final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.ProductResourceLocator");
+ final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.ProductResourceLocator", javaProject);
final Annotation pathAnnotation = getAnnotation(type, Path.class);
final JaxrsResource resource = new JaxrsResource.Builder(type, metamodel).pathTemplate(pathAnnotation).build();
metamodel.add(resource);
@@ -1223,7 +1220,7 @@
final JaxrsHttpMethod httpMethod = createHttpMethod(POST.class);
metamodel.add(httpMethod);
// Parent JAX-RS Resource
- final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource");
+ final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource", javaProject);
final Annotation pathAnnotation = getAnnotation(type, Path.class);
final JaxrsResource resource = new JaxrsResource.Builder(type, metamodel).pathTemplate(pathAnnotation).build();
metamodel.add(resource);
@@ -1247,7 +1244,7 @@
final JaxrsHttpMethod httpMethod = createHttpMethod(GET.class);
metamodel.add(httpMethod);
// Parent JAX-RS Resource
- final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource");
+ final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource", javaProject);
final JaxrsResource resource = new JaxrsResource.Builder(type, metamodel).pathTemplate(
getAnnotation(type, Path.class)).build();
metamodel.add(resource);
@@ -1274,7 +1271,7 @@
final JaxrsHttpMethod httpMethod = createHttpMethod(GET.class);
metamodel.add(httpMethod);
// Parent JAX-RS Resource
- final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource");
+ final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource", javaProject);
final JaxrsResource resource = new JaxrsResource.Builder(type, metamodel).pathTemplate(
getAnnotation(type, Path.class)).build();
metamodel.add(resource);
@@ -1301,7 +1298,7 @@
final JaxrsHttpMethod httpMethod = createHttpMethod(GET.class);
metamodel.add(httpMethod);
// Parent JAX-RS Resource
- final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource");
+ final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource", javaProject);
final JaxrsResource resource = new JaxrsResource.Builder(type, metamodel).pathTemplate(
getAnnotation(type, Path.class)).build();
metamodel.add(resource);
@@ -1325,7 +1322,7 @@
public void shouldRemoveSubresourceLocatorWhenRemovingPathAnnotation() throws CoreException {
// pre-conditions
// Parent JAX-RS Resource
- final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.ProductResourceLocator");
+ final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.ProductResourceLocator", javaProject);
final JaxrsResource resource = new JaxrsResource.Builder(type, metamodel).pathTemplate(
getAnnotation(type, Path.class)).build();
metamodel.add(resource);
@@ -1350,7 +1347,7 @@
final JaxrsHttpMethod httpMethod = createHttpMethod(GET.class);
metamodel.add(httpMethod);
// Parent JAX-RS Resource
- final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource");
+ final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource", javaProject);
final JaxrsResource resource = new JaxrsResource.Builder(type, metamodel).pathTemplate(
getAnnotation(type, Path.class)).build();
metamodel.add(resource);
@@ -1377,7 +1374,7 @@
final JaxrsHttpMethod httpMethod = createHttpMethod(POST.class);
metamodel.add(httpMethod);
// Parent JAX-RS Resource
- final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource");
+ final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource", javaProject);
final Annotation pathAnnotation = getAnnotation(type, Path.class);
final JaxrsResource resource = new JaxrsResource.Builder(type, metamodel).pathTemplate(pathAnnotation).build();
metamodel.add(resource);
@@ -1404,7 +1401,7 @@
final JaxrsHttpMethod httpMethod = createHttpMethod(POST.class);
metamodel.add(httpMethod);
// Parent JAX-RS Resource
- final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource");
+ final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource", javaProject);
final Annotation pathAnnotation = getAnnotation(type, Path.class);
final JaxrsResource resource = new JaxrsResource.Builder(type, metamodel).pathTemplate(pathAnnotation).build();
metamodel.add(resource);
@@ -1431,7 +1428,7 @@
final JaxrsHttpMethod httpMethod = createHttpMethod(POST.class);
metamodel.add(httpMethod);
// Parent JAX-RS Resource
- final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource");
+ final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource", javaProject);
final Annotation pathAnnotation = getAnnotation(type, Path.class);
final JaxrsResource resource = new JaxrsResource.Builder(type, metamodel).pathTemplate(pathAnnotation).build();
metamodel.add(resource);
@@ -1458,7 +1455,7 @@
final JaxrsHttpMethod httpMethod = createHttpMethod(POST.class);
metamodel.add(httpMethod);
// Parent JAX-RS Resource
- final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource");
+ final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource", javaProject);
final Annotation pathAnnotation = getAnnotation(type, Path.class);
final JaxrsResource resource = new JaxrsResource.Builder(type, metamodel).pathTemplate(pathAnnotation).build();
metamodel.add(resource);
@@ -1485,7 +1482,7 @@
final JaxrsHttpMethod httpMethod = createHttpMethod(POST.class);
metamodel.add(httpMethod);
// Parent JAX-RS Resource
- final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource");
+ final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource", javaProject);
final Annotation pathAnnotation = getAnnotation(type, Path.class);
final JaxrsResource resource = new JaxrsResource.Builder(type, metamodel).pathTemplate(pathAnnotation).build();
metamodel.add(resource);
@@ -1512,7 +1509,7 @@
final JaxrsHttpMethod httpMethod = createHttpMethod(GET.class);
metamodel.add(httpMethod);
// Parent JAX-RS Resource
- final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource");
+ final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource", javaProject);
final Annotation pathAnnotation = getAnnotation(type, Path.class);
final JaxrsResource resource = new JaxrsResource.Builder(type, metamodel).pathTemplate(pathAnnotation).build();
metamodel.add(resource);
@@ -1542,7 +1539,7 @@
// the method signature is changed
// pre-conditions
// Parent JAX-RS Resource
- final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource");
+ final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource", javaProject);
final Annotation pathAnnotation = getAnnotation(type, Path.class);
final JaxrsResource resource = new JaxrsResource.Builder(type, metamodel).pathTemplate(pathAnnotation).build();
metamodel.add(resource);
@@ -1550,9 +1547,9 @@
final IMethod method = getMethod(type, "getCustomer");
final JavaMethodParameter pathParameter = new JavaMethodParameter("id", Integer.class.getName(), null);
final JavaMethodParameter contextParameter = new JavaMethodParameter("uriInfo", UriInfo.class.getName(),
- Arrays.asList(new Annotation(null, Context.class.getName())));
+ Arrays.asList(createAnnotation(Context.class, null)));
final IJaxrsResourceMethod resourceMethod = new JaxrsResourceMethod.Builder(method, resource, metamodel)
- .httpMethod(getAnnotation(method, GET.class)).returnType(getType(Response.class.getName()))
+ .httpMethod(getAnnotation(method, GET.class)).returnType(getType(Response.class.getName(), javaProject))
.methodParameter(pathParameter).methodParameter(contextParameter).build();
metamodel.add(resourceMethod);
// operation
@@ -1570,18 +1567,18 @@
// the method signature is changed
// pre-conditions
// Parent JAX-RS Resource
- final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource");
+ final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource", javaProject);
final Annotation pathAnnotation = getAnnotation(type, Path.class);
final JaxrsResource resource = new JaxrsResource.Builder(type, metamodel).pathTemplate(pathAnnotation).build();
metamodel.add(resource);
// JAX-RS Resource Method
final IMethod method = getMethod(type, "getCustomer");
final JavaMethodParameter pathParameter = new JavaMethodParameter("id", Integer.class.getName(),
- Arrays.asList(new Annotation(null, PathParam.class.getName(), "foo!")));
+ Arrays.asList(createAnnotation(PathParam.class, "foo!")));
final JavaMethodParameter contextParameter = new JavaMethodParameter("uriInfo", UriInfo.class.getName(),
- Arrays.asList(new Annotation(null, Context.class.getName())));
+ Arrays.asList(createAnnotation(Context.class, null)));
final IJaxrsResourceMethod resourceMethod = new JaxrsResourceMethod.Builder(method, resource, metamodel)
- .httpMethod(getAnnotation(method, GET.class)).returnType(getType(Response.class.getName()))
+ .httpMethod(getAnnotation(method, GET.class)).returnType(getType(Response.class.getName(), javaProject))
.methodParameter(pathParameter).methodParameter(contextParameter).build();
metamodel.add(resourceMethod);
// operation
@@ -1598,19 +1595,19 @@
// the method signature is changed
// pre-conditions
// Parent JAX-RS Resource
- final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource");
+ final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource", javaProject);
final Annotation pathAnnotation = getAnnotation(type, Path.class);
final JaxrsResource resource = new JaxrsResource.Builder(type, metamodel).pathTemplate(pathAnnotation).build();
metamodel.add(resource);
// JAX-RS Resource Method
final IMethod method = getMethod(type, "updateCustomer");
final JavaMethodParameter pathParameter = new JavaMethodParameter("id", Integer.class.getName(),
- Arrays.asList(new Annotation(null, PathParam.class.getName(), "id")));
+ Arrays.asList(createAnnotation(PathParam.class, "id")));
final JavaMethodParameter customerParameter = new JavaMethodParameter("update",
- "org.jboss.tools.ws.jaxrs.sample.services.CustomerResource", Arrays.asList(new Annotation(null,
- PathParam.class.getName(), "foo")));
+ "org.jboss.tools.ws.jaxrs.sample.services.CustomerResource", Arrays.asList(createAnnotation(
+ PathParam.class, "foo")));
final IJaxrsResourceMethod resourceMethod = new JaxrsResourceMethod.Builder(method, resource, metamodel)
- .httpMethod(getAnnotation(method, PUT.class)).returnType(getType("void"))
+ .httpMethod(getAnnotation(method, PUT.class)).returnType(getType("void", javaProject))
.methodParameter(pathParameter).methodParameter(customerParameter).build();
metamodel.add(resourceMethod);
// operation
@@ -1627,18 +1624,18 @@
// the method signature is changed
// pre-conditions
// Parent JAX-RS Resource
- final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource");
+ final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource", javaProject);
final Annotation pathAnnotation = getAnnotation(type, Path.class);
final JaxrsResource resource = new JaxrsResource.Builder(type, metamodel).pathTemplate(pathAnnotation).build();
metamodel.add(resource);
// JAX-RS Resource Method (size param is not declared)
final IMethod method = getMethod(type, "getCustomers");
final JavaMethodParameter startParameter = new JavaMethodParameter("start", "int",
- Arrays.asList(new Annotation(null, QueryParam.class.getName(), "start")));
+ Arrays.asList(createAnnotation(QueryParam.class, "start")));
final JavaMethodParameter uriInfoParameter = new JavaMethodParameter("uriInfo", UriInfo.class.getName(),
- Arrays.asList(new Annotation(null, Context.class.getName())));
+ Arrays.asList(createAnnotation(Context.class, null)));
final IJaxrsResourceMethod jaxrsMethod = new JaxrsResourceMethod.Builder(method, resource, metamodel)
- .httpMethod(getAnnotation(method, GET.class)).returnType(getType("java.util.List"))
+ .httpMethod(getAnnotation(method, GET.class)).returnType(getType("java.util.List", javaProject))
.methodParameter(startParameter).methodParameter(uriInfoParameter).build();
metamodel.add(jaxrsMethod);
// operation
@@ -1655,20 +1652,20 @@
// the method signature is changed
// pre-conditions
// Parent JAX-RS Resource
- final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource");
+ final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource", javaProject);
final Annotation pathAnnotation = getAnnotation(type, Path.class);
final JaxrsResource resource = new JaxrsResource.Builder(type, metamodel).pathTemplate(pathAnnotation).build();
metamodel.add(resource);
// JAX-RS Resource Method (@QueryParam on 'size' param is not declared)
final IMethod method = getMethod(type, "getCustomers");
final JavaMethodParameter startParameter = new JavaMethodParameter("start", "int",
- Arrays.asList(new Annotation(null, QueryParam.class.getName(), "start")));
- final JavaMethodParameter sizeParameter = new JavaMethodParameter("size", "int", Arrays.asList(new Annotation(
- null, DefaultValue.class.getName(), "2")));
+ Arrays.asList(createAnnotation(QueryParam.class, "start")));
+ final JavaMethodParameter sizeParameter = new JavaMethodParameter("size", "int", Arrays.asList(createAnnotation(
+ DefaultValue.class, "2")));
final JavaMethodParameter uriInfoParameter = new JavaMethodParameter("uriInfo", UriInfo.class.getName(),
- Arrays.asList(new Annotation(null, Context.class.getName())));
+ Arrays.asList(createAnnotation(Context.class, null)));
final IJaxrsResourceMethod jaxrsMethod = new JaxrsResourceMethod.Builder(method, resource, metamodel)
- .httpMethod(getAnnotation(method, GET.class)).returnType(getType("java.util.List"))
+ .httpMethod(getAnnotation(method, GET.class)).returnType(getType("java.util.List", javaProject))
.methodParameter(startParameter).methodParameter(sizeParameter).methodParameter(uriInfoParameter)
.build();
metamodel.add(jaxrsMethod);
@@ -1686,7 +1683,7 @@
// the method signature is changed
// pre-conditions
// Parent JAX-RS Resource
- final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource");
+ final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource", javaProject);
final Annotation pathAnnotation = getAnnotation(type, Path.class);
final JaxrsResource resource = new JaxrsResource.Builder(type, metamodel).pathTemplate(pathAnnotation).build();
metamodel.add(resource);
@@ -1694,13 +1691,13 @@
// "size" on second param)
final IMethod method = getMethod(type, "getCustomers");
final JavaMethodParameter startParameter = new JavaMethodParameter("start", "int",
- Arrays.asList(new Annotation(null, QueryParam.class.getName(), "start")));
- final JavaMethodParameter sizeParameter = new JavaMethodParameter("size", "int", Arrays.asList(new Annotation(
- null, QueryParam.class.getName(), "length"), new Annotation(null, DefaultValue.class.getName(), "2")));
+ Arrays.asList(createAnnotation(QueryParam.class, "start")));
+ final JavaMethodParameter sizeParameter = new JavaMethodParameter("size", "int", Arrays.asList(createAnnotation(
+ QueryParam.class, "length"), createAnnotation(DefaultValue.class, "2")));
final JavaMethodParameter uriInfoParameter = new JavaMethodParameter("uriInfo", UriInfo.class.getName(),
- Arrays.asList(new Annotation(null, Context.class.getName())));
+ Arrays.asList(createAnnotation(Context.class, null)));
final IJaxrsResourceMethod jaxrsMethod = new JaxrsResourceMethod.Builder(method, resource, metamodel)
- .httpMethod(getAnnotation(method, GET.class)).returnType(getType("java.util.List"))
+ .httpMethod(getAnnotation(method, GET.class)).returnType(getType("java.util.List", javaProject))
.methodParameter(startParameter).methodParameter(sizeParameter).methodParameter(uriInfoParameter)
.build();
metamodel.add(jaxrsMethod);
@@ -1718,21 +1715,21 @@
// the method signature is changed
// pre-conditions
// Parent JAX-RS Resource
- final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource");
+ final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource", javaProject);
final Annotation pathAnnotation = getAnnotation(type, Path.class);
final JaxrsResource resource = new JaxrsResource.Builder(type, metamodel).pathTemplate(pathAnnotation).build();
metamodel.add(resource);
// JAX-RS Resource Method (an extra annotation on 'start' param)
final IMethod method = getMethod(type, "getCustomers");
final JavaMethodParameter startParameter = new JavaMethodParameter("start", "int", Arrays.asList(
- new Annotation(null, QueryParam.class.getName(), "start"),
- new Annotation(null, DefaultValue.class.getName(), "0")));
- final JavaMethodParameter sizeParameter = new JavaMethodParameter("size", "int", Arrays.asList(new Annotation(
- null, QueryParam.class.getName(), "size"), new Annotation(null, DefaultValue.class.getName(), "2")));
+ createAnnotation(QueryParam.class, "start"),
+ createAnnotation(DefaultValue.class, "0")));
+ final JavaMethodParameter sizeParameter = new JavaMethodParameter("size", "int", Arrays.asList(createAnnotation(
+ QueryParam.class, "size"), createAnnotation(DefaultValue.class, "2")));
final JavaMethodParameter uriInfoParameter = new JavaMethodParameter("uriInfo", UriInfo.class.getName(),
- Arrays.asList(new Annotation(null, Context.class.getName())));
+ Arrays.asList(createAnnotation(Context.class, null)));
final IJaxrsResourceMethod jaxrsMethod = new JaxrsResourceMethod.Builder(method, resource, metamodel)
- .httpMethod(getAnnotation(method, GET.class)).returnType(getType("java.util.List"))
+ .httpMethod(getAnnotation(method, GET.class)).returnType(getType("java.util.List", javaProject))
.methodParameter(startParameter).methodParameter(sizeParameter).methodParameter(uriInfoParameter)
.build();
metamodel.add(jaxrsMethod);
@@ -1768,7 +1765,7 @@
// the method signature is changed
// pre-conditions
// Parent JAX-RS Resource
- final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource");
+ final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource", javaProject);
final Annotation pathAnnotation = getAnnotation(type, Path.class);
final JaxrsResource resource = new JaxrsResource.Builder(type, metamodel).pathTemplate(pathAnnotation).build();
metamodel.add(resource);
@@ -1776,13 +1773,13 @@
// 'javax.ws.rs.Response')
final IMethod method = getMethod(type, "getCustomers");
final JavaMethodParameter startParameter = new JavaMethodParameter("start", "int",
- Arrays.asList(new Annotation(null, QueryParam.class.getName(), "start")));
- final JavaMethodParameter sizeParameter = new JavaMethodParameter("size", "int", Arrays.asList(new Annotation(
- null, QueryParam.class.getName(), "size"), new Annotation(null, DefaultValue.class.getName(), "2")));
+ Arrays.asList(createAnnotation(QueryParam.class, "start")));
+ final JavaMethodParameter sizeParameter = new JavaMethodParameter("size", "int", Arrays.asList(createAnnotation(
+ QueryParam.class, "size"), createAnnotation(DefaultValue.class, "2")));
final JavaMethodParameter uriInfoParameter = new JavaMethodParameter("uriInfo", UriInfo.class.getName(),
- Arrays.asList(new Annotation(null, Context.class.getName())));
+ Arrays.asList(createAnnotation(Context.class, null)));
final IJaxrsResourceMethod jaxrsMethod = new JaxrsResourceMethod.Builder(method, resource, metamodel)
- .httpMethod(getAnnotation(method, GET.class)).returnType(getType(Response.class.getName()))
+ .httpMethod(getAnnotation(method, GET.class)).returnType(getType(Response.class.getName(), javaProject))
.methodParameter(startParameter).methodParameter(sizeParameter).methodParameter(uriInfoParameter)
.build();
metamodel.add(jaxrsMethod);
@@ -1792,7 +1789,8 @@
// verifications
assertThat(impacts.size(), equalTo(1));
assertThat(impacts.get(0).getDeltaKind(), equalTo(CHANGED));
- assertThat(impacts.get(0).getFlags(), equalTo(F_METHOD_RETURN_TYPE));
+ // annotations were not provided but are retrieved...
+ assertThat(impacts.get(0).getFlags(), equalTo(F_METHOD_RETURN_TYPE + F_METHOD_PARAMETERS));
}
@Test
@@ -1806,16 +1804,16 @@
// the method signature is changed
// pre-conditions
// Parent JAX-RS Resource
- final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource");
+ final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource", javaProject);
final Annotation pathAnnotation = getAnnotation(type, Path.class);
final JaxrsResource resource = new JaxrsResource.Builder(type, metamodel).pathTemplate(pathAnnotation).build();
metamodel.add(resource);
// JAX-RS Resource Method (@Context is not declared on 'uriInfo' param)
final IMethod method = getMethod(type, "getCustomers");
final JavaMethodParameter startParameter = new JavaMethodParameter("start", "int",
- Arrays.asList(new Annotation(null, QueryParam.class.getName(), "start")));
- final JavaMethodParameter sizeParameter = new JavaMethodParameter("size", "int", Arrays.asList(new Annotation(
- null, QueryParam.class.getName(), "length"), new Annotation(null, DefaultValue.class.getName(), "2")));
+ Arrays.asList(createAnnotation(QueryParam.class, "start")));
+ final JavaMethodParameter sizeParameter = new JavaMethodParameter("size", "int", Arrays.asList(createAnnotation(
+ QueryParam.class, "length"), createAnnotation(DefaultValue.class, "2")));
final JavaMethodParameter uriInfoParameter = new JavaMethodParameter("uriInfo", UriInfo.class.getName(), null);
final IJaxrsResourceMethod jaxrsMethod = new JaxrsResourceMethod.Builder(method, resource, metamodel)
.methodParameter(startParameter).methodParameter(sizeParameter).methodParameter(uriInfoParameter)
@@ -1843,7 +1841,7 @@
@Test
public void shouldDoNothingWhenAddingBasicJavaMethod() throws CoreException {
// pre-conditions
- final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource");
+ final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource", javaProject);
final Annotation pathAnnotation = getAnnotation(type, Path.class);
final JaxrsResource resource = new JaxrsResource.Builder(type, metamodel).pathTemplate(pathAnnotation).build();
metamodel.add(resource);
@@ -1859,7 +1857,7 @@
@Test
public void shouldDoNothingWhenChangingBasicJavaMethod() throws CoreException {
// pre-conditions
- final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource");
+ final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource", javaProject);
final Annotation pathAnnotation = getAnnotation(type, Path.class);
final JaxrsResource resource = new JaxrsResource.Builder(type, metamodel).pathTemplate(pathAnnotation).build();
metamodel.add(resource);
@@ -1875,7 +1873,7 @@
@Test
public void shouldDoNothingWhenRemovingBasicJavaMethod() throws CoreException {
// pre-conditions
- final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource");
+ final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource", javaProject);
final Annotation pathAnnotation = getAnnotation(type, Path.class);
final JaxrsResource resource = new JaxrsResource.Builder(type, metamodel).pathTemplate(pathAnnotation).build();
metamodel.add(resource);
Modified: trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JaxrsElementChangedProcessorTestCase.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JaxrsElementChangedProcessorTestCase.java 2011-11-22 12:30:55 UTC (rev 36530)
+++ trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JaxrsElementChangedProcessorTestCase.java 2011-11-22 13:26:39 UTC (rev 36531)
@@ -54,6 +54,8 @@
import org.junit.Ignore;
import org.junit.Test;
+import static org.jboss.tools.ws.jaxrs.core.WorkbenchUtils.*;
+
public class JaxrsElementChangedProcessorTestCase extends AbstractCommonTestCase {
private JaxrsMetamodel metamodel;
@@ -68,7 +70,7 @@
}
private JaxrsResource createResource(String typeName) throws CoreException, JavaModelException {
- final IType resourceType = getType(typeName);
+ final IType resourceType = getType(typeName, javaProject);
final JaxrsResource customerResource = new JaxrsResource.Builder(resourceType, metamodel).pathTemplate(
getAnnotation(resourceType, Path.class)).build();
metamodel.add(customerResource);
@@ -95,7 +97,7 @@
}
private JaxrsHttpMethod createHttpMethod(Class<?> annotationClass) throws JavaModelException, CoreException {
- final IType type = getType(annotationClass.getName());
+ final IType type = getType(annotationClass.getName(), javaProject);
final Annotation httpAnnotation = getAnnotation(type, HttpMethod.class);
final JaxrsHttpMethod httpMethod = new JaxrsHttpMethod(type, httpAnnotation, metamodel);
metamodel.add(httpMethod);
@@ -109,31 +111,7 @@
return endpoint;
}
- private IType getType(String typeName) throws CoreException {
- return JdtUtils.resolveType(typeName, javaProject, progressMonitor);
- }
-
- private IMethod getMethod(IType parentType, String methodName) throws JavaModelException {
- return WorkbenchUtils.getMethod(parentType, methodName);
- }
-
- private Annotation getAnnotation(final IMember member, final Class<?> annotationClass) throws JavaModelException {
- if (annotationClass == null) {
- return null;
- }
- return JdtUtils.resolveAnnotation(member, JdtUtils.parse(member, progressMonitor), annotationClass);
- }
-
- private Annotation getAnnotation(final IMember member, final Class<?> annotationClass, String... values)
- throws JavaModelException {
- Annotation annotation = JdtUtils.resolveAnnotation(member, JdtUtils.parse(member, progressMonitor),
- annotationClass);
- Map<String, List<String>> elements = new HashMap<String, List<String>>();
- elements.put("value", Arrays.asList(values));
- annotation.update(new Annotation(annotation.getJavaAnnotation(), annotation.getName(), elements));
- return annotation;
- }
-
+
@Test
public void shouldConstructSimpleEndpoint() throws JavaModelException, CoreException {
// pre-conditions
Modified: trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JaxrsMetamodelFullBuildJobTestCase.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JaxrsMetamodelFullBuildJobTestCase.java 2011-11-22 12:30:55 UTC (rev 36530)
+++ trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JaxrsMetamodelFullBuildJobTestCase.java 2011-11-22 13:26:39 UTC (rev 36531)
@@ -11,8 +11,15 @@
package org.jboss.tools.ws.jaxrs.core.internal.metamodel.builder;
+import static org.hamcrest.Matchers.containsInAnyOrder;
+import static org.hamcrest.Matchers.empty;
+import static org.hamcrest.Matchers.emptyIterable;
+import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.greaterThan;
+import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.notNullValue;
+import static org.jboss.tools.ws.jaxrs.core.WorkbenchUtils.getMethod;
+import static org.jboss.tools.ws.jaxrs.core.WorkbenchUtils.getType;
import static org.junit.Assert.assertThat;
import java.util.HashSet;
@@ -20,12 +27,13 @@
import java.util.Set;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IType;
import org.jboss.tools.ws.jaxrs.core.builder.AbstractMetamodelBuilderTestCase;
-import org.jboss.tools.ws.jaxrs.core.jdt.JdtUtils;
import org.jboss.tools.ws.jaxrs.core.metamodel.IJaxrsEndpoint;
import org.jboss.tools.ws.jaxrs.core.metamodel.IJaxrsHttpMethod;
import org.jboss.tools.ws.jaxrs.core.metamodel.IJaxrsResource;
+import org.jboss.tools.ws.jaxrs.core.metamodel.IJaxrsResourceMethod;
import org.junit.Assert;
import org.junit.Test;
@@ -45,76 +53,16 @@
}
}
- /** @Test
- * @Ignore
- * public void shouldAssertProviders() throws CoreException {
- * // FIXME : check no abstract class is registered
- * Assert.assertEquals(2,
- * metamodel.getProviders(EnumKind.CONSUMER).size());
- * for (IJaxrsProvider p :
- * metamodel.getProviders(EnumKind.CONSUMER)) {
- * Assert.assertNotNull("Missing provided type",
- * p.getProvidedKinds().containsKey(EnumKind.CONSUMER));
- * /
- * Assert.assertNotNull("Missing mime-type: " +
- * p.getJavaType().getFullyQualifiedName(),
- * p.getMediaTypes(EnumKind.CONSUMER));
- * /
- * Assert.assertFalse("Provider type shouldn't be abstract: " +
- * p.getJavaElement().getFullyQualifiedName(),
- * JdtUtils.isAbstractType(p.getJavaElement()));
- * }
- *
- * Assert.assertEquals(3,
- * metamodel.getProviders(EnumKind.PRODUCER).size());
- * for (IJaxrsProvider p :
- * metamodel.getProviders(EnumKind.PRODUCER)) {
- * Assert.assertNotNull("Missing provided type",
- * p.getProvidedKinds().containsKey(EnumKind.PRODUCER));
- * /
- * Assert.assertNotNull("Missing mime-type: " +
- * p.getJavaType().getFullyQualifiedName(),
- * p.getMediaTypes(EnumKind.PRODUCER));
- * /
- * Assert.assertFalse("Provider type shouldn't be abstract: " +
- * p.getJavaElement().getFullyQualifiedName(),
- * JdtUtils.isAbstractType(p.getJavaElement()));
- * }
- *
- * Assert.assertEquals(3,
- * metamodel.getProviders(EnumKind.EXCEPTION_MAPPER).size());
- * for (IJaxrsProvider p :
- * metamodel.getProviders(EnumKind.EXCEPTION_MAPPER)) {
- * Assert.assertNotNull("Missing provided type",
- * p.getProvidedKinds().containsKey(EnumKind.EXCEPTION_MAPPER));
- * Assert.assertNull("Unexpected mime-type: " +
- * p.getJavaElement().getFullyQualifiedName(),
- * p.getMediaTypeCapabilities(EnumKind.EXCEPTION_MAPPER));
- * Assert.assertFalse("Provider type shouldn't be abstract: " +
- * p.getJavaElement().getFullyQualifiedName(),
- * JdtUtils.isAbstractType(p.getJavaElement()));
- * }
- * } */
-
@Test
public void shouldAssertResourcesAndMethods() throws CoreException {
// for now, the result excludes the (binary) AsynchronousDispatcher, and
// hence, its (sub)resources
- // FIXME : should this include the subresource locator (method) ???
Assert.assertEquals(5, metamodel.getAllResources().size());
for (IJaxrsResource jaxrsResource : metamodel.getAllResources()) {
assertThat(jaxrsResource.getJavaElement(), notNullValue());
assertThat(jaxrsResource.getKind(), notNullValue());
assertThat(jaxrsResource.getAllMethods().size(), greaterThan(0));
}
- /*
- * for (IJaxrsResource resource : metamodel.getAllResources()) {
- * Assert.assertNotNull("JavaType not found",
- * resource.getJavaElement());
- * Assert.assertEquals("Wrong kind", EnumKind.ROOT_RESOURCE,
- * resource.getKind());
- * }
- */
}
@Test
@@ -132,24 +80,50 @@
Assert.assertFalse("No consumed media types", endpoint.getConsumedMediaTypes().isEmpty());
Assert.assertFalse("No produced media types", endpoint.getProducedMediaTypes().isEmpty());
}
- /*
- * List<Route> uriMappings = new
- * ArrayList<Route>(resolveUriMappings.keySet());
- * Collections.sort(uriMappings); Assert.assertEquals("Wrong result",
- * "/customers?start={int}&size={int}", uriMappings.get(0)
- * .getFullUriPathTemplate()); Assert.assertEquals("Wrong result",
- * "GET", uriMappings.get(0).getHTTPMethod().getHttpVerb());
- * Assert.assertEquals("Wrong result", "/products/{type}/{id}",
- * uriMappings.get(9).getFullUriPathTemplate());
- */
}
@Test
- public void shouldFullyAssertCustomerResource() throws CoreException {
- IJaxrsResource customerResource = (IJaxrsResource) metamodel.getElement(JdtUtils.resolveType(
- "org.jboss.tools.ws.jaxrs.sample.services.CustomerResource", javaProject, new NullProgressMonitor()));
- Assert.assertNotNull("CustomerResource not found", customerResource);
+ public void shouldRetrieveCustomerResource() throws CoreException {
+ IType customerType = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource", javaProject);
+ final IJaxrsResource customerResource = (IJaxrsResource) metamodel.getElement(customerType);
+ Assert.assertNotNull("CustomerResource not found", customerType);
Assert.assertEquals("Wrong number of resource resourceMethods", 6, customerResource.getResourceMethods().size());
}
+ @Test
+ public void shouldRetrieveCustomerResourceMethodProposals() throws CoreException {
+ IType customerType = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource", javaProject);
+ IMethod customerMethod = getMethod(customerType, "getCustomers");
+ final IJaxrsResourceMethod customerResourceMethod = (IJaxrsResourceMethod) metamodel.getElement(customerMethod);
+ Assert.assertThat(customerResourceMethod, notNullValue());
+ Assert.assertThat(customerResourceMethod.getPathParamValueProposals().size(), equalTo(0));
+ }
+
+ @Test
+ public void shouldRetrieveCustomerSubresourceMethodProposals() throws CoreException {
+ IType customerType = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource", javaProject);
+ IMethod customerMethod = getMethod(customerType, "getCustomer");
+ final IJaxrsResourceMethod customerResourceMethod = (IJaxrsResourceMethod) metamodel.getElement(customerMethod);
+ Assert.assertThat(customerResourceMethod, notNullValue());
+ Assert.assertThat(customerResourceMethod.getPathParamValueProposals(), containsInAnyOrder("id"));
+ }
+
+ @Test
+ public void shouldRetrieveBookResourceMethodProposals() throws CoreException {
+ IType customerType = getType("org.jboss.tools.ws.jaxrs.sample.services.BookResource", javaProject);
+ IMethod customerMethod = getMethod(customerType, "getAllProducts");
+ final IJaxrsResourceMethod customerResourceMethod = (IJaxrsResourceMethod) metamodel.getElement(customerMethod);
+ Assert.assertThat(customerResourceMethod, notNullValue());
+ Assert.assertThat(customerResourceMethod.getPathParamValueProposals().size(), equalTo(0));
+ }
+
+ @Test
+ public void shouldRetrieveBooksubresourceMethodProposals() throws CoreException {
+ IType customerType = getType("org.jboss.tools.ws.jaxrs.sample.services.BookResource", javaProject);
+ IMethod customerMethod = getMethod(customerType, "getProduct");
+ final IJaxrsResourceMethod customerResourceMethod = (IJaxrsResourceMethod) metamodel.getElement(customerMethod);
+ Assert.assertThat(customerResourceMethod, notNullValue());
+ Assert.assertThat(customerResourceMethod.getPathParamValueProposals(), containsInAnyOrder("id"));
+ }
+
}
Modified: trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/jdt/JdtUtilsTestCase.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/jdt/JdtUtilsTestCase.java 2011-11-22 12:30:55 UTC (rev 36530)
+++ trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/jdt/JdtUtilsTestCase.java 2011-11-22 13:26:39 UTC (rev 36531)
@@ -655,6 +655,7 @@
assertThat(javaAnnotation.getName(), equalTo(Path.class.getName()));
assertThat(javaAnnotation.getJavaAnnotationElements().size(), equalTo(1));
assertThat(javaAnnotation.getJavaAnnotationElements().get("value").get(0), equalTo("/customers"));
+ assertThat(javaAnnotation.getRegion(), notNullValue());
}
@Test
@@ -670,8 +671,9 @@
// verifications
assertThat(javaAnnotations.size(), equalTo(4));
for (Entry<String, Annotation> entry : javaAnnotations.entrySet()) {
+ assertThat(entry.getKey(), equalTo(entry.getValue().getName()));
assertThat(entry.getValue().getJavaAnnotation(), notNullValue());
- assertThat(entry.getKey(), equalTo(entry.getValue().getName()));
+ assertThat(entry.getValue().getRegion(), notNullValue());
}
}
13 years, 1 month