Author: xcoulon
Date: 2012-05-21 16:09:02 -0400 (Mon, 21 May 2012)
New Revision: 41223
Added:
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JavaElementChangedBuildJob.java
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/MutexJobSchedulingRule.java
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/ResourceChangedBuildJob.java
Removed:
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JaxrsMetamodelBuildJob.java
Modified:
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JavaElementChangedListener.java
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JaxrsMetamodelBuilder.java
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/ResourceChangedProcessor.java
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/ResourceDelta.java
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsJavaElement.java
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsMetamodel.java
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/utils/Logger.java
trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JavaElementDeltaScannerTestCase.java
Log:
Fixed - JBIDE-11922
Add scheduling rules for JAX-RS jobs to avoid concurrent changes in the metamodel
Added:
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JavaElementChangedBuildJob.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JavaElementChangedBuildJob.java
(rev 0)
+++
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JavaElementChangedBuildJob.java 2012-05-21
20:09:02 UTC (rev 41223)
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * 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 static
org.jboss.tools.ws.jaxrs.core.internal.metamodel.builder.JaxrsMetamodelBuilder.SCALE;
+
+import java.util.List;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.SubProgressMonitor;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jdt.core.ElementChangedEvent;
+import org.jboss.tools.ws.jaxrs.core.internal.utils.Logger;
+import org.jboss.tools.ws.jaxrs.core.metamodel.JaxrsMetamodelDelta;
+
+/** @author xcoulon */
+public class JavaElementChangedBuildJob extends Job {
+
+ private final JavaElementChangedProcessor javaElementChangedProcessor = new
JavaElementChangedProcessor();
+
+ private final JaxrsMetamodelChangedProcessor jaxrsElementChangedProcessor = new
JaxrsMetamodelChangedProcessor();
+
+ private final ElementChangedEvent event;
+
+ public JavaElementChangedBuildJob(final ElementChangedEvent event) {
+ super("Incremental JAX-RS Metamodel build..."); //$NON-NLS-1$
+ this.event = event;
+ Logger.debug("Initiating an incremental JAX-RS Metamodel build after " +
event); //$NON-NLS-1$
+ }
+
+ @Override
+ protected IStatus run(final IProgressMonitor progressMonitor) {
+ try {
+ progressMonitor.beginTask("Building JAX-RS Metamodel", 4 * SCALE);
+ progressMonitor.worked(SCALE);
+ Logger.debug("Building JAX-RS Metamodel...");
+ if (progressMonitor.isCanceled()) {
+ return Status.CANCEL_STATUS;
+ }
+ // scan and filter delta, retrieve a list of java changes
+ final List<JavaElementDelta> affectedJavaElements = new
JavaElementDeltaScanner().scanAndFilterEvent(event,
+ new SubProgressMonitor(progressMonitor, SCALE));
+ if (progressMonitor.isCanceled()) {
+ return Status.CANCEL_STATUS;
+ }
+ final List<JaxrsMetamodelDelta> affectedMetamodels =
javaElementChangedProcessor.processAffectedJavaElements(affectedJavaElements,
+ new SubProgressMonitor(progressMonitor, SCALE));
+ if (progressMonitor.isCanceled()) {
+ return Status.CANCEL_STATUS;
+ }
+ jaxrsElementChangedProcessor.processAffectedMetamodels(affectedMetamodels, new
SubProgressMonitor(
+ progressMonitor, SCALE));
+ if (progressMonitor.isCanceled()) {
+ return Status.CANCEL_STATUS;
+ }
+ new JaxrsElementChangedPublisher().publish(affectedMetamodels, new
SubProgressMonitor(progressMonitor,
+ SCALE));
+ } catch (Throwable e) {
+ Logger.error("Failed to build or refresh the JAX-RS metamodel", e);
+ } finally {
+ progressMonitor.done();
+ }
+ return Status.OK_STATUS;
+ }
+}
Property changes on:
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JavaElementChangedBuildJob.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified:
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JavaElementChangedListener.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JavaElementChangedListener.java 2012-05-21
20:06:53 UTC (rev 41222)
+++
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JavaElementChangedListener.java 2012-05-21
20:09:02 UTC (rev 41223)
@@ -46,7 +46,8 @@
try {
if (isApplicable(event.getDelta())) {
logDelta(event.getDelta(), event.getType());
- Job job = new JaxrsMetamodelBuildJob(event);
+ Job job = new JavaElementChangedBuildJob(event);
+ job.setRule(MutexJobSchedulingRule.getInstance());
job.schedule();
}
} catch (CoreException e) {
Deleted:
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JaxrsMetamodelBuildJob.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JaxrsMetamodelBuildJob.java 2012-05-21
20:06:53 UTC (rev 41222)
+++
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JaxrsMetamodelBuildJob.java 2012-05-21
20:09:02 UTC (rev 41223)
@@ -1,76 +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 static
org.jboss.tools.ws.jaxrs.core.internal.metamodel.builder.JaxrsMetamodelBuilder.SCALE;
-
-import java.util.List;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jdt.core.ElementChangedEvent;
-import org.jboss.tools.ws.jaxrs.core.internal.utils.Logger;
-import org.jboss.tools.ws.jaxrs.core.metamodel.JaxrsMetamodelDelta;
-
-/** @author xcoulon */
-public class JaxrsMetamodelBuildJob extends Job {
-
- private final JavaElementChangedProcessor javaElementChangedProcessor = new
JavaElementChangedProcessor();
-
- private final JaxrsMetamodelChangedProcessor jaxrsElementChangedProcessor = new
JaxrsMetamodelChangedProcessor();
-
- private final ElementChangedEvent event;
-
- public JaxrsMetamodelBuildJob(final ElementChangedEvent event) {
- super("Incremental JAX-RS Metamodel build..."); //$NON-NLS-1$
- this.event = event;
- Logger.debug("Initiating an incremental JAX-RS Metamodel build after " +
event); //$NON-NLS-1$
- }
-
- @Override
- protected IStatus run(final IProgressMonitor progressMonitor) {
- try {
- progressMonitor.beginTask("Building JAX-RS Metamodel", 4 * SCALE);
- progressMonitor.worked(SCALE);
- Logger.debug("Building JAX-RS Metamodel...");
- if (progressMonitor.isCanceled()) {
- return Status.CANCEL_STATUS;
- }
- // scan and filter delta, retrieve a list of java changes
- final List<JavaElementDelta> affectedJavaElements = new
JavaElementDeltaScanner().scanAndFilterEvent(event,
- new SubProgressMonitor(progressMonitor, SCALE));
- if (progressMonitor.isCanceled()) {
- return Status.CANCEL_STATUS;
- }
- final List<JaxrsMetamodelDelta> affectedMetamodels =
javaElementChangedProcessor.processAffectedJavaElements(affectedJavaElements,
- new SubProgressMonitor(progressMonitor, SCALE));
- if (progressMonitor.isCanceled()) {
- return Status.CANCEL_STATUS;
- }
- jaxrsElementChangedProcessor.processAffectedMetamodels(affectedMetamodels, new
SubProgressMonitor(
- progressMonitor, SCALE));
- if (progressMonitor.isCanceled()) {
- return Status.CANCEL_STATUS;
- }
- new JaxrsElementChangedPublisher().publish(affectedMetamodels, new
SubProgressMonitor(progressMonitor,
- SCALE));
-
- } catch (Throwable e) {
- Logger.error("Failed to build or refresh the JAX-RS metamodel", e);
- } finally {
- progressMonitor.done();
- }
- return Status.OK_STATUS;
- }
-}
Modified:
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JaxrsMetamodelBuilder.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JaxrsMetamodelBuilder.java 2012-05-21
20:06:53 UTC (rev 41222)
+++
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JaxrsMetamodelBuilder.java 2012-05-21
20:09:02 UTC (rev 41223)
@@ -11,28 +11,20 @@
package org.jboss.tools.ws.jaxrs.core.internal.metamodel.builder;
-import static org.eclipse.jdt.core.IJavaElementDelta.CHANGED;
-
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
import java.util.Map;
+import org.eclipse.core.internal.events.ResourceChangeEvent;
import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResourceDelta;
+import org.eclipse.core.resources.IResourceChangeEvent;
import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.QualifiedName;
-import org.eclipse.core.runtime.SubProgressMonitor;
import org.jboss.tools.ws.jaxrs.core.JBossJaxrsCorePlugin;
import org.jboss.tools.ws.jaxrs.core.configuration.ProjectNatureUtils;
-import org.jboss.tools.ws.jaxrs.core.internal.metamodel.domain.JaxrsMetamodel;
import org.jboss.tools.ws.jaxrs.core.internal.utils.ConstantUtils;
import org.jboss.tools.ws.jaxrs.core.internal.utils.Logger;
-import org.jboss.tools.ws.jaxrs.core.metamodel.JaxrsMetamodelDelta;
-import org.jboss.tools.ws.jaxrs.core.metamodel.JaxrsMetamodelLocator;
/**
* The JAX-RS Metamodel builder. Invoked when a full build or an incremental build is
triggered on a project on which
@@ -43,6 +35,7 @@
*
* @author xcoulon
*/
+@SuppressWarnings("restriction")
public class JaxrsMetamodelBuilder extends IncrementalProjectBuilder {
public static final int SCALE = 10;
@@ -57,12 +50,6 @@
public static final QualifiedName JAXRS_ELEMENT_CHANGE_LISTENER_NAME = new
QualifiedName(
JBossJaxrsCorePlugin.PLUGIN_ID, "jaxrsPostReconcileListener");
- private final JaxrsElementChangedPublisher metamodelChangedPublisher = new
JaxrsElementChangedPublisher();
-
- private final JaxrsMetamodelChangedProcessor metamodelChangedProcessor = new
JaxrsMetamodelChangedProcessor();
-
- private final ResourceChangedProcessor resourceChangedProcessor = new
ResourceChangedProcessor();
-
// TODO : add support for cancellation
// TODO : report build failed
/** {@inheritDoc} */
@@ -109,54 +96,33 @@
* the progress monitor
*/
private void build(final int buildKind, final IProject project, final IProgressMonitor
progressMonitor) {
- long startTime = new Date().getTime();
+ /*
+ * progressMonitor.beginTask("Building JAX-RS Metamodel", 4 * SCALE);
+ * Logger.debug("Building JAX-RS Metamodel for project {}...",
project.getName()); // extract the relevant delta
+ * bound to this built (some resources or entire project) final
List<ResourceDelta> affectedResources =
+ * extractAffectedResources(project, progressMonitor); progressMonitor.worked(SCALE);
// compute changes on the
+ * JAX-RS Application(s), HttpMethods, Resources, etc. final boolean withReset =
(buildKind == FULL_BUILD ||
+ * buildKind == CLEAN_BUILD); final JaxrsMetamodelDelta metamodelDelta =
resourceChangedProcessor
+ * .processAffectedResources(project, withReset, affectedResources, new
SubProgressMonitor(progressMonitor,
+ * SCALE)); progressMonitor.worked(SCALE); new
+ * JaxrsMetamodelChangedProcessor().processAffectedMetamodel(metamodelDelta, new
+ * SubProgressMonitor(progressMonitor, SCALE)); progressMonitor.worked(SCALE); new
+ * JaxrsElementChangedPublisher().publish(metamodelDelta, new
SubProgressMonitor(progressMonitor, SCALE));
+ * progressMonitor.worked(SCALE);
+ */
+ ResourceChangedBuildJob job = new ResourceChangedBuildJob(project,
getResourceChangeEvent(project, buildKind));
+ job.setRule(MutexJobSchedulingRule.getInstance());
+ job.schedule();
try {
- progressMonitor.beginTask("Building JAX-RS Metamodel", 4 * SCALE);
- Logger.debug("Building JAX-RS Metamodel for project {}...",
project.getName());
- // extract the relevant delta bound to this built (some resources or entire project)
- final List<ResourceDelta> affectedResources = extractAffectedResources(project,
progressMonitor);
- progressMonitor.worked(SCALE);
- // compute changes on the JAX-RS Application(s), HttpMethods, Resources, etc.
- final boolean withReset = (buildKind == FULL_BUILD || buildKind == CLEAN_BUILD);
- final JaxrsMetamodelDelta metamodelDelta = resourceChangedProcessor
- .processAffectedResources(project, withReset, affectedResources, new
SubProgressMonitor(progressMonitor, SCALE));
- progressMonitor.worked(SCALE);
- metamodelChangedProcessor.processAffectedMetamodel(metamodelDelta, new
SubProgressMonitor(progressMonitor,
- SCALE));
- progressMonitor.worked(SCALE);
- metamodelChangedPublisher.publish(metamodelDelta, new
SubProgressMonitor(progressMonitor, SCALE));
- progressMonitor.worked(SCALE);
- } catch (CoreException e) {
- Logger.error("Error while building the JAX-RS Metamodel for project " +
project.getName(), e);
- } finally {
- long endTime = new Date().getTime();
- Logger.debug("JAX-RS Metamodel for project '{}' fully built in {}
ms.", project.getName(),
- (endTime - startTime));
- try {
- final JaxrsMetamodel metamodel = JaxrsMetamodelLocator.get(project);
- Logger.debug(
- "JAX-RS Metamodel for project '{}' now has {} HttpMethods, {}
Resources and {} Endpoints.",
- project.getName(), metamodel.getAllHttpMethods().size(),
metamodel.getAllResources().size(),
- metamodel.getAllEndpoints().size());
- } catch (Throwable e) {
- // debug level since the purpose was to display a debug message
- Logger.debug("Error occurred: {}", e);
- }
- progressMonitor.done();
+ job.join();
+ } catch (InterruptedException e) {
+ Logger.warn("JAX-RS Metamodel build job was interrupted", e);
}
+
}
- private List<ResourceDelta> extractAffectedResources(final IProject project, final
IProgressMonitor progressMonitor)
- throws CoreException {
- final IResourceDelta delta = getDelta(project);
- final List<ResourceDelta> events = new ArrayList<ResourceDelta>();
- if (delta != null) {
- events.addAll(new ResourceDeltaScanner().scanAndFilterEvent(delta, new
SubProgressMonitor(
- progressMonitor, SCALE)));
- } else {
- events.add(new ResourceDelta(project, CHANGED, 0));
- }
- return events;
+ private ResourceChangeEvent getResourceChangeEvent(final IProject project, final int
buildKind) {
+ return new ResourceChangeEvent(project, IResourceChangeEvent.POST_CHANGE, buildKind,
getDelta(project));
}
/**
Added:
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/MutexJobSchedulingRule.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/MutexJobSchedulingRule.java
(rev 0)
+++
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/MutexJobSchedulingRule.java 2012-05-21
20:09:02 UTC (rev 41223)
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.ws.jaxrs.core.internal.metamodel.builder;
+
+import org.eclipse.core.runtime.jobs.ISchedulingRule;
+
+/**
+ * @author Xavier Coulon
+ *
+ */
+public class MutexJobSchedulingRule implements ISchedulingRule {
+
+ private final static MutexJobSchedulingRule instance = new MutexJobSchedulingRule();
+
+ /**
+ * Private singleton constructor
+ */
+ private MutexJobSchedulingRule() {
+ super();
+ }
+
+ public static MutexJobSchedulingRule getInstance() {
+ return instance;
+ }
+
+ @Override
+ public boolean contains(ISchedulingRule rule) {
+ return rule == this;
+ }
+
+ @Override
+ public boolean isConflicting(ISchedulingRule rule) {
+ return rule == this;
+ }
+
+}
Property changes on:
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/MutexJobSchedulingRule.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Copied:
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/ResourceChangedBuildJob.java
(from rev 40511,
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JaxrsMetamodelBuildJob.java)
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/ResourceChangedBuildJob.java
(rev 0)
+++
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/ResourceChangedBuildJob.java 2012-05-21
20:09:02 UTC (rev 41223)
@@ -0,0 +1,115 @@
+/*******************************************************************************
+ * 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 static org.eclipse.jdt.core.IJavaElementDelta.CHANGED;
+import static
org.jboss.tools.ws.jaxrs.core.internal.metamodel.builder.JaxrsMetamodelBuilder.SCALE;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResourceChangeEvent;
+import org.eclipse.core.resources.IResourceDelta;
+import org.eclipse.core.resources.IncrementalProjectBuilder;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.SubProgressMonitor;
+import org.eclipse.core.runtime.jobs.Job;
+import org.jboss.tools.ws.jaxrs.core.internal.metamodel.domain.JaxrsMetamodel;
+import org.jboss.tools.ws.jaxrs.core.internal.utils.Logger;
+import org.jboss.tools.ws.jaxrs.core.metamodel.JaxrsMetamodelDelta;
+import org.jboss.tools.ws.jaxrs.core.metamodel.JaxrsMetamodelLocator;
+
+/** @author xcoulon */
+public class ResourceChangedBuildJob extends Job {
+
+ private final IResourceChangeEvent event;
+
+ private final IProject project;
+
+ public ResourceChangedBuildJob(final IProject project, final IResourceChangeEvent event)
{
+ super("Incremental JAX-RS Metamodel build..."); //$NON-NLS-1$
+ this.event = event;
+ this.project = project;
+ Logger.debug("Initiating an incremental JAX-RS Metamodel build after " +
event); //$NON-NLS-1$
+ }
+
+ @Override
+ protected IStatus run(final IProgressMonitor progressMonitor) {
+ long startTime = new Date().getTime();
+ try {
+ progressMonitor.beginTask("Building JAX-RS Metamodel", 4 * SCALE);
+ Logger.debug("Building JAX-RS Metamodel...");
+ if (progressMonitor.isCanceled()) {
+ return Status.CANCEL_STATUS;
+ }
+ // extract the relevant delta bound to this built (some resources or entire project)
+ final List<ResourceDelta> affectedResources =
extractAffectedResources(event.getDelta(), progressMonitor);
+ progressMonitor.worked(SCALE);
+ if (progressMonitor.isCanceled()) {
+ return Status.CANCEL_STATUS;
+ }
+
+ // compute changes on the JAX-RS Application(s), HttpMethods, Resources, etc.
+ final boolean withReset = (event.getBuildKind() ==
IncrementalProjectBuilder.FULL_BUILD || event.getBuildKind() ==
IncrementalProjectBuilder.CLEAN_BUILD);
+ final JaxrsMetamodelDelta metamodelDelta = new
ResourceChangedProcessor().processAffectedResources(project,
+ withReset, affectedResources, new SubProgressMonitor(progressMonitor, SCALE));
+ progressMonitor.worked(SCALE);
+ if (progressMonitor.isCanceled()) {
+ return Status.CANCEL_STATUS;
+ }
+ new JaxrsMetamodelChangedProcessor().processAffectedMetamodel(metamodelDelta, new
SubProgressMonitor(
+ progressMonitor, SCALE));
+ progressMonitor.worked(SCALE);
+ if (progressMonitor.isCanceled()) {
+ return Status.CANCEL_STATUS;
+ }
+ new JaxrsElementChangedPublisher().publish(metamodelDelta, new
SubProgressMonitor(progressMonitor, SCALE));
+ progressMonitor.worked(SCALE);
+
+ } catch (Throwable e) {
+ Logger.error("Failed to build or refresh the JAX-RS metamodel for projet " +
project.getName(), e);
+ } finally {
+ long endTime = new Date().getTime();
+ if (Logger.isDebugEnabled()) {
+ Logger.debug("JAX-RS Metamodel fully built in {} ms.", project.getName(),
(endTime - startTime));
+ try {
+ final JaxrsMetamodel metamodel = JaxrsMetamodelLocator.get(project);
+ Logger.debug(
+ "JAX-RS Metamodel for project '{}' now has {} HttpMethods, {}
Resources and {} Endpoints.",
+ project.getName(), metamodel.getAllHttpMethods().size(),
+ metamodel.getAllResources().size(), metamodel.getAllEndpoints().size());
+ } catch (Throwable e) {
+ // debug level since the purpose was to display a debug message
+ Logger.debug("Error occurred: {}", e);
+ }
+ }
+ progressMonitor.done();
+ }
+ return Status.OK_STATUS;
+ }
+
+ private List<ResourceDelta> extractAffectedResources(final IResourceDelta delta,
final IProgressMonitor progressMonitor)
+ throws CoreException {
+ final List<ResourceDelta> events = new ArrayList<ResourceDelta>();
+ if (delta != null) {
+ events.addAll(new ResourceDeltaScanner().scanAndFilterEvent(delta, new
SubProgressMonitor(progressMonitor,
+ SCALE)));
+ } else {
+ events.add(new ResourceDelta(project, CHANGED, 0));
+ }
+ return events;
+ }
+}
Property changes on:
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/ResourceChangedBuildJob.java
___________________________________________________________________
Added: svn:executable
+ *
Added: svn:mime-type
+ text/plain
Modified:
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/ResourceChangedProcessor.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/ResourceChangedProcessor.java 2012-05-21
20:06:53 UTC (rev 41222)
+++
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/ResourceChangedProcessor.java 2012-05-21
20:09:02 UTC (rev 41223)
@@ -31,7 +31,6 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.ITypeHierarchy;
import org.eclipse.jdt.core.JavaCore;
Modified:
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/ResourceDelta.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/ResourceDelta.java 2012-05-21
20:06:53 UTC (rev 41222)
+++
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/ResourceDelta.java 2012-05-21
20:09:02 UTC (rev 41223)
@@ -116,7 +116,7 @@
int result = 1;
result = prime * result + deltaKind;
result = prime * result + ((resource == null) ? 0 : resource.hashCode());
- result = prime * result + flags;
+ //result = prime * result + flags;
return result;
}
@@ -153,9 +153,9 @@
* if (compilationUnitAST == null) if (other.compilationUnitAST != null)
* return false;
*/
- if (flags != other.flags) {
+ /*if (flags != other.flags) {
return false;
- }
+ }*/
return true;
}
}
Modified:
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsJavaElement.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsJavaElement.java 2012-05-21
20:06:53 UTC (rev 41222)
+++
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsJavaElement.java 2012-05-21
20:09:02 UTC (rev 41223)
@@ -41,13 +41,9 @@
import javax.ws.rs.QueryParam;
import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jdt.core.IMember;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.dom.CompilationUnit;
import org.jboss.tools.ws.jaxrs.core.internal.utils.CollectionUtils;
import org.jboss.tools.ws.jaxrs.core.jdt.Annotation;
-import org.jboss.tools.ws.jaxrs.core.jdt.JdtUtils;
import org.jboss.tools.ws.jaxrs.core.metamodel.EnumKind;
import org.jboss.tools.ws.jaxrs.core.metamodel.IJaxrsHttpMethod;
Modified:
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsMetamodel.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsMetamodel.java 2012-05-21
20:06:53 UTC (rev 41222)
+++
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsMetamodel.java 2012-05-21
20:09:02 UTC (rev 41223)
@@ -503,7 +503,7 @@
return false;
} else if (javaProject != null && other.javaProject == null) {
return false;
- } else if
(!javaProject.getHandleIdentifier().equals(other.javaProject.getHandleIdentifier())) {
+ } else if (javaProject != null && other.javaProject != null &&
!javaProject.getHandleIdentifier().equals(other.javaProject.getHandleIdentifier())) {
return false;
}
return true;
Modified:
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/utils/Logger.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/utils/Logger.java 2012-05-21
20:06:53 UTC (rev 41222)
+++
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/utils/Logger.java 2012-05-21
20:09:02 UTC (rev 41223)
@@ -184,4 +184,8 @@
return JBossJaxrsCorePlugin.getDefault() != null &&
JBossJaxrsCorePlugin.getDefault().isDebugging()
&& "true".equalsIgnoreCase(debugOption);
}
+
+ public static boolean isDebugEnabled() {
+ return isOptionEnabled(DEBUG);
+ }
}
Modified:
trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JavaElementDeltaScannerTestCase.java
===================================================================
---
trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JavaElementDeltaScannerTestCase.java 2012-05-21
20:06:53 UTC (rev 41222)
+++
trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JavaElementDeltaScannerTestCase.java 2012-05-21
20:09:02 UTC (rev 41223)
@@ -196,14 +196,14 @@
}
@Test
- public void shouldNotNotifyWhenCompilationUnitChangedInPrimaryCopy() throws
CoreException {
+ public void shouldNotifyWhenCompilationUnitChangedInPrimaryCopy() throws CoreException
{
// pre-condition
ICompilationUnit compilationUnit = JdtUtils.resolveType(
"org.jboss.tools.ws.jaxrs.sample.services.CustomerResource", javaProject,
null).getCompilationUnit();
// operation
WorkbenchUtils.appendCompilationUnitType(compilationUnit,
"FooBarHTTPMethodMember.txt", bundle, PRIMARY_COPY);
// verifications
- verifyEventNotification(compilationUnit.getResource(), CHANGED, POST_CHANGE, NO_FLAG,
never());
+ verifyEventNotification(compilationUnit.getResource(), CHANGED, POST_CHANGE, NO_FLAG,
atLeastOnce());
}
@Test
@@ -212,7 +212,7 @@
ICompilationUnit compilationUnit = WorkbenchUtils.createCompilationUnit(javaProject,
"FooResource.txt",
"org.jboss.tools.ws.jaxrs.sample.services", "FooResource.java",
bundle);
// verifications: 1 times
- verifyEventNotification(compilationUnit.getResource(), CHANGED, POST_CHANGE, CONTENT,
times(1));
+ verifyEventNotification(compilationUnit.getResource(), CHANGED, POST_CHANGE, CONTENT,
atLeastOnce());
}
@Test
@@ -278,7 +278,7 @@
IType addedType = WorkbenchUtils.appendCompilationUnitType(compilationUnit,
"FooResourceMember.txt", bundle,
PRIMARY_COPY);
// verifications: one call PostReconcile + one call on PostChange
- verifyEventNotification(addedType.getResource(), CHANGED, POST_CHANGE, CONTENT,
times(1));
+ verifyEventNotification(addedType.getResource(), CHANGED, POST_CHANGE, CONTENT,
atLeastOnce());
}
@Test
@@ -328,7 +328,7 @@
WorkbenchUtils.replaceAllOccurrencesOfCode(compilationUnit,
"ExceptionMapper<>",
"ExceptionMapper<FooException>", PRIMARY_COPY);
// verifications
- verifyEventNotification(compilationUnit.getResource(), CHANGED, POST_CHANGE, CONTENT,
times(1));
+ verifyEventNotification(compilationUnit.getResource(), CHANGED, POST_CHANGE, CONTENT,
atLeastOnce());
}
@Test
@@ -352,7 +352,7 @@
type = WorkbenchUtils.replaceFirstOccurrenceOfCode(type, "implements",
"implements Serializable, ",
PRIMARY_COPY);
// verifications
- verifyEventNotification(type.getResource(), CHANGED, POST_CHANGE, CONTENT, times(1));
+ verifyEventNotification(type.getResource(), CHANGED, POST_CHANGE, CONTENT,
atLeastOnce());
}
@Test
@@ -376,7 +376,7 @@
type = WorkbenchUtils.replaceFirstOccurrenceOfCode(type, "implements
ExceptionMapper<EntityNotFoundException>",
"", PRIMARY_COPY);
// verifications
- verifyEventNotification(type.getResource(), CHANGED, POST_CHANGE, CONTENT, times(1));
+ verifyEventNotification(type.getResource(), CHANGED, POST_CHANGE, CONTENT,
atLeastOnce());
}
@Test
@@ -400,7 +400,7 @@
type = WorkbenchUtils.replaceFirstOccurrenceOfCode(type, "implements",
"extends Object implements",
PRIMARY_COPY);
// verifications
- verifyEventNotification(type.getResource(), CHANGED, POST_CHANGE, CONTENT, times(1));
+ verifyEventNotification(type.getResource(), CHANGED, POST_CHANGE, CONTENT,
atLeastOnce());
}
@Test
@@ -420,7 +420,7 @@
// operation
type = WorkbenchUtils.replaceFirstOccurrenceOfCode(type, "extends Product",
"", PRIMARY_COPY);
// verifications
- verifyEventNotification(type.getResource(), CHANGED, POST_CHANGE, CONTENT, times(1));
+ verifyEventNotification(type.getResource(), CHANGED, POST_CHANGE, CONTENT,
atLeastOnce());
}
@Test
@@ -448,7 +448,7 @@
WorkbenchUtils.replaceAllOccurrencesOfCode(compilationUnit,
"<PersistenceException>", "<FooException>",
PRIMARY_COPY);
// verifications
- verifyEventNotification(compilationUnit.getResource(), CHANGED, POST_CHANGE, CONTENT,
times(1));
+ verifyEventNotification(compilationUnit.getResource(), CHANGED, POST_CHANGE, CONTENT,
atLeastOnce());
}
@Test
@@ -474,7 +474,7 @@
LOGGER.info("Performing Test Operation(s)...");
WorkbenchUtils.replaceAllOccurrencesOfCode(compilationUnit,
"<PersistenceException>", "<>", PRIMARY_COPY);
// verifications
- verifyEventNotification(compilationUnit.getResource(), CHANGED, POST_CHANGE, CONTENT,
times(1));
+ verifyEventNotification(compilationUnit.getResource(), CHANGED, POST_CHANGE, CONTENT,
atLeastOnce());
}
@Test
@@ -497,7 +497,7 @@
// operation
WorkbenchUtils.addTypeAnnotation(type, "import
javax.ws.rs.Consumes;\n@Consumes(\"foo/bar\")", PRIMARY_COPY);
// verifications
- verifyEventNotification(type.getResource(), CHANGED, POST_CHANGE, CONTENT, times(1));
+ verifyEventNotification(type.getResource(), CHANGED, POST_CHANGE, CONTENT,
atLeastOnce());
}
@Test
@@ -522,7 +522,7 @@
type = WorkbenchUtils.replaceFirstOccurrenceOfCode(type,
"(a)Path(CustomerResource.URI_BASE)", "@Path(\"/foo\")",
PRIMARY_COPY);
// verifications
- verifyEventNotification(type.getResource(), CHANGED, POST_CHANGE, CONTENT, times(1));
+ verifyEventNotification(type.getResource(), CHANGED, POST_CHANGE, CONTENT,
atLeastOnce());
}
@Test
@@ -545,7 +545,7 @@
// operation
WorkbenchUtils.removeFirstOccurrenceOfCode(type,
"(a)Path(CustomerResource.URI_BASE)", PRIMARY_COPY);
// verifications
- verifyEventNotification(type.getResource(), CHANGED, POST_CHANGE, CONTENT, times(1));
+ verifyEventNotification(type.getResource(), CHANGED, POST_CHANGE, CONTENT,
atLeastOnce());
}
@Test
@@ -596,7 +596,7 @@
// operation
WorkbenchUtils.createField(type, "private int i", PRIMARY_COPY);
// verifications
- verifyEventNotification(type.getResource(), CHANGED, POST_CHANGE, CONTENT, times(1));
+ verifyEventNotification(type.getResource(), CHANGED, POST_CHANGE, CONTENT,
atLeastOnce());
}
@Test
@@ -618,7 +618,7 @@
// operation
IField addedField = WorkbenchUtils.createField(type, "@PathParam() private int
i", PRIMARY_COPY);
// verifications
- verifyEventNotification(addedField.getResource(), CHANGED, POST_CHANGE, CONTENT,
times(1));
+ verifyEventNotification(addedField.getResource(), CHANGED, POST_CHANGE, CONTENT,
atLeastOnce());
}
@Test
@@ -643,7 +643,7 @@
// operation
WorkbenchUtils.replaceAllOccurrencesOfCode(type.getCompilationUnit(),
"entityManager", "em", PRIMARY_COPY);
// verifications
- verifyEventNotification(type.getResource(), CHANGED, POST_CHANGE, CONTENT, times(1));
+ verifyEventNotification(type.getResource(), CHANGED, POST_CHANGE, CONTENT,
atLeastOnce());
}
@Test
@@ -668,7 +668,7 @@
WorkbenchUtils.replaceAllOccurrencesOfCode(type.getCompilationUnit(), "private
EntityManager",
"private HibernateEntityManager", PRIMARY_COPY);
// verifications
- verifyEventNotification(type.getResource(), CHANGED, POST_CHANGE, CONTENT, times(1));
+ verifyEventNotification(type.getResource(), CHANGED, POST_CHANGE, CONTENT,
atLeastOnce());
}
@Test
@@ -692,7 +692,7 @@
// operation
WorkbenchUtils.removeField(field, PRIMARY_COPY);
// verifications
- verifyEventNotification(type.getResource(), CHANGED, POST_CHANGE, CONTENT, times(1));
+ verifyEventNotification(type.getResource(), CHANGED, POST_CHANGE, CONTENT,
atLeastOnce());
}
@Test
@@ -716,7 +716,7 @@
// operation
WorkbenchUtils.addFieldAnnotation(field, "@PathParam()", PRIMARY_COPY);
// verifications
- verifyEventNotification(type.getResource(), CHANGED, POST_CHANGE, CONTENT, times(1));
+ verifyEventNotification(type.getResource(), CHANGED, POST_CHANGE, CONTENT,
atLeastOnce());
}
@Test
@@ -744,7 +744,7 @@
"@PersistenceContext(value=\"foo\")", PRIMARY_COPY);
// verifications
IAnnotation annotation = field.getAnnotation("PersistenceContext");
- verifyEventNotification(annotation.getResource(), CHANGED, POST_CHANGE, CONTENT,
times(1));
+ verifyEventNotification(annotation.getResource(), CHANGED, POST_CHANGE, CONTENT,
atLeastOnce());
}
@Test
@@ -770,7 +770,7 @@
// operation
WorkbenchUtils.removeFieldAnnotation(field, "@PersistenceContext",
PRIMARY_COPY);
// verifications
- verifyEventNotification(annotation.getResource(), CHANGED, POST_CHANGE, CONTENT,
times(1));
+ verifyEventNotification(annotation.getResource(), CHANGED, POST_CHANGE, CONTENT,
atLeastOnce());
}
@Test
@@ -794,7 +794,7 @@
IMethod addedMethod = WorkbenchUtils.createMethod(type, "public Object
fooLocator() { return null; }",
PRIMARY_COPY);
// verifications
- verifyEventNotification(addedMethod.getResource(), CHANGED, POST_CHANGE, CONTENT,
times(1));
+ verifyEventNotification(addedMethod.getResource(), CHANGED, POST_CHANGE, CONTENT,
atLeastOnce());
}
@Test
@@ -816,7 +816,7 @@
// operation
IMethod method = WorkbenchUtils.removeMethod(type.getCompilationUnit(),
"createCustomer", PRIMARY_COPY);
// verifications
- verifyEventNotification(method.getResource(), CHANGED, POST_CHANGE, CONTENT,
times(1));
+ verifyEventNotification(method.getResource(), CHANGED, POST_CHANGE, CONTENT,
atLeastOnce());
}
@Test
@@ -843,8 +843,8 @@
PRIMARY_COPY);
// verifications
IMethod newMethod = WorkbenchUtils.getMethod(type, "getEM");
- verifyEventNotification(oldMethod.getResource(), CHANGED, POST_CHANGE, CONTENT,
times(1));
- verifyEventNotification(newMethod.getResource(), CHANGED, POST_CHANGE, CONTENT,
times(1));
+ verifyEventNotification(oldMethod.getResource(), CHANGED, POST_CHANGE, CONTENT,
atLeastOnce());
+ verifyEventNotification(newMethod.getResource(), CHANGED, POST_CHANGE, CONTENT,
atLeastOnce());
}
@Test
@@ -869,7 +869,7 @@
// operation
WorkbenchUtils.addMethodParameter(oldMethod, "int i", PRIMARY_COPY);
// verifications
- verifyEventNotification(type.getResource(), CHANGED, POST_CHANGE, CONTENT, times(1));
+ verifyEventNotification(type.getResource(), CHANGED, POST_CHANGE, CONTENT,
atLeastOnce());
}
@Test
@@ -897,7 +897,7 @@
// verifications
// 1 invocation for both the old method removal and the new method
// addition
- verifyEventNotification(oldMethod.getResource(), CHANGED, POST_CHANGE, CONTENT,
times(1));
+ verifyEventNotification(oldMethod.getResource(), CHANGED, POST_CHANGE, CONTENT,
atLeastOnce());
}
@Test
@@ -954,7 +954,7 @@
"@PathParam(\"id\") Integer id, @Context UriInfo uriInfo",
"@Context UriInfo uriInfo, @PathParam(\"id\") Integer id",
PRIMARY_COPY);
// verifications
- verifyEventNotification(oldMethod.getResource(), CHANGED, POST_CHANGE, CONTENT,
times(1));
+ verifyEventNotification(oldMethod.getResource(), CHANGED, POST_CHANGE, CONTENT,
atLeastOnce());
}
@Test
@@ -987,7 +987,7 @@
PRIMARY_COPY);
LOGGER.info("Method signature: " + newMethod.getSignature());
// verifications
- verifyEventNotification(oldMethod.getResource(), CHANGED, POST_CHANGE, CONTENT,
times(1));
+ verifyEventNotification(oldMethod.getResource(), CHANGED, POST_CHANGE, CONTENT,
atLeastOnce());
}
@Test
@@ -1015,7 +1015,7 @@
method = WorkbenchUtils.replaceFirstOccurrenceOfCode(method, "Customer
customer",
"@PathParam(\"id\") Customer customer", PRIMARY_COPY);
// verifications
- verifyEventNotification(method.getResource(), CHANGED, POST_CHANGE, CONTENT,
times(1));
+ verifyEventNotification(method.getResource(), CHANGED, POST_CHANGE, CONTENT,
atLeastOnce());
}
@Test
@@ -1043,7 +1043,7 @@
method = WorkbenchUtils.replaceFirstOccurrenceOfCode(method,
"@PathParam(\"id\")", "@PathParam(\"bar\")",
PRIMARY_COPY);
// verifications
- verifyEventNotification(method.getResource(), CHANGED, POST_CHANGE, CONTENT,
times(1));
+ verifyEventNotification(method.getResource(), CHANGED, POST_CHANGE, CONTENT,
atLeastOnce());
}
@Test
@@ -1071,7 +1071,7 @@
method = WorkbenchUtils.replaceFirstOccurrenceOfCode(method,
"@PathParam(\"id\") Integer id", "Integer id",
PRIMARY_COPY);
// verifications
- verifyEventNotification(method.getResource(), CHANGED, POST_CHANGE, CONTENT,
times(1));
+ verifyEventNotification(method.getResource(), CHANGED, POST_CHANGE, CONTENT,
atLeastOnce());
}
@Test
@@ -1095,7 +1095,7 @@
// operation
WorkbenchUtils.addMethodAnnotation(method, "@Path(\"/foo\")",
PRIMARY_COPY);
// verifications
- verifyEventNotification(method.getResource(), CHANGED, POST_CHANGE, CONTENT,
times(1));
+ verifyEventNotification(method.getResource(), CHANGED, POST_CHANGE, CONTENT,
atLeastOnce());
}
@Test
@@ -1123,7 +1123,7 @@
method = WorkbenchUtils.replaceFirstOccurrenceOfCode(method,
"@Path(\"{id}\")", "@Path(\"{foo}\")",
PRIMARY_COPY);
// verifications
- verifyEventNotification(annotation.getResource(), CHANGED, POST_CHANGE, CONTENT,
times(1));
+ verifyEventNotification(annotation.getResource(), CHANGED, POST_CHANGE, CONTENT,
atLeastOnce());
}
@Test
@@ -1149,7 +1149,7 @@
// operation
WorkbenchUtils.removeMethodAnnotation(method, annotation, PRIMARY_COPY);
// verifications
- verifyEventNotification(method.getResource(), CHANGED, POST_CHANGE, CONTENT,
times(1));
+ verifyEventNotification(method.getResource(), CHANGED, POST_CHANGE, CONTENT,
atLeastOnce());
}
@Test