Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 228741 Details for
Bug 395897
INDEX_LOCATION_ATTRIBUTE_NAME attribute value is ignored when the index is rebuilt
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
updated junit patch
org.eclipse.jdt.core.tests.model_indextest.patch (text/plain), 4.28 KB, created by
Troy Bishop
on 2013-03-20 15:37:24 EDT
(
hide
)
Description:
updated junit patch
Filename:
MIME Type:
Creator:
Troy Bishop
Created:
2013-03-20 15:37:24 EDT
Size:
4.28 KB
patch
obsolete
>diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AbstractJavaModelTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AbstractJavaModelTests.java >index 916f317..248b7aa 100644 >--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AbstractJavaModelTests.java >+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AbstractJavaModelTests.java >@@ -2831,6 +2831,7 @@ > JavaModelManager.doNotUse(); // reset the MANAGER singleton > JavaModelManager.getJavaModelManager().startup(); > new JavaCorePreferenceInitializer().initializeDefaultPreferences(); >+ JavaCore.initializeAfterLoad(null); > } > /** > * Starts listening to element deltas, and queues them in fgDeltas. >diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaIndexTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaIndexTests.java >index 1893d3f..65dd51d 100644 >--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaIndexTests.java >+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaIndexTests.java >@@ -863,4 +863,71 @@ > deleteProject("ForIndex"); > } > } >-} >+ >+ public void testManagingPreBuildIndexFile() throws CoreException, IOException { >+ >+ // locate the JDT core preference >+ String prefNodeName = "org.eclipse.jdt.core"; >+ IEclipsePreferences prefs = InstanceScope.INSTANCE.getNode(prefNodeName); >+ if(prefs == null) { >+ fail("The preferences for '" + prefNodeName + "' could not be located."); >+ } >+ // create the pre-built index >+ File indexFile = null; >+ String jarFilePath = getExternalResourcePath("Test.jar"); >+ File jarFile = new File(jarFilePath); >+ IJavaProject p = null; >+ try { >+ createJar(new String[] { >+ "pkg/Test.java", >+ "package pkg;\n" + >+ "public class Test {\n" + >+ " protected Test(int i) {}\n" + >+ " protected void helloWorld() {}\n" + >+ "}"}, jarFilePath); >+ indexFile = new File(getExternalResourcePath("Test.index")); >+ JavaIndexer.generateIndexForJar(jarFilePath, indexFile.getAbsolutePath()); >+ // create project P and add the Test.jar to the classpath (associate the index to it) >+ p = createJavaProject("P"); >+ Path libPath = new Path(jarFilePath); >+ IClasspathAttribute attribute = JavaCore.newClasspathAttribute(IClasspathAttribute.INDEX_LOCATION_ATTRIBUTE_NAME, indexFile.toURI().toURL().toString()); >+ IClasspathEntry entry = JavaCore.newLibraryEntry(libPath, null, null, null, new IClasspathAttribute[]{attribute}, false); >+ this.setClasspath(p, new IClasspathEntry[] {entry}); >+ AbstractJavaModelTests.waitUntilIndexesReady(); >+ // verify the current index is correct >+ this.resultCollector = new JavaSearchResultCollector(); >+ this.search("helloWorld", METHOD, DECLARATIONS, EXACT_RULE, SearchEngine.createJavaSearchScope(new IJavaElement[]{p})); >+ this.assertSearchResults(getExternalPath() + "Test.jar void pkg.Test.helloWorld()"); >+ // restart the product so the index manager enables management of pre-build indexes >+ prefs.put(JavaCore.MANAGE_PREBUILT_INDEXES, JavaCore.ENABLED); >+ this.simulateExit(); >+ // update the class file (when the product is not running) by changing >+ // the method signature (simulate the contents of a JAR file changing) >+ createJar(new String[] { >+ "pkg/Test.java", >+ "package pkg;\n" + >+ "public class Test {\n" + >+ " protected Test(int i) {}\n" + >+ " protected void helloWorld(int i) {}\n" + >+ "}"}, jarFilePath); >+ this.simulateRestart(); >+ AbstractJavaModelTests.waitUntilIndexesReady(); >+ // verify that the index is updated >+ this.resultCollector = new JavaSearchResultCollector(); >+ this.search("helloWorld", METHOD, DECLARATIONS, EXACT_RULE, SearchEngine.createJavaSearchScope(new IJavaElement[]{p})); >+ this.assertSearchResults(getExternalPath() + "Test.jar void pkg.Test.helloWorld(int)"); >+ } >+ finally { >+ // restart the product so the index manager disables management of pre-build indexes >+ prefs.put(JavaCore.MANAGE_PREBUILT_INDEXES, JavaCore.DISABLED); >+ // clean-up artifacts that were created >+ if(p != null) { >+ deleteProject("P"); >+ } >+ if (indexFile != null) { >+ indexFile.delete(); >+ } >+ jarFile.delete(); >+ } >+ } >+} >\ No newline at end of file
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 395897
:
224383
|
225343
|
225398
|
225796
|
225915
|
225923
|
225953
|
226433
|
227564
|
227624
|
228741
|
228742
|
228901
|
228976
|
228994
|
229073
|
229088
|
229091
|
229146
|
229157