mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-16 20:55:44 +02:00
Minor change to TeamSharedIndexTest.
This commit is contained in:
parent
39051c4adb
commit
b808918b1e
1 changed files with 14 additions and 3 deletions
|
@ -12,6 +12,7 @@
|
||||||
package org.eclipse.cdt.internal.index.tests;
|
package org.eclipse.cdt.internal.index.tests;
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
|
import java.io.File;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
|
@ -32,6 +33,7 @@ import org.eclipse.cdt.core.model.IElementChangedListener;
|
||||||
import org.eclipse.cdt.core.testplugin.CProjectHelper;
|
import org.eclipse.cdt.core.testplugin.CProjectHelper;
|
||||||
import org.eclipse.cdt.core.testplugin.util.TestSourceReader;
|
import org.eclipse.cdt.core.testplugin.util.TestSourceReader;
|
||||||
import org.eclipse.cdt.internal.core.pdom.indexer.IndexerPreferences;
|
import org.eclipse.cdt.internal.core.pdom.indexer.IndexerPreferences;
|
||||||
|
import org.eclipse.core.resources.IFile;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.resources.IProjectDescription;
|
import org.eclipse.core.resources.IProjectDescription;
|
||||||
import org.eclipse.core.resources.IWorkspace;
|
import org.eclipse.core.resources.IWorkspace;
|
||||||
|
@ -223,7 +225,7 @@ public class TeamSharedIndexTest extends IndexTestBase {
|
||||||
fPDOMManager.joinIndexer(INDEXER_WAIT_TIME, NPM);
|
fPDOMManager.joinIndexer(INDEXER_WAIT_TIME, NPM);
|
||||||
|
|
||||||
// change file
|
// change file
|
||||||
prj.getProject().getFile("a.cpp").setContents(new ByteArrayInputStream("int d;".getBytes()), true, false, NPM);
|
changeFile(prj);
|
||||||
deleteAndWait(prj);
|
deleteAndWait(prj);
|
||||||
unregisterProject(prj);
|
unregisterProject(prj);
|
||||||
|
|
||||||
|
@ -236,6 +238,16 @@ public class TeamSharedIndexTest extends IndexTestBase {
|
||||||
checkVariable(prj, "d", 1);
|
checkVariable(prj, "d", 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void changeFile(ICProject prj) throws CoreException {
|
||||||
|
final IFile file = prj.getProject().getFile("a.cpp");
|
||||||
|
final File location = file.getLocation().toFile();
|
||||||
|
final long lm= location.lastModified();
|
||||||
|
file.setContents(new ByteArrayInputStream("int d;".getBytes()), true, false, NPM);
|
||||||
|
if (location.lastModified() == lm) {
|
||||||
|
location.setLastModified(lm+1000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void deleteAndWait(ICProject prj) throws CoreException {
|
private void deleteAndWait(ICProject prj) throws CoreException {
|
||||||
ModelJoiner dj= new ModelJoiner();
|
ModelJoiner dj= new ModelJoiner();
|
||||||
try {
|
try {
|
||||||
|
@ -267,8 +279,7 @@ public class TeamSharedIndexTest extends IndexTestBase {
|
||||||
checkVariable(prj, "b", 0);
|
checkVariable(prj, "b", 0);
|
||||||
checkVariable(prj, "c", 0);
|
checkVariable(prj, "c", 0);
|
||||||
|
|
||||||
// change file
|
changeFile(prj);
|
||||||
prj.getProject().getFile("a.cpp").setContents(new ByteArrayInputStream("int d;".getBytes()), true, false, NPM);
|
|
||||||
deleteAndWait(prj);
|
deleteAndWait(prj);
|
||||||
unregisterProject(prj);
|
unregisterProject(prj);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue