diff options
author | Stephan Herrmann | 2011-05-21 17:19:06 +0000 |
---|---|---|
committer | Stephan Herrmann | 2011-05-21 17:19:06 +0000 |
commit | 5c54b896de4b418d9bcea9ae308594a633370525 (patch) | |
tree | 581ea9e46e4d51735b2bca8f51f4df60e010508c /org.eclipse.jdt.core.tests.model | |
parent | 398062daffd00b94752977a229a431f0577b9793 (diff) | |
download | org.eclipse.objectteams-5c54b896de4b418d9bcea9ae308594a633370525.tar.gz org.eclipse.objectteams-5c54b896de4b418d9bcea9ae308594a633370525.tar.xz org.eclipse.objectteams-5c54b896de4b418d9bcea9ae308594a633370525.zip |
update to v_B60 (= 3.7 RC2)
Diffstat (limited to 'org.eclipse.jdt.core.tests.model')
3 files changed, 52 insertions, 4 deletions
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ClasspathInitializerTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ClasspathInitializerTests.java index 3d6983d93..922aee448 100644 --- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ClasspathInitializerTests.java +++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ClasspathInitializerTests.java @@ -19,9 +19,11 @@ import org.eclipse.core.runtime.*; import org.eclipse.core.runtime.preferences.IEclipsePreferences; import org.eclipse.core.runtime.preferences.InstanceScope; import org.eclipse.jdt.core.*; +import org.eclipse.jdt.internal.core.ClasspathEntry; import org.eclipse.jdt.internal.core.JavaModelManager; import org.eclipse.jdt.internal.core.JavaModelStatus; import org.eclipse.jdt.internal.core.JavaProject; +import org.eclipse.jdt.internal.core.UserLibrary; import org.eclipse.jdt.internal.core.UserLibraryClasspathContainer; import junit.framework.Test; @@ -77,7 +79,7 @@ public static Test suite() { // All specified tests which do not belong to the class are skipped... static { // Names of tests to run: can be "testBugXXXX" or "BugXXXX") -// TESTS_NAMES = new String[] { "testContainerInitializer12" }; +// TESTS_NAMES = new String[] { "testBug346002" }; // Numbers of tests to run: "test<number>" will be run for each number of this array // TESTS_NUMBERS = new int[] { 2, 12 }; // Range numbers of tests to run: all tests between "test<first>" and "test<last>" will be run for { first, last } @@ -1610,4 +1612,49 @@ public void testUserLibraryInitializer1() throws Exception { deleteProject("p61872"); } } +/** + * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=346002" + * @throws Exception + */ +public void testBug346002() throws Exception { + ClasspathContainerInitializer initializer = JavaCore.getClasspathContainerInitializer(JavaCore.USER_LIBRARY_CONTAINER_ID); + String libraryName = "TEST"; + IPath containerPath = new Path(JavaCore.USER_LIBRARY_CONTAINER_ID); + UserLibraryClasspathContainer containerSuggestion = new UserLibraryClasspathContainer(libraryName); + initializer.requestClasspathContainerUpdate(containerPath.append(libraryName), null, containerSuggestion); + + String libPath = "C:/test/test.jar"; + + IEclipsePreferences preferences = InstanceScope.INSTANCE.getNode(JavaCore.PLUGIN_ID); + String propertyName = JavaModelManager.CP_USERLIBRARY_PREFERENCES_PREFIX+ "TEST"; + + StringBuffer propertyValue = new StringBuffer( + "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<userlibrary systemlibrary=\"false\" version=\"2\">\r\n<archive"); + propertyValue.append(" path=\"" + libPath + "\"/>\r\n"); + propertyValue.append("</userlibrary>\r\n"); + preferences.put(propertyName, propertyValue.toString()); + + propertyName = JavaModelManager.CP_USERLIBRARY_PREFERENCES_PREFIX + "INVALID"; + propertyValue = new StringBuffer( + "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<userlibrary systemlibrary=\"false\" version=\"2\">\r\n<archive"); + propertyValue.append(" path=\"\"/>"); + propertyValue.append("</userlibrary>\r\n"); + preferences.put(propertyName, propertyValue.toString()); + preferences.flush(); + System.out.println("This test will throw an expected error. Ignore."); + try { + simulateExitRestart(); + + UserLibrary userLibrary = JavaModelManager.getUserLibraryManager().getUserLibrary(libraryName); + assertNotNull(userLibrary); + IPath entryPath = userLibrary.getEntries()[0].getPath(); + assertEquals("Path should be absolute", true, entryPath.isAbsolute()); + + userLibrary = JavaModelManager.getUserLibraryManager().getUserLibrary("INVALID"); + assertNull(userLibrary); + } + catch (ClasspathEntry.AssertionFailedException e) { + fail("Should not throw AssertionFailedException"); + } +} } diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaProjectTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaProjectTests.java index a05ed675f..6357803ea 100644 --- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaProjectTests.java +++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaProjectTests.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2010 IBM Corporation and others. + * Copyright (c) 2000, 2011 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -2322,7 +2322,7 @@ public void testUserLibrary() throws JavaModelException { assertSourceEquals( "Invalid library contents", "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + - "<userlibrary systemlibrary=\"false\" version=\"1\">\n" + + "<userlibrary systemlibrary=\"false\" version=\"2\">\n" + " <archive path=\"/tmp/test.jar\">\n" + " <attributes>\n" + " <attribute name=\"javadoc_location\" value=\"http://www.sample-url.org/doc/\"/>\n" + diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/OptionTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/OptionTests.java index 879357241..3299d8050 100644 --- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/OptionTests.java +++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/OptionTests.java @@ -43,6 +43,7 @@ public OptionTests(String name) { super(name); } static { +// TESTS_NAMES = new String[] {"testBug324987_Project02"}; // TESTS_NUMBERS = new int[] { 125360 }; // TESTS_RANGE = new int[] { 4, -1 }; } @@ -747,8 +748,8 @@ public void testBug324987_Project02() throws CoreException { // Verify that obsolete preference is not stored assertNull( "Unexpected value for formatter deprecated option 'org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member'", - project.getEclipsePreferences().get(obsoleteOption, null)); // Verify that project obsolete option is well retrieved + project.getEclipsePreferences().get(obsoleteOption, null)); assertEquals( "Unexpected value for formatter deprecated option 'org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member'", JavaCore.INSERT, |