Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian W. Damus2021-08-11 12:52:04 +0000
committerPatrick Tessier2021-08-30 08:35:04 +0000
commitde558039242c4c0b4a209cccc3a74b64c8054175 (patch)
treea1a88bf475c93b1aa44d8b02705cb35d4ee56591 /tests/junit
parentc059db8bd1345e202f6a55fae76424aefd96bba1 (diff)
downloadorg.eclipse.papyrus-de558039242c4c0b4a209cccc3a74b64c8054175.tar.gz
org.eclipse.papyrus-de558039242c4c0b4a209cccc3a74b64c8054175.tar.xz
org.eclipse.papyrus-de558039242c4c0b4a209cccc3a74b64c8054175.zip
Bug 573042: Spurious indexing
- do not index derived resources in the workspace Change-Id: Iefde5547bf8722d73d0f3707ec1d07fcccd7ab88 Signed-off-by: Christian W. Damus <give.a.damus@gmail.com>
Diffstat (limited to 'tests/junit')
-rw-r--r--tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.tests/tests/org/eclipse/papyrus/infra/emf/resource/index/WorkspaceModelIndexTest.java38
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.tests/tests/org/eclipse/papyrus/infra/emf/resource/index/WorkspaceModelIndexTest.java b/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.tests/tests/org/eclipse/papyrus/infra/emf/resource/index/WorkspaceModelIndexTest.java
index e76eba65479..e82124702c8 100644
--- a/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.tests/tests/org/eclipse/papyrus/infra/emf/resource/index/WorkspaceModelIndexTest.java
+++ b/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.tests/tests/org/eclipse/papyrus/infra/emf/resource/index/WorkspaceModelIndexTest.java
@@ -46,12 +46,16 @@ import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.ICoreRunnable;
+import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.QualifiedName;
import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.SubMonitor;
import org.eclipse.core.runtime.jobs.IJobChangeEvent;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.core.runtime.jobs.JobChangeAdapter;
@@ -373,6 +377,40 @@ public class WorkspaceModelIndexTest extends AbstractPapyrusTest {
assertIndex(index);
}
+ /**
+ * Verify that derived resources are not indexed.
+ *
+ * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=573042
+ */
+ @Test
+ public void indexNotBuiltForDerivedResources() throws Exception {
+ IPath newReferencingFilePath = referencingFile.getProjectRelativePath().removeLastSegments(1).append("derived")
+ .addFileExtension(referencingFile.getFileExtension());
+ IFile newReferencingFile = referencingFile.getProject().getFile(newReferencingFilePath);
+
+ ICoreRunnable furtherSetup = monitor -> {
+ SubMonitor sub = SubMonitor.convert(monitor, 2);
+ referencingFile.copy(newReferencingFilePath, false, sub.newChild(1));
+ newReferencingFile.setDerived(true, sub.newChild(1));
+ sub.done();
+ };
+
+ // Interlock with the indexing to ensure that we don't try the index before it hears
+ // about the file delta
+ sync.init(SyncMode.TEST, IndexMode.INDEX);
+
+ newReferencingFile.getWorkspace().run(furtherSetup, new NullProgressMonitor());
+
+ // Wait for the indexing to start. If it doesn't start within five seconds, then
+ // something is wrong with the resource change notifications
+ sync.syncFromTest();
+
+ Map<IFile, CrossReferenceIndex> index = fixture.getIndex().get();
+
+ // The new Referencing URI is not included in the index
+ assertIndex(index, true, Set.of(), Set.of(referencingURI), true, Set.of(), Set.of(referencedURI));
+ }
+
//
// Test framework
//

Back to the top