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 26829 Details for
Bug 101425
Classpath persistence should be resilient with unknown attributes
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Regression tests
patch101425_org.eclipse.jdt.core.tests.model.txt (text/plain), 7.14 KB, created by
Jerome Lanneluc
on 2005-09-05 06:43:24 EDT
(
hide
)
Description:
Regression tests
Filename:
MIME Type:
Creator:
Jerome Lanneluc
Created:
2005-09-05 06:43:24 EDT
Size:
7.14 KB
patch
obsolete
>Index: src/org/eclipse/jdt/core/tests/model/ClasspathTests.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ClasspathTests.java,v >retrieving revision 1.130 >diff -u -r1.130 ClasspathTests.java >--- src/org/eclipse/jdt/core/tests/model/ClasspathTests.java 25 May 2005 16:08:44 -0000 1.130 >+++ src/org/eclipse/jdt/core/tests/model/ClasspathTests.java 5 Sep 2005 10:39:31 -0000 >@@ -75,8 +75,8 @@ > // All specified tests which do not belong to the class are skipped... > static { > // Names of tests to run: can be "testBugXXXX" or "BugXXXX") >-// TESTS_PREFIX = "testClasspathDuplicateExtraAttribute"; >-// TESTS_NAMES = new String[] {"testExportContainer"}; >+// TESTS_PREFIX = "testUnknownElements"; >+// TESTS_NAMES = new String[] {"testUnknownElements2"}; > // TESTS_NUMBERS = new int[] { 23, 28, 38 }; > // TESTS_RANGE = new int[] { 21, 38 }; > } >@@ -3166,7 +3166,7 @@ > }, > null); > time[0] += System.currentTimeMillis()-start[0]; >- System.out.println("No cycle check ("+numberOfParticipants+" participants) : "+ time[0]+" ms, "+ (useForwardReferences ? "forward references" : "backward references") + ", " + (createProjectsFirst ? "two steps (projects created first, then classpaths are set)" : "one step (projects created and classpaths set in one batch)")); >+ //System.out.println("No cycle check ("+numberOfParticipants+" participants) : "+ time[0]+" ms, "+ (useForwardReferences ? "forward references" : "backward references") + ", " + (createProjectsFirst ? "two steps (projects created first, then classpaths are set)" : "one step (projects created and classpaths set in one batch)")); > > for (int i = 0; i < numberOfParticipants; i++){ > // check cycle markers >@@ -3322,6 +3322,154 @@ > } > } > >+/* >+ * Ensures that unknown classpath attributes in a .classpath file are not lost when read and rewritten. >+ * (regression test for bug 101425 Classpath persistence should be resilient with unknown attributes) >+ */ >+public void testUnknownAttributes() throws CoreException { >+ try { >+ IJavaProject project = createJavaProject("P"); >+ editFile( >+ "/P/.classpath", >+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + >+ "<classpath>\n" + >+ " <classpathentry unknown=\"test\" kind=\"src\" path=\"src1\"/>\n" + >+ " <classpathentry kind=\"src\" path=\"src2\"/>\n" + >+ " <classpathentry kind=\"output\" path=\"bin\"/>\n" + >+ "</classpath>\n" >+ ); >+ IClasspathEntry[] classpath = project.getRawClasspath(); >+ >+ // swap 2 entries >+ IClasspathEntry src1 = classpath[0]; >+ classpath[0] = classpath[1]; >+ classpath[1] = src1; >+ project.setRawClasspath(classpath, null); >+ >+ // check that .classpath has correct content >+ String contents = new String (org.eclipse.jdt.internal.core.util.Util.getResourceContentsAsCharArray(getFile("/P/.classpath"))); >+ assertSourceEquals( >+ "Unexpected content", >+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + >+ "<classpath>\n" + >+ " <classpathentry kind=\"src\" path=\"src2\"/>\n" + >+ " <classpathentry unknown=\"test\" kind=\"src\" path=\"src1\"/>\n" + >+ " <classpathentry kind=\"output\" path=\"bin\"/>\n" + >+ "</classpath>\n", >+ contents); >+ } finally { >+ deleteProject("P"); >+ } >+} >+ >+/* >+ * Ensures that unknown classpath elements in a .classpath file are not lost when read and rewritten. >+ * (regression test for bug 101425 Classpath persistence should be resilient with unknown attributes) >+ */ >+public void testUnknownElements1() throws CoreException { >+ try { >+ IJavaProject project = createJavaProject("P"); >+ editFile( >+ "/P/.classpath", >+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + >+ "<classpath>\n" + >+ " <classpathentry kind=\"src\" path=\"src1\">\n" + >+ " <unknown>\n" + >+ " <test kind=\"\"/>\n" + >+ " </unknown>\n" + >+ " </classpathentry>\n" + >+ " <classpathentry kind=\"src\" path=\"src2\"/>\n" + >+ " <classpathentry kind=\"output\" path=\"bin\"/>\n" + >+ "</classpath>\n" >+ ); >+ IClasspathEntry[] classpath = project.getRawClasspath(); >+ >+ // swap 2 entries >+ IClasspathEntry src1 = classpath[0]; >+ classpath[0] = classpath[1]; >+ classpath[1] = src1; >+ project.setRawClasspath(classpath, null); >+ >+ // check that .classpath has correct content >+ String contents = new String (org.eclipse.jdt.internal.core.util.Util.getResourceContentsAsCharArray(getFile("/P/.classpath"))); >+ assertSourceEquals( >+ "Unexpected content", >+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + >+ "<classpath>\n" + >+ " <classpathentry kind=\"src\" path=\"src2\"/>\n" + >+ " <classpathentry kind=\"src\" path=\"src1\">\n" + >+ " <unknown>\n" + >+ " <test kind=\"\"/>\n" + >+ " </unknown>\n" + >+ " </classpathentry>\n" + >+ " <classpathentry kind=\"output\" path=\"bin\"/>\n" + >+ "</classpath>\n", >+ contents); >+ } finally { >+ deleteProject("P"); >+ } >+} >+ >+/* >+ * Ensures that unknown classpath elements in a .classpath file are not lost when read and rewritten. >+ * (regression test for bug 101425 Classpath persistence should be resilient with unknown attributes) >+ */ >+public void testUnknownElements2() throws CoreException { >+ try { >+ IJavaProject project = createJavaProject("P"); >+ editFile( >+ "/P/.classpath", >+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + >+ "<classpath>\n" + >+ " <classpathentry kind=\"src\" unknownattribute=\"abcde\" path=\"src1\">\n" + >+ " <unknown1>\n" + >+ " <test kind=\"1\"/>\n" + >+ " <test kind=\"2\"/>\n" + >+ " </unknown1>\n" + >+ " <unknown2 attribute2=\"\">\n" + >+ " <test>\n" + >+ " <other a=\"b\"/>\n" + >+ " </test>\n" + >+ " </unknown2>\n" + >+ " </classpathentry>\n" + >+ " <classpathentry kind=\"src\" path=\"src2\"/>\n" + >+ " <classpathentry kind=\"output\" path=\"bin\"/>\n" + >+ "</classpath>\n" >+ ); >+ IClasspathEntry[] classpath = project.getRawClasspath(); >+ >+ // swap 2 entries >+ IClasspathEntry src1 = classpath[0]; >+ classpath[0] = classpath[1]; >+ classpath[1] = src1; >+ project.setRawClasspath(classpath, null); >+ >+ // check that .classpath has correct content >+ String contents = new String (org.eclipse.jdt.internal.core.util.Util.getResourceContentsAsCharArray(getFile("/P/.classpath"))); >+ assertSourceEquals( >+ "Unexpected content", >+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + >+ "<classpath>\n" + >+ " <classpathentry kind=\"src\" path=\"src2\"/>\n" + >+ " <classpathentry kind=\"src\" unknownattribute=\"abcde\" path=\"src1\">\n" + >+ " <unknown1>\n" + >+ " <test kind=\"1\"/>\n" + >+ " <test kind=\"2\"/>\n" + >+ " </unknown1>\n" + >+ " <unknown2 attribute2=\"\">\n" + >+ " <test>\n" + >+ " <other a=\"b\"/>\n" + >+ " </test>\n" + >+ " </unknown2>\n" + >+ " </classpathentry>\n" + >+ " <classpathentry kind=\"output\" path=\"bin\"/>\n" + >+ "</classpath>\n", >+ contents); >+ } finally { >+ deleteProject("P"); >+ } >+} >+ > /** > * https://bugs.eclipse.org/bugs/show_bug.cgi?id=55992 > * Check that Assert.AssertionFailedException exception is well catched
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 101425
:
26628
|
26629
|
26698
|
26828
| 26829