JBoss Tools SVN: r37641 - in trunk/ws: plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain and 4 other directories.
by jbosstools-commits@lists.jboss.org
Author: xcoulon
Date: 2012-01-04 09:19:15 -0500 (Wed, 04 Jan 2012)
New Revision: 37641
Modified:
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JavaElementChangedEventFilter.java
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/ResourceChangedEventFilter.java
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsEndpoint.java
trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/projects/org.jboss.tools.ws.jaxrs.tests.sampleproject/src/main/java/org/jboss/tools/ws/jaxrs/sample/services/BookResource.java
trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/AbstractCommonTestCase.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/JaxrsMetamodelBuilderTestCase.java
trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/ResourceChangedProcessorTestCase.java
trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsMetamodelTestCase.java
Log:
Fixed JBIDE-10538
Support for JAX-RS @MatrixParam annotations
https://issues.jboss.org/browse/JBIDE-10538
Modified: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JavaElementChangedEventFilter.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JavaElementChangedEventFilter.java 2012-01-04 13:56:14 UTC (rev 37640)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JavaElementChangedEventFilter.java 2012-01-04 14:19:15 UTC (rev 37641)
@@ -121,6 +121,10 @@
int elementKind = event.getElement().getElementType();
int deltaKind = event.getDeltaKind();
IJavaElement element = event.getElement();
+ // prevent processing java elements in a closed java project
+ if (element.getJavaProject() != null && !element.getJavaProject().getProject().isOpen()) {
+ return false;
+ }
int flags = event.getFlags();
if (flags == IJavaElementDelta.F_ANNOTATIONS) {
return false;
Modified: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/ResourceChangedEventFilter.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/ResourceChangedEventFilter.java 2012-01-04 13:56:14 UTC (rev 37640)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/ResourceChangedEventFilter.java 2012-01-04 14:19:15 UTC (rev 37641)
@@ -22,6 +22,11 @@
public boolean applyRules(ResourceChangedEvent event) throws JavaModelException {
final IResource resource = event.getResource();
+ // prevent processing resources in a closed project
+ if (!resource.getProject().isOpen()) {
+ return false;
+ }
+
final IJavaProject javaProject = JavaCore.create(resource.getProject());
// check if the resource if a .java file in an existing Package Fragment
// Root
Modified: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsEndpoint.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsEndpoint.java 2012-01-04 13:56:14 UTC (rev 37640)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsEndpoint.java 2012-01-04 14:19:15 UTC (rev 37641)
@@ -21,6 +21,7 @@
import java.util.List;
import javax.ws.rs.DefaultValue;
+import javax.ws.rs.MatrixParam;
import javax.ws.rs.QueryParam;
import org.eclipse.jdt.core.IJavaProject;
@@ -205,32 +206,8 @@
uriPathTemplateBuilder.append("/").append(resourceMethod.getPathTemplate());
}
if (resourceMethod.getJavaMethodParameters() != null) {
- List<JavaMethodParameter> queryParameters = new ArrayList<JavaMethodParameter>();
- for (Iterator<JavaMethodParameter> paramIterator = resourceMethod.getJavaMethodParameters().iterator(); paramIterator
- .hasNext();) {
- JavaMethodParameter parameter = paramIterator.next();
- if (parameter.getAnnotation(QueryParam.class.getName()) != null) {
- queryParameters.add(parameter);
- }
- }
- if (queryParameters.size() > 0) {
- uriPathTemplateBuilder.append('?');
- for (Iterator<JavaMethodParameter> iterator = queryParameters.iterator(); iterator.hasNext();) {
- JavaMethodParameter parameter = iterator.next();
- final Annotation queryParamAnnotation = parameter.getAnnotation(QueryParam.class.getName());
- uriPathTemplateBuilder.append(queryParamAnnotation.getValue("value")).append("={");
- final Annotation defaultValueAnnotation = parameter.getAnnotation(DefaultValue.class.getName());
- uriPathTemplateBuilder.append(parameter.getTypeName());
- if (defaultValueAnnotation != null) {
- uriPathTemplateBuilder.append(':').append(defaultValueAnnotation.getValue("value"));
- }
- uriPathTemplateBuilder.append('}');
-
- if (iterator.hasNext()) {
- uriPathTemplateBuilder.append('&');
- }
- }
- }
+ refreshUriTemplateMatrixParams(uriPathTemplateBuilder, resourceMethod);
+ refreshUriTemplateQueryParams(uriPathTemplateBuilder, resourceMethod);
}
}
@@ -240,6 +217,52 @@
}
}
+ private void refreshUriTemplateMatrixParams(StringBuilder uriPathTemplateBuilder, JaxrsResourceMethod resourceMethod) {
+ List<JavaMethodParameter> matrixParameters = new ArrayList<JavaMethodParameter>();
+ for (Iterator<JavaMethodParameter> paramIterator = resourceMethod.getJavaMethodParameters().iterator(); paramIterator
+ .hasNext();) {
+ JavaMethodParameter parameter = paramIterator.next();
+ if (parameter.getAnnotation(MatrixParam.class.getName()) != null) {
+ matrixParameters.add(parameter);
+ }
+ }
+ for (Iterator<JavaMethodParameter> iterator = matrixParameters.iterator(); iterator.hasNext();) {
+ JavaMethodParameter matrixParam = iterator.next();
+ final Annotation matrixParamAnnotation = matrixParam.getAnnotation(MatrixParam.class.getName());
+ uriPathTemplateBuilder.append(";").append(matrixParamAnnotation.getValue("value")).append("={")
+ .append(matrixParam.getTypeName()).append("}");
+ }
+ }
+
+ private void refreshUriTemplateQueryParams(StringBuilder uriPathTemplateBuilder, JaxrsResourceMethod resourceMethod) {
+ List<JavaMethodParameter> queryParameters = new ArrayList<JavaMethodParameter>();
+ for (Iterator<JavaMethodParameter> paramIterator = resourceMethod.getJavaMethodParameters().iterator(); paramIterator
+ .hasNext();) {
+ JavaMethodParameter parameter = paramIterator.next();
+ if (parameter.getAnnotation(QueryParam.class.getName()) != null) {
+ queryParameters.add(parameter);
+ }
+ }
+ if (queryParameters.size() > 0) {
+ uriPathTemplateBuilder.append('?');
+ for (Iterator<JavaMethodParameter> iterator = queryParameters.iterator(); iterator.hasNext();) {
+ JavaMethodParameter queryParam = iterator.next();
+ final Annotation queryParamAnnotation = queryParam.getAnnotation(QueryParam.class.getName());
+ uriPathTemplateBuilder.append(queryParamAnnotation.getValue("value")).append("={");
+ uriPathTemplateBuilder.append(queryParam.getTypeName());
+ final Annotation defaultValueAnnotation = queryParam.getAnnotation(DefaultValue.class.getName());
+ if (defaultValueAnnotation != null) {
+ uriPathTemplateBuilder.append(':').append(defaultValueAnnotation.getValue("value"));
+ }
+ uriPathTemplateBuilder.append('}');
+
+ if (iterator.hasNext()) {
+ uriPathTemplateBuilder.append('&');
+ }
+ }
+ }
+ }
+
@Override
public int compareTo(IJaxrsEndpoint other) {
int uriPathTemplateComparison = this.uriPathTemplate.compareTo(other.getUriPathTemplate());
Modified: trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/projects/org.jboss.tools.ws.jaxrs.tests.sampleproject/src/main/java/org/jboss/tools/ws/jaxrs/sample/services/BookResource.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/projects/org.jboss.tools.ws.jaxrs.tests.sampleproject/src/main/java/org/jboss/tools/ws/jaxrs/sample/services/BookResource.java 2012-01-04 13:56:14 UTC (rev 37640)
+++ trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/projects/org.jboss.tools.ws.jaxrs.tests.sampleproject/src/main/java/org/jboss/tools/ws/jaxrs/sample/services/BookResource.java 2012-01-04 14:19:15 UTC (rev 37641)
@@ -3,6 +3,7 @@
import java.util.List;
import javax.ws.rs.GET;
+import javax.ws.rs.MatrixParam;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
@@ -21,6 +22,13 @@
}
@GET
+ @Path("/{id}")
+ @Produces({ "image/jpeg" })
+ public Object getPicture(@PathParam("id") Integer id, @MatrixParam("color") String color) {
+ return null;
+ }
+
+ @GET
@Produces({ "application/xml", "application/json" })
public List<Book> getAllProducts() {
return null;
Modified: trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/AbstractCommonTestCase.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/AbstractCommonTestCase.java 2012-01-04 13:56:14 UTC (rev 37640)
+++ trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/AbstractCommonTestCase.java 2012-01-04 14:19:15 UTC (rev 37641)
@@ -20,6 +20,7 @@
import org.eclipse.core.resources.IWorkspaceDescription;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.internal.core.JavaProject;
@@ -116,7 +117,9 @@
projectName = WorkbenchUtils.retrieveSampleProjectName(this.getClass());
project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
+ project.open(new NullProgressMonitor());
javaProject = JavaCore.create(project);
+ javaProject.open(new NullProgressMonitor());
Assert.assertNotNull("JavaProject not found", javaProject.exists());
Assert.assertNotNull("Project not found", javaProject.getProject().exists());
Assert.assertTrue("Project is not a JavaProject", JavaProject.hasJavaNature(javaProject.getProject()));
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 2012-01-04 13:56:14 UTC (rev 37640)
+++ trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JavaElementChangedProcessorTestCase.java 2012-01-04 14:19:15 UTC (rev 37641)
@@ -37,6 +37,7 @@
import static org.mockito.Mockito.verify;
import java.lang.annotation.Target;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
@@ -91,9 +92,9 @@
public class JavaElementChangedProcessorTestCase extends AbstractCommonTestCase {
private final static int ANY_EVENT_TYPE = 0;
-
+
private final static int NO_FLAG = 0;
-
+
private JaxrsMetamodel metamodel;
private final JavaElementChangedProcessor processor = new JavaElementChangedProcessor();
@@ -112,9 +113,11 @@
javaProject.getProject().setSessionProperty(JaxrsMetamodel.METAMODEL_QUALIFIED_NAME, metamodel);
}
- /** @return
+ /**
+ * @return
* @throws CoreException
- * @throws JavaModelException */
+ * @throws JavaModelException
+ */
private JaxrsHttpMethod createHttpMethod(Class<?> httpClass) throws CoreException, JavaModelException {
final IType httpMethodType = JdtUtils.resolveType(httpClass.getName(), javaProject, progressMonitor);
final Annotation httpMethodAnnotation = getAnnotation(httpMethodType, HttpMethod.class);
@@ -122,22 +125,22 @@
return httpMethod;
}
-
private Annotation createAnnotation(Class<?> clazz, String value) {
return createAnnotation(null, clazz.getName(), value);
}
-
+
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 List<JaxrsElementChangedEvent> processEvent(JavaElementChangedEvent event, IProgressMonitor progressmonitor) {
return processor.processEvents(Arrays.asList(event), progressmonitor);
}
private static JavaElementChangedEvent createEvent(Annotation annotation, int deltaKind) throws JavaModelException {
- return new JavaElementChangedEvent(annotation.getJavaAnnotation(), deltaKind, ANY_EVENT_TYPE , JdtUtils.parse(
+ return new JavaElementChangedEvent(annotation.getJavaAnnotation(), deltaKind, ANY_EVENT_TYPE, JdtUtils.parse(
((IMember) annotation.getJavaParent()), progressMonitor), NO_FLAG);
}
@@ -147,12 +150,14 @@
private static JavaElementChangedEvent createEvent(IMember element, int deltaKind, int flags)
throws JavaModelException {
- return new JavaElementChangedEvent(element, deltaKind, ANY_EVENT_TYPE, JdtUtils.parse(element, progressMonitor), flags);
+ return new JavaElementChangedEvent(element, deltaKind, ANY_EVENT_TYPE,
+ JdtUtils.parse(element, progressMonitor), flags);
}
private static JavaElementChangedEvent createEvent(ICompilationUnit element, int deltaKind)
throws JavaModelException {
- return new JavaElementChangedEvent(element, deltaKind,ANY_EVENT_TYPE, JdtUtils.parse(element, progressMonitor), NO_FLAG);
+ return new JavaElementChangedEvent(element, deltaKind, ANY_EVENT_TYPE,
+ JdtUtils.parse(element, progressMonitor), NO_FLAG);
}
private static JavaElementChangedEvent createEvent(IPackageFragmentRoot element, int deltaKind)
@@ -160,13 +165,13 @@
return new JavaElementChangedEvent(element, deltaKind, ANY_EVENT_TYPE, null, NO_FLAG);
}
- /** Because sometimes, generics are painful...
+ /**
+ * Because sometimes, generics are painful...
*
* @param elements
- * @return private List<JaxrsElement<?>> asList(JaxrsElement<?>...
- * elements) { final List<JaxrsElement<?>> result = new
- * ArrayList<JaxrsElement<?>>();
- * result.addAll(Arrays.asList(elements)); return result; } */
+ * @return private List<JaxrsElement<?>> asList(JaxrsElement<?>... elements) { final List<JaxrsElement<?>> result =
+ * new ArrayList<JaxrsElement<?>>(); result.addAll(Arrays.asList(elements)); return result; }
+ */
@Test
public void shouldAdd1HttpMethodAnd3ResourcesWhenAddingSourceFolder() throws CoreException {
@@ -181,9 +186,9 @@
final JavaElementChangedEvent event = createEvent(sourceFolder, ADDED);
final List<JaxrsElementChangedEvent> impacts = processEvent(event, progressMonitor);
// verifications
- // 1 HttpMethod + 3 RootResources + 2 Subresources + all their methods and fields (total of 15)..
- assertThat(impacts.size(), equalTo(21));
- assertThat(metamodel.getElements(javaProject).size(), equalTo(25)); // 5 previous HttpMethods + 21 added items
+ // 1 HttpMethod + 3 RootResources + 2 Subresources + all their methods and fields (total of 16)..
+ assertThat(impacts.size(), equalTo(22));
+ assertThat(metamodel.getElements(javaProject).size(), equalTo(26)); // 4 previous HttpMethods + 22 added items
assertThat(impacts, everyItem(Matchers.<JaxrsElementChangedEvent> hasProperty("deltaKind", equalTo(ADDED))));
}
@@ -467,10 +472,10 @@
// verifications
assertThat(impacts.size(), equalTo(1));
assertThat(impacts.get(0).getDeltaKind(), equalTo(ADDED));
- assertThat(((JaxrsResource) impacts.get(0).getElement()).getAllMethods().size(), equalTo(2));
+ assertThat(((JaxrsResource) impacts.get(0).getElement()).getAllMethods().size(), equalTo(3));
assertThat(((JaxrsResource) impacts.get(0).getElement()).getPathTemplate(), nullValue());
// includes Resource, ResourceMethods and ResourceFields
- assertThat(metamodel.getElements(javaProject).size(), equalTo(4));
+ assertThat(metamodel.getElements(javaProject).size(), equalTo(5));
}
@Test
@@ -719,15 +724,11 @@
public void shouldAddResourceFieldWhenAddingImportPathParam() throws CoreException {
/*
* // pre-conditions final IType type =
- * getType("org.jboss.tools.ws.jaxrs.sample.services.ProductResourceLocator"
- * ); final JaxrsResource resource = new JaxrsResource.Builder(type,
- * metamodel).build(); //metamodel.add(resource); final
- * IImportDeclaration importDeclaration = getImportDeclaration(type,
- * PathParam.class.getName()); // operation final
- * JavaElementChangedEvent event = createEvent(importDeclaration,
- * ADDED); final List<JaxrsElementChangedEvent> impacts =
- * processEvent(event, progressMonitor); // verifications
- * assertThat(impacts.size(), equalTo(1));
+ * getType("org.jboss.tools.ws.jaxrs.sample.services.ProductResourceLocator" ); final JaxrsResource resource =
+ * new JaxrsResource.Builder(type, metamodel).build(); //metamodel.add(resource); final IImportDeclaration
+ * importDeclaration = getImportDeclaration(type, PathParam.class.getName()); // operation final
+ * JavaElementChangedEvent event = createEvent(importDeclaration, ADDED); final List<JaxrsElementChangedEvent>
+ * impacts = processEvent(event, progressMonitor); // verifications assertThat(impacts.size(), equalTo(1));
* assertThat(impacts.get(0).getDeltaKind(), equalTo(ADDED));
*/
}
@@ -1172,7 +1173,7 @@
// verifications : resource removed, since it has no field nor method
assertThat(impacts.size(), equalTo(1));
assertThat(impacts.get(0).getDeltaKind(), equalTo(REMOVED));
- assertThat(metamodel.getElements(javaProject).size(), equalTo(2)); // @POST + customerResource
+ assertThat(metamodel.getElements(javaProject).size(), equalTo(2)); // @POST + customerResource
}
@Test
@@ -1199,7 +1200,7 @@
assertThat(impacts.size(), equalTo(1));
assertThat(impacts.get(0).getDeltaKind(), equalTo(CHANGED));
assertThat(impacts.get(0).getFlags(), equalTo(F_ELEMENT_KIND + F_PATH_VALUE));
- assertThat(metamodel.getElements(javaProject).size(), equalTo(3)); // @HTTP + resource + resourceMethod
+ assertThat(metamodel.getElements(javaProject).size(), equalTo(3)); // @HTTP + resource + resourceMethod
}
@Test
@@ -1261,7 +1262,7 @@
// verifications
assertThat(impacts.size(), equalTo(1)); // field only
assertThat(impacts, everyItem(Matchers.<JaxrsElementChangedEvent> hasProperty("deltaKind", equalTo(ADDED))));
- assertThat(metamodel.getElements(javaProject).size(), equalTo(3)); // @HTTP + resource + resourceMethod
+ assertThat(metamodel.getElements(javaProject).size(), equalTo(3)); // @HTTP + resource + resourceMethod
}
@Test
@@ -1281,7 +1282,7 @@
// verifications
assertThat(impacts.size(), equalTo(1));
assertThat(impacts.get(0).getDeltaKind(), equalTo(ADDED));
- assertThat(metamodel.getElements(javaProject).size(), equalTo(3)); // @HTTP + resource + resourceMethod
+ assertThat(metamodel.getElements(javaProject).size(), equalTo(3)); // @HTTP + resource + resourceMethod
}
@Test
@@ -1300,7 +1301,7 @@
// verifications
assertThat(impacts.size(), equalTo(1)); // field only
assertThat(impacts, everyItem(Matchers.<JaxrsElementChangedEvent> hasProperty("deltaKind", equalTo(ADDED))));
- assertThat(metamodel.getElements(javaProject).size(), equalTo(2)); // resource + resourceMethod
+ assertThat(metamodel.getElements(javaProject).size(), equalTo(2)); // resource + resourceMethod
}
@Test
@@ -1327,7 +1328,7 @@
assertThat(impacts.size(), equalTo(1));
assertThat(impacts.get(0).getDeltaKind(), equalTo(REMOVED));
verify(metamodel, times(1)).remove(any(JaxrsResourceMethod.class));
- assertThat(metamodel.getElements(javaProject).size(), equalTo(2)); // @HTTP + resource
+ assertThat(metamodel.getElements(javaProject).size(), equalTo(2)); // @HTTP + resource
}
@Test
@@ -1353,7 +1354,7 @@
assertThat(impacts.size(), equalTo(1));
assertThat(impacts.get(0).getDeltaKind(), equalTo(CHANGED));
assertThat(impacts.get(0).getFlags(), equalTo(F_PATH_VALUE + F_ELEMENT_KIND));
- assertThat(metamodel.getElements(javaProject).size(), equalTo(3)); // @HTTP + resource + resourceMethod
+ assertThat(metamodel.getElements(javaProject).size(), equalTo(3)); // @HTTP + resource + resourceMethod
}
@Test
@@ -1381,7 +1382,7 @@
assertThat(impacts.size(), equalTo(1));
assertThat(impacts.get(0).getDeltaKind(), equalTo(CHANGED));
assertThat(impacts.get(0).getFlags(), equalTo(F_PATH_VALUE + F_ELEMENT_KIND));
- assertThat(metamodel.getElements(javaProject).size(), equalTo(3)); // @HTTP + resource + resourceMethod
+ assertThat(metamodel.getElements(javaProject).size(), equalTo(3)); // @HTTP + resource + resourceMethod
}
@Test
@@ -1409,7 +1410,7 @@
assertThat(impacts.size(), equalTo(1));
assertThat(impacts.get(0).getDeltaKind(), equalTo(CHANGED));
assertThat(impacts.get(0).getFlags(), equalTo(F_HTTP_METHOD_VALUE + F_ELEMENT_KIND));
- assertThat(metamodel.getElements(javaProject).size(), equalTo(3)); // @HTTP + resource + resourceMethod
+ assertThat(metamodel.getElements(javaProject).size(), equalTo(3)); // @HTTP + resource + resourceMethod
}
@Test
@@ -1460,7 +1461,7 @@
assertThat(impacts.size(), equalTo(1));
assertThat(impacts.get(0).getDeltaKind(), equalTo(CHANGED));
assertThat(impacts.get(0).getFlags(), equalTo(F_PATH_VALUE));
- assertThat(metamodel.getElements(javaProject).size(), equalTo(3)); // @HTTP + resource + resourceMethod
+ assertThat(metamodel.getElements(javaProject).size(), equalTo(3)); // @HTTP + resource + resourceMethod
}
@Test
@@ -1488,7 +1489,7 @@
assertThat(impacts.size(), equalTo(1));
assertThat(impacts.get(0).getDeltaKind(), equalTo(CHANGED));
assertThat(impacts.get(0).getFlags(), equalTo(F_CONSUMED_MEDIATYPES_VALUE));
- assertThat(metamodel.getElements(javaProject).size(), equalTo(3)); // @HTTP + resource + resourceMethod
+ assertThat(metamodel.getElements(javaProject).size(), equalTo(3)); // @HTTP + resource + resourceMethod
}
@Test
@@ -1516,7 +1517,7 @@
assertThat(impacts.size(), equalTo(1));
assertThat(impacts.get(0).getDeltaKind(), equalTo(CHANGED));
assertThat(impacts.get(0).getFlags(), equalTo(F_CONSUMED_MEDIATYPES_VALUE));
- assertThat(metamodel.getElements(javaProject).size(), equalTo(3)); // @HTTP + resource + resourceMethod
+ assertThat(metamodel.getElements(javaProject).size(), equalTo(3)); // @HTTP + resource + resourceMethod
}
@Test
@@ -1544,7 +1545,7 @@
assertThat(impacts.size(), equalTo(1));
assertThat(impacts.get(0).getDeltaKind(), equalTo(CHANGED));
assertThat(impacts.get(0).getFlags(), equalTo(F_CONSUMED_MEDIATYPES_VALUE));
- assertThat(metamodel.getElements(javaProject).size(), equalTo(3)); // @HTTP + resource + resourceMethod
+ assertThat(metamodel.getElements(javaProject).size(), equalTo(3)); // @HTTP + resource + resourceMethod
}
@Test
@@ -1572,7 +1573,7 @@
assertThat(impacts.size(), equalTo(1));
assertThat(impacts.get(0).getDeltaKind(), equalTo(CHANGED));
assertThat(impacts.get(0).getFlags(), equalTo(F_PRODUCED_MEDIATYPES_VALUE));
- assertThat(metamodel.getElements(javaProject).size(), equalTo(3)); // @HTTP + resource + resourceMethod
+ assertThat(metamodel.getElements(javaProject).size(), equalTo(3)); // @HTTP + resource + resourceMethod
}
@Test
@@ -1600,7 +1601,7 @@
assertThat(impacts.size(), equalTo(1));
assertThat(impacts.get(0).getDeltaKind(), equalTo(CHANGED));
assertThat(impacts.get(0).getFlags(), equalTo(F_PRODUCED_MEDIATYPES_VALUE));
- assertThat(metamodel.getElements(javaProject).size(), equalTo(3)); // @HTTP + resource + resourceMethod
+ assertThat(metamodel.getElements(javaProject).size(), equalTo(3)); // @HTTP + resource + resourceMethod
}
@Test
@@ -1628,7 +1629,7 @@
assertThat(impacts.size(), equalTo(1));
assertThat(impacts.get(0).getDeltaKind(), equalTo(CHANGED));
assertThat(impacts.get(0).getFlags(), equalTo(F_PRODUCED_MEDIATYPES_VALUE));
- assertThat(metamodel.getElements(javaProject).size(), equalTo(3)); // @HTTP + resource + resourceMethod
+ assertThat(metamodel.getElements(javaProject).size(), equalTo(3)); // @HTTP + resource + resourceMethod
}
@Test
@@ -1654,8 +1655,9 @@
final JavaMethodParameter contextParameter = new JavaMethodParameter("uriInfo", UriInfo.class.getName(),
Arrays.asList(createAnnotation(Context.class, null)));
final JaxrsResourceMethod resourceMethod = new JaxrsResourceMethod.Builder(method, resource, metamodel)
- .httpMethod(getAnnotation(method, GET.class)).returnType(getType(Response.class.getName(), javaProject))
- .methodParameter(pathParameter).methodParameter(contextParameter).build();
+ .httpMethod(getAnnotation(method, GET.class))
+ .returnType(getType(Response.class.getName(), javaProject)).methodParameter(pathParameter)
+ .methodParameter(contextParameter).build();
metamodel.add(resourceMethod);
// operation
final JavaElementChangedEvent event = createEvent(method, CHANGED, F_SIGNATURE);
@@ -1664,7 +1666,7 @@
assertThat(impacts.size(), equalTo(1));
assertThat(impacts.get(0).getDeltaKind(), equalTo(CHANGED));
assertThat(impacts.get(0).getFlags(), equalTo(F_METHOD_PARAMETERS));
- assertThat(metamodel.getElements(javaProject).size(), equalTo(3)); // @HTTP + resource + resourceMethod
+ assertThat(metamodel.getElements(javaProject).size(), equalTo(3)); // @HTTP + resource + resourceMethod
}
@Test
@@ -1686,8 +1688,9 @@
final JavaMethodParameter contextParameter = new JavaMethodParameter("uriInfo", UriInfo.class.getName(),
Arrays.asList(createAnnotation(Context.class, null)));
final JaxrsResourceMethod resourceMethod = new JaxrsResourceMethod.Builder(method, resource, metamodel)
- .httpMethod(getAnnotation(method, GET.class)).returnType(getType(Response.class.getName(), javaProject))
- .methodParameter(pathParameter).methodParameter(contextParameter).build();
+ .httpMethod(getAnnotation(method, GET.class))
+ .returnType(getType(Response.class.getName(), javaProject)).methodParameter(pathParameter)
+ .methodParameter(contextParameter).build();
metamodel.add(resourceMethod);
// operation
final JavaElementChangedEvent event = createEvent(method, CHANGED, F_SIGNATURE);
@@ -1696,7 +1699,7 @@
assertThat(impacts.size(), equalTo(1));
assertThat(impacts.get(0).getDeltaKind(), equalTo(CHANGED));
assertThat(impacts.get(0).getFlags(), equalTo(F_METHOD_PARAMETERS));
- assertThat(metamodel.getElements(javaProject).size(), equalTo(3)); // @HTTP + resource + resourceMethod
+ assertThat(metamodel.getElements(javaProject).size(), equalTo(3)); // @HTTP + resource + resourceMethod
}
@Test
@@ -1729,7 +1732,7 @@
assertThat(impacts.size(), equalTo(1));
assertThat(impacts.get(0).getDeltaKind(), equalTo(CHANGED));
assertThat(impacts.get(0).getFlags(), equalTo(F_METHOD_PARAMETERS));
- assertThat(metamodel.getElements(javaProject).size(), equalTo(3)); // @HTTP + resource + resourceMethod
+ assertThat(metamodel.getElements(javaProject).size(), equalTo(3)); // @HTTP + resource + resourceMethod
}
@Test
@@ -1762,10 +1765,41 @@
assertThat(impacts.get(0).getDeltaKind(), equalTo(CHANGED));
assertThat(impacts.get(0).getFlags(), equalTo(F_METHOD_PARAMETERS));
assertThat(impacts.get(0).getElement().getElementKind(), equalTo(EnumElementKind.RESOURCE_METHOD));
- assertThat(metamodel.getElements(javaProject).size(), equalTo(3)); // @HTTP + resource + resourceMethod
+ assertThat(metamodel.getElements(javaProject).size(), equalTo(3)); // @HTTP + resource + resourceMethod
}
@Test
+ public void shouldUpdateResourceMethodWhenAddingParameterWithMatrixParamAnnotation() throws CoreException {
+ // the method signature is changed
+ // pre-conditions
+ // JAX-RS HttpMethod
+ final JaxrsHttpMethod httpMethod = createHttpMethod(GET.class);
+ metamodel.add(httpMethod);
+ // Parent JAX-RS Resource
+ final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.BookResource", 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 (color param is not declared)
+ final IMethod method = getMethod(type, "getPicture");
+ final JavaMethodParameter pathParameter = new JavaMethodParameter("id", String.class.getName(),
+ Arrays.asList(createAnnotation(PathParam.class, null)));
+ final JaxrsResourceMethod jaxrsMethod = new JaxrsResourceMethod.Builder(method, resource, metamodel)
+ .pathTemplate(getAnnotation(method, Path.class)).methodParameter(pathParameter)
+ .returnType(getType("java.lang.Object", javaProject)).build();
+ metamodel.add(jaxrsMethod);
+ // operation
+ final JavaElementChangedEvent event = createEvent(method, CHANGED, F_SIGNATURE);
+ final List<JaxrsElementChangedEvent> impacts = processEvent(event, progressMonitor);
+ // verifications
+ assertThat(impacts.size(), equalTo(1));
+ assertThat(impacts.get(0).getDeltaKind(), equalTo(CHANGED));
+ assertThat(impacts.get(0).getFlags(), equalTo(F_METHOD_PARAMETERS));
+ assertThat(impacts.get(0).getElement().getElementKind(), equalTo(EnumElementKind.RESOURCE_METHOD));
+ assertThat(metamodel.getElements(javaProject).size(), equalTo(3)); // @HTTP + resource + resourceMethod
+ }
+
+ @Test
public void shouldUpdateResourceMethodWhenAddingQueryParamAnnotationOnParameter() throws CoreException {
// the method signature is changed
// pre-conditions
@@ -1781,8 +1815,8 @@
final IMethod method = getMethod(type, "getCustomers");
final JavaMethodParameter startParameter = new JavaMethodParameter("start", "int",
Arrays.asList(createAnnotation(QueryParam.class, "start")));
- final JavaMethodParameter sizeParameter = new JavaMethodParameter("size", "int", Arrays.asList(createAnnotation(
- DefaultValue.class, "2")));
+ final JavaMethodParameter sizeParameter = new JavaMethodParameter("size", "int",
+ Arrays.asList(createAnnotation(DefaultValue.class, "2")));
final JavaMethodParameter uriInfoParameter = new JavaMethodParameter("uriInfo", UriInfo.class.getName(),
Arrays.asList(createAnnotation(Context.class, null)));
final JaxrsResourceMethod jaxrsMethod = new JaxrsResourceMethod.Builder(method, resource, metamodel)
@@ -1797,7 +1831,7 @@
assertThat(impacts.size(), equalTo(1));
assertThat(impacts.get(0).getDeltaKind(), equalTo(CHANGED));
assertThat(impacts.get(0).getFlags(), equalTo(F_METHOD_PARAMETERS));
- assertThat(metamodel.getElements(javaProject).size(), equalTo(3)); // @HTTP + resource + resourceMethod
+ assertThat(metamodel.getElements(javaProject).size(), equalTo(3)); // @HTTP + resource + resourceMethod
}
@Test
@@ -1817,8 +1851,8 @@
final IMethod method = getMethod(type, "getCustomers");
final JavaMethodParameter startParameter = new JavaMethodParameter("start", "int",
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 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(createAnnotation(Context.class, null)));
final JaxrsResourceMethod jaxrsMethod = new JaxrsResourceMethod.Builder(method, resource, metamodel)
@@ -1833,7 +1867,7 @@
assertThat(impacts.size(), equalTo(1));
assertThat(impacts.get(0).getDeltaKind(), equalTo(CHANGED));
assertThat(impacts.get(0).getFlags(), equalTo(F_METHOD_PARAMETERS));
- assertThat(metamodel.getElements(javaProject).size(), equalTo(3)); // @HTTP + resource + resourceMethod
+ assertThat(metamodel.getElements(javaProject).size(), equalTo(3)); // @HTTP + resource + resourceMethod
}
@Test
@@ -1848,15 +1882,14 @@
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)
+ // JAX-RS Resource Method (with an extra @Queryparam annotation on 'uriInfo' param)
final IMethod method = getMethod(type, "getCustomers");
- final JavaMethodParameter startParameter = new JavaMethodParameter("start", "int", Arrays.asList(
- 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 startParameter = new JavaMethodParameter("start", "int",
+ 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(createAnnotation(Context.class, null)));
+ Arrays.asList(createAnnotation(QueryParam.class, "foo"), createAnnotation(Context.class, null)));
final JaxrsResourceMethod jaxrsMethod = new JaxrsResourceMethod.Builder(method, resource, metamodel)
.httpMethod(getAnnotation(method, GET.class)).returnType(getType("java.util.List", javaProject))
.methodParameter(startParameter).methodParameter(sizeParameter).methodParameter(uriInfoParameter)
@@ -1869,25 +1902,103 @@
assertThat(impacts.size(), equalTo(1));
assertThat(impacts.get(0).getDeltaKind(), equalTo(CHANGED));
assertThat(impacts.get(0).getFlags(), equalTo(F_METHOD_PARAMETERS));
- assertThat(metamodel.getElements(javaProject).size(), equalTo(3)); // @HTTP + resource + resourceMethod
+ assertThat(metamodel.getElements(javaProject).size(), equalTo(3)); // @HTTP + resource + resourceMethod
}
@Test
- @Ignore("deferred for now")
public void shouldUpdateResourceMethodWhenAddingMatrixParamAnnotationOnParameter() throws CoreException {
- fail("Not implemented yet");
+ // the method signature is changed
+ // pre-conditions
+ // JAX-RS HttpMethod
+ final JaxrsHttpMethod httpMethod = createHttpMethod(GET.class);
+ metamodel.add(httpMethod);
+ // Parent JAX-RS Resource
+ final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.BookResource", 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 (MatrixParam annotation on second parameter is not declared)
+ final IMethod method = getMethod(type, "getPicture");
+ final JavaMethodParameter startParameter = new JavaMethodParameter("id", Integer.class.getName(),
+ Arrays.asList(createAnnotation(PathParam.class, "id")));
+ final JavaMethodParameter sizeParameter = new JavaMethodParameter("color", String.class.getName(), new ArrayList<Annotation>());
+ final JaxrsResourceMethod jaxrsMethod = new JaxrsResourceMethod.Builder(method, resource, metamodel)
+ .httpMethod(getAnnotation(method, GET.class)).returnType(getType("java.lang.Object", javaProject))
+ .methodParameter(startParameter).methodParameter(sizeParameter)
+ .build();
+ metamodel.add(jaxrsMethod);
+ // operation
+ final JavaElementChangedEvent event = createEvent(method, CHANGED, F_SIGNATURE);
+ final List<JaxrsElementChangedEvent> impacts = processEvent(event, progressMonitor);
+ // verifications
+ assertThat(impacts.size(), equalTo(1));
+ assertThat(impacts.get(0).getDeltaKind(), equalTo(CHANGED));
+ assertThat(impacts.get(0).getFlags(), equalTo(F_METHOD_PARAMETERS));
+ assertThat(metamodel.getElements(javaProject).size(), equalTo(3)); // @HTTP + resource + resourceMethod
}
@Test
- @Ignore("deferred for now")
public void shouldUpdateResourceMethodWhenChangingMatrixParamAnnotationOnParameter() throws CoreException {
- fail("Not implemented yet");
+ // the method signature is changed
+ // pre-conditions
+ // JAX-RS HttpMethod
+ final JaxrsHttpMethod httpMethod = createHttpMethod(GET.class);
+ metamodel.add(httpMethod);
+ // Parent JAX-RS Resource
+ final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.BookResource", 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 (MatrixParam value is different: "foo" vs "color" on second param)
+ final IMethod method = getMethod(type, "getPicture");
+ final JavaMethodParameter startParameter = new JavaMethodParameter("id", Integer.class.getName(),
+ Arrays.asList(createAnnotation(PathParam.class, "id")));
+ final JavaMethodParameter sizeParameter = new JavaMethodParameter("color", String.class.getName(), Arrays.asList(
+ createAnnotation(MatrixParam.class, "foo")));
+ final JaxrsResourceMethod jaxrsMethod = new JaxrsResourceMethod.Builder(method, resource, metamodel)
+ .httpMethod(getAnnotation(method, GET.class)).returnType(getType("java.lang.Object", javaProject))
+ .methodParameter(startParameter).methodParameter(sizeParameter)
+ .build();
+ metamodel.add(jaxrsMethod);
+ // operation
+ final JavaElementChangedEvent event = createEvent(method, CHANGED, F_SIGNATURE);
+ final List<JaxrsElementChangedEvent> impacts = processEvent(event, progressMonitor);
+ // verifications
+ assertThat(impacts.size(), equalTo(1));
+ assertThat(impacts.get(0).getDeltaKind(), equalTo(CHANGED));
+ assertThat(impacts.get(0).getFlags(), equalTo(F_METHOD_PARAMETERS));
+ assertThat(metamodel.getElements(javaProject).size(), equalTo(3)); // @HTTP + resource + resourceMethod
}
@Test
- @Ignore("deferred for now")
public void shouldUpdateResourceMethodWhenRemovingMatrixParamAnnotationOnParameter() throws CoreException {
- fail("Not implemented yet");
+ // the method signature is changed
+ // pre-conditions
+ // JAX-RS HttpMethod
+ final JaxrsHttpMethod httpMethod = createHttpMethod(GET.class);
+ metamodel.add(httpMethod);
+ // Parent JAX-RS Resource
+ final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.BookResource", 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 MatrixParam annotation on 'id' param)
+ final IMethod method = getMethod(type, "getProduct");
+ final JavaMethodParameter pathParameter = new JavaMethodParameter("id", Integer.class.getName(), Arrays.asList(
+ createAnnotation(MatrixParam.class, "foo"), createAnnotation(PathParam.class, "id")));
+ final JaxrsResourceMethod jaxrsMethod = new JaxrsResourceMethod.Builder(method, resource, metamodel)
+ .httpMethod(getAnnotation(method, GET.class))
+ .returnType(getType("org.jboss.tools.ws.jaxrs.sample.domain.Book", javaProject))
+ .methodParameter(pathParameter).build();
+ metamodel.add(jaxrsMethod);
+ // operation
+ final JavaElementChangedEvent event = createEvent(method, CHANGED, F_SIGNATURE);
+ final List<JaxrsElementChangedEvent> impacts = processEvent(event, progressMonitor);
+ // verifications
+ assertThat(impacts.size(), equalTo(1));
+ assertThat(impacts.get(0).getDeltaKind(), equalTo(CHANGED));
+ assertThat(impacts.get(0).getFlags(), equalTo(F_METHOD_PARAMETERS));
+ assertThat(metamodel.getElements(javaProject).size(), equalTo(3)); // @HTTP + resource + resourceMethod
}
@Test
@@ -1907,14 +2018,14 @@
final IMethod method = getMethod(type, "getCustomers");
final JavaMethodParameter startParameter = new JavaMethodParameter("start", "int",
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 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(createAnnotation(Context.class, null)));
final JaxrsResourceMethod jaxrsMethod = new JaxrsResourceMethod.Builder(method, resource, metamodel)
- .httpMethod(getAnnotation(method, GET.class)).returnType(getType(Response.class.getName(), javaProject))
- .methodParameter(startParameter).methodParameter(sizeParameter).methodParameter(uriInfoParameter)
- .build();
+ .httpMethod(getAnnotation(method, GET.class))
+ .returnType(getType(Response.class.getName(), javaProject)).methodParameter(startParameter)
+ .methodParameter(sizeParameter).methodParameter(uriInfoParameter).build();
metamodel.add(jaxrsMethod);
// operation
final JavaElementChangedEvent event = createEvent(method, CHANGED, F_SIGNATURE);
@@ -1922,9 +2033,9 @@
// verifications
assertThat(impacts.size(), equalTo(1));
assertThat(impacts.get(0).getDeltaKind(), equalTo(CHANGED));
- // annotations were not provided but are retrieved...
+ // annotations were not provided but are retrieved...
assertThat(impacts.get(0).getFlags(), equalTo(F_METHOD_RETURN_TYPE + F_METHOD_PARAMETERS));
- assertThat(metamodel.getElements(javaProject).size(), equalTo(3)); // @HTTP + resource + resourceMethod
+ assertThat(metamodel.getElements(javaProject).size(), equalTo(3)); // @HTTP + resource + resourceMethod
}
@Test
@@ -1946,8 +2057,8 @@
final IMethod method = getMethod(type, "getCustomers");
final JavaMethodParameter startParameter = new JavaMethodParameter("start", "int",
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 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 JaxrsResourceMethod jaxrsMethod = new JaxrsResourceMethod.Builder(method, resource, metamodel)
.methodParameter(startParameter).methodParameter(sizeParameter).methodParameter(uriInfoParameter)
Modified: trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JaxrsMetamodelBuilderTestCase.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JaxrsMetamodelBuilderTestCase.java 2012-01-04 13:56:14 UTC (rev 37640)
+++ trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JaxrsMetamodelBuilderTestCase.java 2012-01-04 14:19:15 UTC (rev 37641)
@@ -61,7 +61,7 @@
// verification
final IJaxrsMetamodel metamodel = JaxrsMetamodelLocator.get(javaProject);
assertThat(metamodel, notNullValue());
- assertThat(metamodel.getAllEndpoints().size(), equalTo(11));
+ assertThat(metamodel.getAllEndpoints().size(), equalTo(12));
}
@Test
@@ -78,7 +78,7 @@
// verification
final IJaxrsMetamodel metamodel = JaxrsMetamodelLocator.get(javaProject);
assertThat(metamodel, notNullValue());
- assertThat(metamodel.getAllEndpoints().size(), equalTo(11));
+ assertThat(metamodel.getAllEndpoints().size(), equalTo(12));
}
@Test
@@ -95,7 +95,7 @@
// verification
final IJaxrsMetamodel metamodel = JaxrsMetamodelLocator.get(javaProject);
assertThat(metamodel, notNullValue());
- assertThat(metamodel.getAllEndpoints().size(), equalTo(11));
+ assertThat(metamodel.getAllEndpoints().size(), equalTo(12));
}
@Test
@@ -112,7 +112,7 @@
// verification
final IJaxrsMetamodel metamodel = JaxrsMetamodelLocator.get(javaProject);
assertThat(metamodel, notNullValue());
- assertThat(metamodel.getAllEndpoints().size(), equalTo(11));
+ assertThat(metamodel.getAllEndpoints().size(), equalTo(12));
}
@Test
@@ -128,8 +128,8 @@
// verification
final IJaxrsMetamodel metamodel = JaxrsMetamodelLocator.get(javaProject);
assertThat(metamodel, notNullValue());
- // 11 usual endpoints + 2 newly created
- assertThat(metamodel.getAllEndpoints().size(), equalTo(13));
+ // 12 usual endpoints + 2 newly created
+ assertThat(metamodel.getAllEndpoints().size(), equalTo(14));
}
@Test
@@ -146,7 +146,7 @@
// verification
final IJaxrsMetamodel metamodel = JaxrsMetamodelLocator.get(javaProject);
assertThat(metamodel, notNullValue());
- // 11 usual endpoints + 2 newly created
- assertThat(metamodel.getAllEndpoints().size(), equalTo(13));
+ // 12 usual endpoints + 2 newly created
+ assertThat(metamodel.getAllEndpoints().size(), equalTo(14));
}
}
Modified: trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/ResourceChangedProcessorTestCase.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/ResourceChangedProcessorTestCase.java 2012-01-04 13:56:14 UTC (rev 37640)
+++ trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/ResourceChangedProcessorTestCase.java 2012-01-04 14:19:15 UTC (rev 37641)
@@ -151,7 +151,7 @@
assertThat(impacts.size(), equalTo(6));
assertThat(impacts, everyItem(Matchers.<JaxrsElementChangedEvent> hasProperty("deltaKind", equalTo(ADDED))));
// all HttpMethods, Resources, ResourceMethods and ResourceFields
- assertThat(metamodel.getElements(javaProject).size(), equalTo(25));
+ assertThat(metamodel.getElements(javaProject).size(), equalTo(26));
}
@Test
@@ -356,7 +356,7 @@
assertThat(impacts.size(), equalTo(1)); // 1 resource
assertThat(impacts.get(0).getDeltaKind(), equalTo(ADDED));
// 4 HttpMethods + 2 resources (including their methods and fields)
- assertThat(metamodel.getElements(javaProject).size(), equalTo(14));
+ assertThat(metamodel.getElements(javaProject).size(), equalTo(15));
}
@Test
@@ -378,7 +378,7 @@
assertThat(impacts.get(0).getDeltaKind(), equalTo(CHANGED));
assertThat(((JaxrsResource) impacts.get(0).getElement()), equalTo(resource));
// 4 HttpMethods + 2 resources (including their methods and fields)
- assertThat(metamodel.getElements(javaProject).size(), equalTo(14));
+ assertThat(metamodel.getElements(javaProject).size(), equalTo(15));
}
@Test
@@ -399,7 +399,7 @@
assertThat(impacts.get(0).getDeltaKind(), equalTo(ADDED));
assertThat(impacts.get(0).getElement().getElementKind(), equalTo(EnumElementKind.RESOURCE_METHOD));
// 4 HttpMethods + 2 resources (including their methods and fields)
- assertThat(metamodel.getElements(javaProject).size(), equalTo(7));
+ assertThat(metamodel.getElements(javaProject).size(), equalTo(8));
}
@Test
@@ -424,11 +424,13 @@
final ResourceChangedEvent event = createEvent(bookResource.getJavaElement().getResource(), CHANGED);
final List<JaxrsElementChangedEvent> impacts = processEvent(event, progressMonitor);
// verifications
- assertThat(impacts.size(), equalTo(1)); // 1 resource method
+ assertThat(impacts.size(), equalTo(2)); // 2 resource methods
assertThat(impacts.get(0).getDeltaKind(), equalTo(CHANGED));
assertThat(impacts.get(0).getElement().getElementKind(), equalTo(EnumElementKind.RESOURCE_METHOD));
+ assertThat(impacts.get(1).getDeltaKind(), equalTo(CHANGED));
+ assertThat(impacts.get(1).getElement().getElementKind(), equalTo(EnumElementKind.RESOURCE_METHOD));
// 4 HttpMethods + 2 resources (including their methods and fields)
- assertThat(metamodel.getElements(javaProject).size(), equalTo(7));
+ assertThat(metamodel.getElements(javaProject).size(), equalTo(8));
}
@Test
@@ -453,8 +455,8 @@
assertThat(impacts.size(), equalTo(1)); // 1 resource method
assertThat(impacts.get(0).getDeltaKind(), equalTo(REMOVED));
assertThat(impacts.get(0).getElement().getElementKind(), equalTo(EnumElementKind.RESOURCE_METHOD));
- // 4 HttpMethods + 2 resources (including their methods and fields)
- assertThat(metamodel.getElements(javaProject).size(), equalTo(6));
+ // 4 HttpMethods + 1 resource (including their remaining methods and fields)
+ assertThat(metamodel.getElements(javaProject).size(), equalTo(7));
}
@Test
Modified: trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsMetamodelTestCase.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsMetamodelTestCase.java 2012-01-04 13:56:14 UTC (rev 37640)
+++ trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsMetamodelTestCase.java 2012-01-04 14:19:15 UTC (rev 37641)
@@ -141,7 +141,7 @@
@Test
public void shouldAssertResolvedEndpoints() throws CoreException {
List<IJaxrsEndpoint> endpoints = metamodel.getAllEndpoints();
- Assert.assertEquals("Wrong result", 11, endpoints.size());
+ Assert.assertEquals("Wrong result", 12, endpoints.size());
for (IJaxrsEndpoint endpoint : endpoints) {
Assert.assertFalse("Empty list of resourceMethods", endpoint.getResourceMethods().isEmpty());
Assert.assertNotNull("No URI Path template", endpoint.getUriPathTemplate());
12 years, 12 months
JBoss Tools SVN: r37640 - in trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/resources: restful and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: jjankovi
Date: 2012-01-04 08:56:14 -0500 (Wed, 04 Jan 2012)
New Revision: 37640
Added:
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/resources/restful/
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/resources/restful/AdvancedRestfulWS.java.ws
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/resources/restful/BasicRestfulWS.java.ws
Log:
new resources for RESTful tests added
Added: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/resources/restful/AdvancedRestfulWS.java.ws
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/resources/restful/AdvancedRestfulWS.java.ws (rev 0)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/resources/restful/AdvancedRestfulWS.java.ws 2012-01-04 13:56:14 UTC (rev 37640)
@@ -0,0 +1,43 @@
+package {0};
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+
+
+@Path("/rest")
+public class {1} '{'
+
+ @GET
+ @Path("/'{'id'}'")
+ @Produces("text/plain")
+ public String getMessage(@PathParam("id") int id) '{'
+ return null;
+ '}'
+
+ @DELETE
+ @Path("/delete/'{'id'}'")
+ public void deleteMesage(@PathParam("id") int id) '{'
+ //do nothing
+ '}'
+
+ @PUT
+ @Path("/put/'{'id'}'")
+ @Consumes("text/plain")
+ public void addMessage(@PathParam("id") int id) '{'
+ //do nothing
+ '}'
+
+ @POST
+ @Path("/post/'{'id'}'")
+ @Consumes("text/plain")
+ @Produces("text/plain")
+ public String editMessage(@PathParam("id") int id) '{'
+ return null;
+ '}'
+'}'
Added: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/resources/restful/BasicRestfulWS.java.ws
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/resources/restful/BasicRestfulWS.java.ws (rev 0)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/resources/restful/BasicRestfulWS.java.ws 2012-01-04 13:56:14 UTC (rev 37640)
@@ -0,0 +1,32 @@
+package {0};
+
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+
+
+@Path("/rest")
+public class {1} '{'
+
+ @GET
+ public String getMessage() '{'
+ return null;
+ '}'
+
+ @DELETE
+ public void deleteMesage() '{'
+ //do nothing
+ '}'
+
+ @PUT
+ public void addMessage() '{'
+ //do nothing
+ '}'
+
+ @POST
+ public String editMessage() '{'
+ return null;
+ '}'
+'}'
12 years, 12 months
JBoss Tools SVN: r37639 - trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/explorer.
by jbosstools-commits@lists.jboss.org
Author: jjankovi
Date: 2012-01-04 08:55:20 -0500 (Wed, 04 Jan 2012)
New Revision: 37639
Added:
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/explorer/RESTFulAnnotations.java
Log:
Annotations in RESTful services environment added
Added: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/explorer/RESTFulAnnotations.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/explorer/RESTFulAnnotations.java (rev 0)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/explorer/RESTFulAnnotations.java 2012-01-04 13:55:20 UTC (rev 37639)
@@ -0,0 +1,25 @@
+package org.jboss.tools.ws.ui.bot.test.rest.explorer;
+
+public enum RESTFulAnnotations {
+
+ CONFIGURE_MENU_LABEL("Configure"),
+ REST_SUPPORT_MENU_LABEL_ADD("Add JAX-RS 1.1 support..."),
+ REST_SUPPORT_MENU_LABEL_REMOVE("Remove JAX-RS 1.1 support..."),
+ REST_EXPLORER_LABEL("JAX-RS REST Web Services"),
+ REST_EXPLORER_LABEL_BUILD("Building RESTful Web Services..."),
+ GET("GET"),
+ POST("POST"),
+ PUT("PUT"),
+ DELETE("DELETE");
+
+ private String label;
+
+ private RESTFulAnnotations(String label) {
+ this.label = label;
+ }
+
+ public String getLabel() {
+ return label;
+ }
+
+}
12 years, 12 months
JBoss Tools SVN: r37638 - in trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test: ti and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: jjankovi
Date: 2012-01-04 08:54:21 -0500 (Wed, 04 Jan 2012)
New Revision: 37638
Added:
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/ti/
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/ti/wizard/
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/ti/wizard/RESTFullExplorerWizard.java
Log:
RESTFullExplorerWizard added for analysing rest services through rest services explorer
Added: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/ti/wizard/RESTFullExplorerWizard.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/ti/wizard/RESTFullExplorerWizard.java (rev 0)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/ti/wizard/RESTFullExplorerWizard.java 2012-01-04 13:54:21 UTC (rev 37638)
@@ -0,0 +1,92 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.ws.ui.bot.test.ti.wizard;
+
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
+import org.jboss.tools.ui.bot.ext.SWTTestExt;
+import org.jboss.tools.ws.ui.bot.test.rest.explorer.RESTFulAnnotations;
+
+public class RESTFullExplorerWizard extends SWTTestExt {
+
+ private SWTBotTreeItem restFulExplorer;
+
+ public RESTFullExplorerWizard(String wsProjectName) {
+ String[] pathToRestExplorer = {wsProjectName};
+ restFulExplorer = projectExplorer.selectTreeItem(RESTFulAnnotations.REST_EXPLORER_LABEL.getLabel(),
+ pathToRestExplorer).expand();
+ }
+
+ /**
+ *
+ * @return
+ */
+ public SWTBotTreeItem[] getAllRestServices() {
+ return restFulExplorer.getItems();
+ }
+
+ /**
+ *
+ * @param restService
+ * @return
+ */
+ public SWTBotTreeItem[] getAllInfoAboutRestService(SWTBotTreeItem restService) {
+ restService.expand();
+ return restService.getItems();
+ }
+
+ /**
+ *
+ * @param restService
+ * @return
+ */
+ public String getConsumesInfo(SWTBotTreeItem restService) {
+ for (SWTBotTreeItem ti: getAllInfoAboutRestService(restService)) {
+ if (ti.getText().contains("consumes:")) {
+ return ti.getText().split(" ")[1];
+ }
+ }
+ return null;
+ }
+
+ /**
+ *
+ * @param restService
+ * @return
+ */
+ public String getProducesInfo(SWTBotTreeItem restService) {
+ for (SWTBotTreeItem ti: getAllInfoAboutRestService(restService)) {
+ if (ti.getText().contains("produces:")) {
+ return ti.getText().split(" ")[1];
+ }
+ }
+ return null;
+ }
+
+ /**
+ *
+ * @param restService
+ * @return
+ */
+ public String getRestServiceName(SWTBotTreeItem restService) {
+ return restService.getText().split(" ")[0];
+ }
+
+ /**
+ *
+ * @param restService
+ * @return
+ */
+ public String getPathForRestFulService(SWTBotTreeItem restService) {
+ return restService.getText().split(" ")[1];
+ }
+
+}
12 years, 12 months
JBoss Tools SVN: r37637 - trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/META-INF.
by jbosstools-commits@lists.jboss.org
Author: ljelinko
Date: 2012-01-04 06:31:07 -0500 (Wed, 04 Jan 2012)
New Revision: 37637
Modified:
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/META-INF/MANIFEST.MF
Log:
added dependency to eclipse.ui.form
Modified: trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/META-INF/MANIFEST.MF 2012-01-04 11:29:21 UTC (rev 37636)
+++ trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/META-INF/MANIFEST.MF 2012-01-04 11:31:07 UTC (rev 37637)
@@ -16,4 +16,5 @@
org.junit4;bundle-version="4.8.1",
org.eclipse.datatools.connectivity;bundle-version="1.1.2",
org.jboss.tools.ui.bot.ext;bundle-version="1.0.0",
- org.hamcrest;bundle-version="1.1.0"
+ org.hamcrest;bundle-version="1.1.0",
+ org.eclipse.ui.forms;bundle-version="3.5.0"
12 years, 12 months
JBoss Tools SVN: r37636 - 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: 2012-01-04 06:29:21 -0500 (Wed, 04 Jan 2012)
New Revision: 37636
Modified:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTJBTExt.java
Log:
Wait for non ignored jobs before trying to close Report Usage Windows.
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 2012-01-04 11:28:50 UTC (rev 37635)
+++ trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTJBTExt.java 2012-01-04 11:29:21 UTC (rev 37636)
@@ -514,6 +514,7 @@
SWTWorkbenchBot bot = new SWTWorkbenchBot();
SWTBotShell shJbtUsage = null;
SWTBotShell shSubclipseUsage = null;
+ new SWTUtilExt(bot).waitForNonIgnoredJobs();
SWTBotShell[] shells = bot.shells();
int index = 0;
while ((shJbtUsage == null || shSubclipseUsage == null)
12 years, 12 months
JBoss Tools SVN: r37635 - in trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/task: debug and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: ljelinko
Date: 2012-01-04 06:28:50 -0500 (Wed, 04 Jan 2012)
New Revision: 37635
Added:
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/task/debug/PrintWidgetsTask.java
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/task/finder/
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/task/finder/BasicWidgetsVisitor.java
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/task/finder/VisitableWidget.java
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/task/finder/WidgetFindingTask.java
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/task/finder/WidgetVisitor.java
Removed:
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/task/debug/WriteAllWidgets.java
Log:
refactored debugging functionality
Copied: trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/task/debug/PrintWidgetsTask.java (from rev 37554, trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/task/debug/WriteAllWidgets.java)
===================================================================
--- trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/task/debug/PrintWidgetsTask.java (rev 0)
+++ trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/task/debug/PrintWidgetsTask.java 2012-01-04 11:28:50 UTC (rev 37635)
@@ -0,0 +1,246 @@
+package org.jboss.tools.portlet.ui.bot.task.debug;
+
+import java.io.PrintStream;
+
+import javax.swing.table.TableColumn;
+
+import org.eclipse.swt.browser.Browser;
+import org.eclipse.swt.custom.CCombo;
+import org.eclipse.swt.custom.CLabel;
+import org.eclipse.swt.custom.CTabItem;
+import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.DateTime;
+import org.eclipse.swt.widgets.ExpandBar;
+import org.eclipse.swt.widgets.ExpandItem;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Link;
+import org.eclipse.swt.widgets.List;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.Scale;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Slider;
+import org.eclipse.swt.widgets.Spinner;
+import org.eclipse.swt.widgets.TabItem;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.swt.widgets.ToolBar;
+import org.eclipse.swt.widgets.ToolItem;
+import org.eclipse.swt.widgets.Tray;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.swt.widgets.TreeItem;
+import org.eclipse.swt.widgets.Widget;
+import org.eclipse.ui.forms.widgets.Hyperlink;
+import org.hamcrest.Matcher;
+import org.jboss.tools.portlet.ui.bot.task.AbstractSWTTask;
+import org.jboss.tools.portlet.ui.bot.task.finder.BasicWidgetsVisitor;
+import org.jboss.tools.portlet.ui.bot.task.finder.WidgetFindingTask;
+
+/**
+ * Finds all widgets recursively and writes debuggin information about each of them.
+ *
+ * @author Lucia Jelinkova
+ *
+ */
+public class PrintWidgetsTask extends AbstractSWTTask {
+
+ private Matcher<? extends Widget> matcher;
+
+ private Widget parentWidget;
+
+ private PrintStream stream;
+
+ public PrintWidgetsTask() {
+ this(null);
+ }
+
+ public PrintWidgetsTask(Matcher<? extends Widget> matcher) {
+ this(matcher, null);
+ }
+
+ public PrintWidgetsTask(Matcher<? extends Widget> matcher, Widget parentWidget) {
+ this(matcher, parentWidget, System.out);
+ }
+
+ public PrintWidgetsTask(Matcher<? extends Widget> matcher, Widget parentWidget, PrintStream stream) {
+ super();
+ this.matcher = matcher;
+ this.parentWidget = parentWidget;
+ this.stream = stream;
+ }
+
+ @Override
+ public void perform() {
+ stream.println("--------------- Start of the list of widgets ---------------");
+ performInnerTask(new WidgetFindingTask(parentWidget, matcher, new WriteAllWidgetsVisitor()));
+ stream.println("--------------- End of the list of widgets ---------------");
+ }
+
+ private class WriteAllWidgetsVisitor extends BasicWidgetsVisitor {
+
+ @Override
+ protected void visitButton(Button widget) {
+ stream.println(widget);
+ }
+
+ @Override
+ protected void visitBrowser(Browser widget) {
+ stream.println(widget);
+ }
+
+ @Override
+ protected void visitCCombo(CCombo widget) {
+ stream.println(widget);
+ }
+
+ @Override
+ protected void visitCLabel(CLabel widget) {
+ stream.println(widget);
+ }
+
+ @Override
+ protected void visitCombo(Combo widget) {
+ stream.println(widget);
+ }
+
+ @Override
+ protected void visitCTabItem(CTabItem widget) {
+ stream.println(widget);
+ }
+
+ @Override
+ protected void visitDateTime(DateTime widget) {
+ stream.println(widget);
+ }
+
+ @Override
+ protected void visitExpandBar(ExpandBar widget) {
+ stream.println(widget);
+ }
+
+ @Override
+ protected void visitExpandItem(ExpandItem widget) {
+ stream.println(widget);
+ }
+
+ @Override
+ protected void visitLabel(Label widget) {
+ stream.println(widget);
+ }
+
+ @Override
+ protected void visitLink(Link widget) {
+ stream.println(widget);
+ }
+
+ @Override
+ protected void visitList(List widget) {
+ stream.println(widget);
+ }
+
+ @Override
+ protected void visitMenu(Menu widget) {
+ stream.println(widget);
+ }
+
+ @Override
+ protected void visitScale(Scale widget) {
+ stream.println(widget);
+ }
+
+ @Override
+ protected void visitShell(Shell widget) {
+ stream.println(widget);
+ }
+
+ @Override
+ protected void visitSlider(Slider widget) {
+ stream.println(widget);
+ }
+
+ @Override
+ protected void visitSpinner(Spinner widget) {
+ stream.println(widget);
+ }
+
+ @Override
+ protected void visitStyledText(StyledText widget) {
+ stream.println(widget);
+ }
+
+ @Override
+ protected void visitTabItem(TabItem widget) {
+ stream.println(widget);
+ }
+
+ @Override
+ protected void visitTable(Table widget) {
+ stream.println(widget);
+ }
+
+ @Override
+ protected void visitTableColumn(TableColumn widget) {
+ stream.println(widget);
+ }
+
+ @Override
+ protected void visitTableItem(TableItem widget) {
+ stream.println(widget);
+ }
+
+ @Override
+ protected void visitText(Text widget) {
+ stream.print("Text {");
+ stream.print(widget.getText());
+ stream.println("}");
+ }
+
+ @Override
+ protected void visitToolBar(ToolBar widget) {
+ stream.print("Toolbar {");
+ stream.print(widget.getRowCount() + " row(s), ");
+ stream.print(widget.getItemCount() + " item(s)");
+ stream.println("}");
+ }
+
+ @Override
+ protected void visitToolItem(ToolItem widget) {
+ stream.print("Toolitem {");
+ stream.print("text = '" + widget.getText() + "', ");
+ stream.print("tooltip = '" + widget.getToolTipText() + "'");
+ stream.println("}");
+ }
+
+ @Override
+ protected void visitTray(Tray widget) {
+ stream.println(widget);
+ }
+
+ @Override
+ protected void visitTree(Tree widget) {
+ stream.print("Tree {");
+ stream.print(widget.getItemCount() + " item(s), ");
+ stream.print(widget.getColumnCount() + " columns(s)");
+ stream.println("}");
+ }
+
+ @Override
+ protected void visitTreeItem(TreeItem widget) {
+ stream.println(widget);
+ }
+
+ @Override
+ protected void visitHyperLink(Hyperlink widget) {
+ stream.print("Hyperlink {");
+ stream.print("text = '" + widget.getText() + "'");
+ stream.println("}");
+ }
+
+ @Override
+ protected void visitUnkownItem(Widget widget) {
+ stream.println("Unknown: " + widget);
+ }
+ }
+}
Deleted: trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/task/debug/WriteAllWidgets.java
===================================================================
--- trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/task/debug/WriteAllWidgets.java 2012-01-04 11:02:46 UTC (rev 37634)
+++ trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/task/debug/WriteAllWidgets.java 2012-01-04 11:28:50 UTC (rev 37635)
@@ -1,98 +0,0 @@
-package org.jboss.tools.portlet.ui.bot.task.debug;
-
-import static org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable.syncExec;
-import static org.eclipse.swtbot.swt.finder.matchers.WidgetMatcherFactory.widgetOfType;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Widget;
-import org.eclipse.swtbot.swt.finder.results.VoidResult;
-import org.hamcrest.Matcher;
-import org.jboss.tools.portlet.ui.bot.task.AbstractSWTTask;
-
-/**
- * Finds all widgets recursively and writes debuggin information about each of them.
- *
- * @author Lucia Jelinkova
- *
- */
-public class WriteAllWidgets extends AbstractSWTTask {
-
- private Matcher<? extends Widget> matcher;
-
- private Widget parentWidget;
-
- /**
- * Finds all widgets for the active shell.
- */
- public WriteAllWidgets() {
- this(widgetOfType(Widget.class));
- }
-
- /**
- * Finds all widgets meeting specified matcher's condition for the active shell.
- *
- * @param matcher
- */
- public WriteAllWidgets(Matcher<? extends Widget> matcher) {
- this(null, matcher);
- }
-
- /**
- * Finds all widgets starting from the specified widget meeting
- * specified matcher condition.
- *
- * @param widget
- * @param matcher
- */
- public WriteAllWidgets(Widget widget, Matcher<? extends Widget> matcher) {
- super();
- this.matcher = matcher;
- this.parentWidget = widget;
- }
-
- @Override
- public void perform() {
- syncExec(new VoidResult() {
-
- @Override
- public void run() {
- System.out.println("List of current widgets");
- writeWidgetRecursive(getParentWidget(), new ArrayList<Widget>(), "");
- System.out.println("End of list");
- }
- });
- }
-
- private void writeWidgetRecursive(Widget widget, ArrayList<Widget> visited, String prefix){
-
- if (visited.contains(widget)){
- return;
- }
-
- visited.add(widget);
- writeWidget(widget, prefix);
-
- if (widget instanceof Composite && ((Composite) widget).getChildren().length == 0){
- return;
- }
-
- List<? extends Widget> children = getBot().widgets(matcher, widget);
- for (Widget child : children){
- writeWidgetRecursive(child, visited, prefix + "---");
- }
- }
-
- private void writeWidget(Widget widget, String prefix){
- System.out.println(prefix + widget);
- }
-
- private Widget getParentWidget() {
- if (parentWidget == null){
- return getBot().activeShell().widget;
- }
- return parentWidget;
- }
-}
Added: trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/task/finder/BasicWidgetsVisitor.java
===================================================================
--- trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/task/finder/BasicWidgetsVisitor.java (rev 0)
+++ trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/task/finder/BasicWidgetsVisitor.java 2012-01-04 11:28:50 UTC (rev 37635)
@@ -0,0 +1,165 @@
+package org.jboss.tools.portlet.ui.bot.task.finder;
+
+import javax.swing.table.TableColumn;
+
+import org.eclipse.swt.browser.Browser;
+import org.eclipse.swt.custom.CCombo;
+import org.eclipse.swt.custom.CLabel;
+import org.eclipse.swt.custom.CTabItem;
+import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.DateTime;
+import org.eclipse.swt.widgets.ExpandBar;
+import org.eclipse.swt.widgets.ExpandItem;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Link;
+import org.eclipse.swt.widgets.List;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.Scale;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Slider;
+import org.eclipse.swt.widgets.Spinner;
+import org.eclipse.swt.widgets.TabItem;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.swt.widgets.ToolBar;
+import org.eclipse.swt.widgets.ToolItem;
+import org.eclipse.swt.widgets.Tray;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.swt.widgets.TreeItem;
+import org.eclipse.swt.widgets.Widget;
+import org.eclipse.ui.forms.widgets.Hyperlink;
+
+/**
+ * Distinguishes basic types that are known for SWTBot.
+ *
+ * @author Lucia Jelinkova
+ *
+ */
+public abstract class BasicWidgetsVisitor implements WidgetVisitor {
+
+ @Override
+ public void visit(Widget widget) {
+ if (widget instanceof Button){
+ visitButton((Button) widget);
+ } else if (widget instanceof Browser){
+ visitBrowser((Browser) widget);
+ } else if (widget instanceof CCombo){
+ visitCCombo((CCombo) widget);
+ } else if (widget instanceof CLabel){
+ visitCLabel((CLabel) widget);
+ } else if (widget instanceof Combo){
+ visitCombo((Combo) widget);
+ } else if (widget instanceof CTabItem){
+ visitCTabItem((CTabItem) widget);
+ } else if (widget instanceof DateTime){
+ visitDateTime((DateTime) widget);
+ } else if (widget instanceof ExpandBar){
+ visitExpandBar((ExpandBar) widget);
+ } else if (widget instanceof ExpandItem){
+ visitExpandItem((ExpandItem) widget);
+ } else if (widget instanceof Label){
+ visitLabel((Label) widget);
+ } else if (widget instanceof Link){
+ visitLink((Link) widget);
+ } else if (widget instanceof List){
+ visitList((List) widget);
+ } else if (widget instanceof Menu){
+ visitMenu((Menu) widget);
+ } else if (widget instanceof Scale){
+ visitScale((Scale) widget);
+ } else if (widget instanceof Shell){
+ visitShell((Shell) widget);
+ } else if (widget instanceof Slider){
+ visitSlider((Slider) widget);
+ } else if (widget instanceof Spinner){
+ visitSpinner((Spinner) widget);
+ } else if (widget instanceof StyledText){
+ visitStyledText((StyledText) widget);
+ } else if (widget instanceof TabItem){
+ visitTabItem((TabItem) widget);
+ } else if (widget instanceof Table){
+ visitTable((Table) widget);
+ } else if (widget instanceof TableItem){
+ visitTableItem((TableItem) widget);
+ } else if (widget instanceof Text){
+ visitText((Text) widget);
+ } else if (widget instanceof ToolBar){
+ visitToolBar((ToolBar) widget);
+ } else if (widget instanceof ToolItem){
+ visitToolItem((ToolItem) widget);
+ } else if (widget instanceof Tray){
+ visitTray((Tray) widget);
+ } else if (widget instanceof Tree){
+ visitTree((Tree) widget);
+ } else if (widget instanceof TreeItem){
+ visitTreeItem((TreeItem) widget);
+ } else if (widget instanceof Hyperlink){
+ visitHyperLink((Hyperlink) widget);
+ } else {
+ visitUnkownItem(widget);
+ }
+ }
+
+ protected abstract void visitButton(Button widget);
+
+ protected abstract void visitBrowser(Browser widget);
+
+ protected abstract void visitCCombo(CCombo widget);
+
+ protected abstract void visitCLabel(CLabel widget);
+
+ protected abstract void visitCombo(Combo widget);
+
+ protected abstract void visitCTabItem(CTabItem widget);
+
+ protected abstract void visitDateTime(DateTime widget);
+
+ protected abstract void visitExpandBar(ExpandBar widget);
+
+ protected abstract void visitExpandItem(ExpandItem widget);
+
+ protected abstract void visitLabel(Label widget);
+
+ protected abstract void visitLink(Link widget);
+
+ protected abstract void visitList(List widget);
+
+ protected abstract void visitMenu(Menu widget);
+
+ protected abstract void visitScale(Scale widget);
+
+ protected abstract void visitShell(Shell widget);
+
+ protected abstract void visitSlider(Slider widget);
+
+ protected abstract void visitSpinner(Spinner widget);
+
+ protected abstract void visitStyledText(StyledText widget);
+
+ protected abstract void visitTabItem(TabItem widget);
+
+ protected abstract void visitTable(Table widget);
+
+ protected abstract void visitTableColumn(TableColumn widget);
+
+ protected abstract void visitTableItem(TableItem widget);
+
+ protected abstract void visitText(Text widget);
+
+ protected abstract void visitToolBar(ToolBar widget);
+
+ protected abstract void visitToolItem(ToolItem widget);
+
+ protected abstract void visitTray(Tray widget);
+
+ protected abstract void visitTree(Tree widget);
+
+ protected abstract void visitTreeItem(TreeItem widget);
+
+ protected abstract void visitHyperLink(Hyperlink widget);
+
+ protected abstract void visitUnkownItem(Widget widget);
+}
Added: trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/task/finder/VisitableWidget.java
===================================================================
--- trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/task/finder/VisitableWidget.java (rev 0)
+++ trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/task/finder/VisitableWidget.java 2012-01-04 11:28:50 UTC (rev 37635)
@@ -0,0 +1,23 @@
+package org.jboss.tools.portlet.ui.bot.task.finder;
+
+import org.eclipse.swt.widgets.Widget;
+
+/**
+ * Wraps {@link Widget} so that it can be used
+ * in Visitor pattern.
+ *
+ * @author Lucia Jelinkova
+ *
+ */
+public class VisitableWidget {
+
+ private Widget widget;
+
+ public VisitableWidget(Widget w) {
+ this.widget = w;
+ }
+
+ public void accept(WidgetVisitor visitor){
+ visitor.visit(widget);
+ }
+}
Added: trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/task/finder/WidgetFindingTask.java
===================================================================
--- trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/task/finder/WidgetFindingTask.java (rev 0)
+++ trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/task/finder/WidgetFindingTask.java 2012-01-04 11:28:50 UTC (rev 37635)
@@ -0,0 +1,108 @@
+package org.jboss.tools.portlet.ui.bot.task.finder;
+
+import static org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable.syncExec;
+import static org.eclipse.swtbot.swt.finder.matchers.WidgetMatcherFactory.widgetOfType;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Widget;
+import org.eclipse.swtbot.swt.finder.results.VoidResult;
+import org.hamcrest.Matcher;
+import org.jboss.tools.portlet.ui.bot.task.AbstractSWTTask;
+
+/**
+ *
+ * Finds all widgets recursively and delegates the concrete action
+ * to be performed on the visitor (see GOF Visitor pattern)
+ *
+ * @author Lucia Jelinkova
+ *
+ */
+public class WidgetFindingTask extends AbstractSWTTask {
+
+ private Matcher<? extends Widget> matcher;
+
+ private Widget parentWidget;
+
+ private WidgetVisitor visitor;
+
+ /**
+ * Finds all widgets for the active shell.
+ */
+ public WidgetFindingTask(WidgetVisitor visitor) {
+ this(null, visitor);
+ }
+
+ /**
+ * Finds all widgets meeting specified matcher's condition for the active shell.
+ *
+ * @param matcher
+ */
+ public WidgetFindingTask(Matcher<? extends Widget> matcher, WidgetVisitor visitor) {
+ this(null, matcher, visitor);
+ }
+
+ /**
+ * Finds all widgets starting from the specified widget meeting
+ * specified matcher condition.
+ *
+ * @param widget
+ * @param matcher
+ */
+ public WidgetFindingTask(Widget widget, Matcher<? extends Widget> matcher, WidgetVisitor visitor) {
+ super();
+ this.matcher = matcher;
+ this.parentWidget = widget;
+ this.visitor = visitor;
+ }
+
+ @Override
+ public void perform() {
+ syncExec(new VoidResult() {
+
+ @Override
+ public void run() {
+ findWidgetRecursive(getParentWidget(), new ArrayList<Widget>());
+ }
+ });
+ }
+
+ private void findWidgetRecursive(Widget widget, ArrayList<Widget> visited){
+
+ if (visited.contains(widget)){
+ return;
+ }
+
+ visited.add(widget);
+ visitWidget(widget);
+
+ if (widget instanceof Composite && ((Composite) widget).getChildren().length == 0){
+ return;
+ }
+
+ List<? extends Widget> children = getBot().widgets(getMatcher(), widget);
+ for (Widget child : children){
+ findWidgetRecursive(child, visited);
+ }
+ }
+
+ private void visitWidget(Widget widget){
+ new VisitableWidget(widget).accept(visitor);
+ }
+
+ public Matcher<? extends Widget> getMatcher() {
+ if (matcher == null){
+ matcher = widgetOfType(Widget.class);
+ }
+ return matcher;
+ }
+
+ private Widget getParentWidget() {
+ if (parentWidget == null){
+ parentWidget = getBot().activeShell().widget;
+ }
+ return parentWidget;
+ }
+}
Added: trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/task/finder/WidgetVisitor.java
===================================================================
--- trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/task/finder/WidgetVisitor.java (rev 0)
+++ trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/task/finder/WidgetVisitor.java 2012-01-04 11:28:50 UTC (rev 37635)
@@ -0,0 +1,15 @@
+package org.jboss.tools.portlet.ui.bot.task.finder;
+
+import org.eclipse.swt.widgets.Widget;
+
+/**
+ * Visitor for the {@link Widget} objects.
+ *
+ * @author Lucia Jelinkova
+ *
+ */
+public interface WidgetVisitor {
+
+ void visit(Widget widget);
+
+}
12 years, 12 months
JBoss Tools SVN: r37634 - trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2012-01-04 06:02:46 -0500 (Wed, 04 Jan 2012)
New Revision: 37634
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSEJBoss7BehaviourDelegate.java
trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSEJBoss7LaunchConfigurator.java
Log:
/JBIDE-10342 - patch to make remote shutdown NOT use management port, but only use ssh command, as previous versions did
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSEJBoss7BehaviourDelegate.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSEJBoss7BehaviourDelegate.java 2012-01-04 10:08:30 UTC (rev 37633)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSEJBoss7BehaviourDelegate.java 2012-01-04 11:02:46 UTC (rev 37634)
@@ -14,21 +14,36 @@
import java.text.MessageFormat;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Status;
+import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.wst.server.core.IServer;
import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
import org.jboss.ide.eclipse.as.core.Messages;
import org.jboss.ide.eclipse.as.core.server.v7.management.AS7ManagementDetails;
import org.jboss.ide.eclipse.as.core.server.v7.management.IJBoss7ManagerService;
import org.jboss.ide.eclipse.as.core.server.v7.management.JBoss7ManagerUtil;
+import org.jboss.ide.eclipse.as.core.util.ServerUtil;
public class RSEJBoss7BehaviourDelegate extends RSEBehaviourDelegate {
private IJBoss7ManagerService service;
@Override
+ protected String getShutdownCommand(IServer server) throws CoreException {
+ String defaultCommand = getDefaultStopArguments();
+ ILaunchConfiguration config = getServer().getLaunchConfiguration(false, new NullProgressMonitor());
+ return RSELaunchConfigProperties.getShutdownCommand(config, defaultCommand);
+ }
+
+ @Override
protected IStatus gracefullStop() {
+ return super.gracefullStop();
+ }
+
+ protected IStatus gracefullStopViaManagement() {
IServer server = getServer();
try {
getService().stop(new AS7ManagementDetails(server));
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSEJBoss7LaunchConfigurator.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSEJBoss7LaunchConfigurator.java 2012-01-04 10:08:30 UTC (rev 37633)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSEJBoss7LaunchConfigurator.java 2012-01-04 11:02:46 UTC (rev 37634)
@@ -11,6 +11,7 @@
package org.jboss.ide.eclipse.as.rse.core;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.wst.server.core.IServer;
@@ -42,8 +43,20 @@
if( detectStartupCommand || !isSet(currentStartupCmd)) {
RSELaunchConfigProperties.setStartupCommand(getLaunchCommand(jbossServer, jbossRuntime), launchConfig);
}
+
+ boolean detectShutdownCommand = RSELaunchConfigProperties.isDetectShutdownCommand(launchConfig, true);
+ String currentShutdownCmd = RSELaunchConfigProperties.getShutdownCommand(launchConfig);
+ if( detectShutdownCommand || !isSet(currentShutdownCmd)) {
+ RSELaunchConfigProperties.setShutdownCommand(getShutdownCommand(jbossServer, jbossRuntime), launchConfig);
+ }
}
+ protected String getShutdownCommand(JBossServer jbossServer, IJBossServerRuntime jbossRuntime) throws CoreException {
+ String rseHome = RSEUtils.getRSEHomeDir(jbossServer.getServer());
+ IPath p = new Path(rseHome).append(IJBossRuntimeResourceConstants.BIN);
+ return p.toString() + "/jboss-admin.sh --connect command=:shutdown";
+ }
+
protected String getLaunchCommand(JBossServer jbossServer, IJBossServerRuntime jbossRuntime) throws CoreException {
String programArguments = getDefaultProgramArguments(jbossServer, jbossRuntime);
String vmArguments = getDefaultVMArguments(jbossServer, jbossRuntime);
12 years, 12 months
JBoss Tools SVN: r37633 - trunk/openshift/plugins/org.jboss.tools.openshift.egit.core/META-INF.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2012-01-04 05:08:30 -0500 (Wed, 04 Jan 2012)
New Revision: 37633
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.egit.core/META-INF/MANIFEST.MF
Log:
[JBIDE-10547] set missing bundle name and bundle provider
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.egit.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.egit.core/META-INF/MANIFEST.MF 2012-01-04 10:04:17 UTC (rev 37632)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.egit.core/META-INF/MANIFEST.MF 2012-01-04 10:08:30 UTC (rev 37633)
@@ -1,6 +1,6 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
-Bundle-Name: Bundle-Name
+Bundle-Name: EGit Core
Bundle-SymbolicName: org.jboss.tools.openshift.egit.core;singleton:=true
Bundle-Version: 2.3.0.qualifier
Bundle-Activator: org.jboss.tools.openshift.egit.core.internal.EGitCoreActivator
@@ -15,7 +15,7 @@
org.eclipse.core.runtime;bundle-version="[3.7.0,4.0.0)"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
-Bundle-Vendor: Bundle-Vendor
+Bundle-Vendor: JBoss by Red Hat
Export-Package: org.jboss.tools.openshift.egit.core,
org.jboss.tools.openshift.egit.core.internal,
org.jboss.tools.openshift.egit.core.module
12 years, 12 months
JBoss Tools SVN: r37632 - trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2012-01-04 05:04:17 -0500 (Wed, 04 Jan 2012)
New Revision: 37632
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPage.java
Log:
[JBIDE-10578] fixed wording
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPage.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPage.java 2012-01-04 09:12:06 UTC (rev 37631)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPage.java 2012-01-04 10:04:17 UTC (rev 37632)
@@ -55,7 +55,7 @@
private CredentialsWizardPageModel model;
public CredentialsWizardPage(IWizard wizard, ImportProjectWizardModel wizardModel) {
- super("Server connection", "Please provide the credentails of your user account on OpenShift Express",
+ super("Server connection", "Please provide the credentials of your user account on OpenShift Express",
"Server Connection", wizard);
this.model = new CredentialsWizardPageModel(wizardModel);
}
@@ -64,7 +64,7 @@
GridLayoutFactory.fillDefaults().numColumns(3).margins(10, 10).applyTo(container);
Link signupLink = new Link(container, SWT.WRAP);
- signupLink.setText("If you dont have an account on OpenShift, please sign up <a>here</a>.");
+ signupLink.setText("If you don't have an account on OpenShift, please sign up <a>here</a>.");
GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).span(3, 1).hint(SWT.DEFAULT, 30).applyTo(signupLink);
signupLink.addSelectionListener(onSignupLinkClicked());
12 years, 12 months