Lines 549-558
Link Here
|
549 |
/* |
549 |
/* |
550 |
* Ensures that adding a library entry for an existing external ZIP archive doesn't generate a marker |
550 |
* Ensures that adding a library entry for an existing external ZIP archive doesn't generate a marker |
551 |
*/ |
551 |
*/ |
552 |
public void testAddZIPArchive1() throws CoreException { |
552 |
public void testAddZIPArchive1() throws CoreException, IOException { |
553 |
try { |
553 |
try { |
554 |
IJavaProject p = createJavaProject("P"); |
554 |
IJavaProject p = createJavaProject("P"); |
555 |
createExternalFile("externalLib.abc", ""); |
555 |
org.eclipse.jdt.core.tests.util.Util.createEmptyJar( |
|
|
556 |
getExternalResourcePath("externalLib.abc"), |
557 |
JavaCore.VERSION_1_4); |
556 |
setClasspath(p, new IClasspathEntry[] {JavaCore.newLibraryEntry(new Path(getExternalResourcePath("externalLib.abc")), null, null)}); |
558 |
setClasspath(p, new IClasspathEntry[] {JavaCore.newLibraryEntry(new Path(getExternalResourcePath("externalLib.abc")), null, null)}); |
557 |
assertMarkers("Unexpected markers", "", p); |
559 |
assertMarkers("Unexpected markers", "", p); |
558 |
} finally { |
560 |
} finally { |
Lines 564-572
Link Here
|
564 |
/* |
566 |
/* |
565 |
* Ensures that creating a project with a library entry for an existing external ZIP archive doesn't generate a marker |
567 |
* Ensures that creating a project with a library entry for an existing external ZIP archive doesn't generate a marker |
566 |
*/ |
568 |
*/ |
567 |
public void testAddZIPArchive2() throws CoreException { |
569 |
public void testAddZIPArchive2() throws CoreException, IOException { |
568 |
try { |
570 |
try { |
569 |
createExternalFile("externalLib.abc", ""); |
571 |
org.eclipse.jdt.core.tests.util.Util.createEmptyJar( |
|
|
572 |
getExternalResourcePath("externalLib.abc"), |
573 |
JavaCore.VERSION_1_4); |
570 |
IJavaProject p = createJavaProject("P", new String[0], new String[] {getExternalResourcePath("externalLib.abc")}, ""); |
574 |
IJavaProject p = createJavaProject("P", new String[0], new String[] {getExternalResourcePath("externalLib.abc")}, ""); |
571 |
assertMarkers("Unexpected markers", "", p); |
575 |
assertMarkers("Unexpected markers", "", p); |
572 |
} finally { |
576 |
} finally { |
Lines 614-626
Link Here
|
614 |
/* |
618 |
/* |
615 |
* Ensures that creating an external ZIP archive referenced by a library entry and refreshing removes the marker |
619 |
* Ensures that creating an external ZIP archive referenced by a library entry and refreshing removes the marker |
616 |
*/ |
620 |
*/ |
617 |
public void testAddZIPArchive5() throws CoreException { |
621 |
public void testAddZIPArchive5() throws CoreException, IOException { |
618 |
try { |
622 |
try { |
619 |
IJavaProject p = createJavaProject("P", new String[0], new String[] {getExternalResourcePath("externalLib.abc")}, ""); |
623 |
IJavaProject p = createJavaProject("P", new String[0], new String[] {getExternalResourcePath("externalLib.abc")}, ""); |
620 |
refreshExternalArchives(p); |
624 |
refreshExternalArchives(p); |
621 |
waitForAutoBuild(); |
625 |
waitForAutoBuild(); |
622 |
|
626 |
org.eclipse.jdt.core.tests.util.Util.createEmptyJar( |
623 |
createExternalFile("externalLib.abc", ""); |
627 |
getExternalResourcePath("externalLib.abc"), |
|
|
628 |
JavaCore.VERSION_1_4); |
624 |
refreshExternalArchives(p); |
629 |
refreshExternalArchives(p); |
625 |
assertMarkers("Unexpected markers", "", p); |
630 |
assertMarkers("Unexpected markers", "", p); |
626 |
} finally { |
631 |
} finally { |
Lines 633-645
Link Here
|
633 |
* Ensures that creating an external ZIP archive referenced by a library entry and refreshing after a restart |
638 |
* Ensures that creating an external ZIP archive referenced by a library entry and refreshing after a restart |
634 |
* removes the marker |
639 |
* removes the marker |
635 |
*/ |
640 |
*/ |
636 |
public void testAddZIPArchive6() throws CoreException { |
641 |
public void testAddZIPArchive6() throws CoreException, IOException { |
637 |
try { |
642 |
try { |
638 |
simulateExitRestart(); |
643 |
simulateExitRestart(); |
639 |
IJavaProject p = createJavaProject("P", new String[0], new String[] {getExternalResourcePath("externalLib.abc")}, ""); |
644 |
IJavaProject p = createJavaProject("P", new String[0], new String[] {getExternalResourcePath("externalLib.abc")}, ""); |
640 |
refreshExternalArchives(p); |
645 |
refreshExternalArchives(p); |
641 |
|
646 |
org.eclipse.jdt.core.tests.util.Util.createEmptyJar( |
642 |
createExternalFile("externalLib.abc", ""); |
647 |
getExternalResourcePath("externalLib.abc"), |
|
|
648 |
JavaCore.VERSION_1_4); |
643 |
refreshExternalArchives(p); |
649 |
refreshExternalArchives(p); |
644 |
assertMarkers("Unexpected markers", "", p); |
650 |
assertMarkers("Unexpected markers", "", p); |
645 |
} finally { |
651 |
} finally { |
Lines 651-663
Link Here
|
651 |
/* |
657 |
/* |
652 |
* Ensures that adding a library entry for an existing internal ZIP archive doesn't generate a marker |
658 |
* Ensures that adding a library entry for an existing internal ZIP archive doesn't generate a marker |
653 |
*/ |
659 |
*/ |
654 |
public void testAddZIPArchive7() throws CoreException { |
660 |
public void testAddZIPArchive7() throws CoreException, IOException { |
655 |
try { |
661 |
try { |
656 |
IJavaProject p = createJavaProject("P"); |
662 |
IJavaProject p = createJavaProject("P"); |
657 |
refreshExternalArchives(p); |
663 |
refreshExternalArchives(p); |
658 |
waitForAutoBuild(); |
664 |
waitForAutoBuild(); |
659 |
|
665 |
addLibrary(p, "internalLib.abc", null, new String[0], |
660 |
createFile("/P/internalLib.abc", ""); |
666 |
new String[]{"META-INF/MANIFEST.MF", |
|
|
667 |
"Manifest-Version: 1.0\n"} , |
668 |
JavaCore.VERSION_1_4); |
661 |
setClasspath(p, new IClasspathEntry[] {JavaCore.newLibraryEntry(new Path("/P/internalLib.abc"), null, null)}); |
669 |
setClasspath(p, new IClasspathEntry[] {JavaCore.newLibraryEntry(new Path("/P/internalLib.abc"), null, null)}); |
662 |
assertMarkers("Unexpected markers", "", p); |
670 |
assertMarkers("Unexpected markers", "", p); |
663 |
} finally { |
671 |
} finally { |
Lines 2604-2616
Link Here
|
2604 |
String externalJarPath = getWorkspaceRoot().getLocation().removeLastSegments(1).append("external.jar").toOSString(); |
2612 |
String externalJarPath = getWorkspaceRoot().getLocation().removeLastSegments(1).append("external.jar").toOSString(); |
2605 |
try { |
2613 |
try { |
2606 |
IJavaProject p = createJavaProject("P"); |
2614 |
IJavaProject p = createJavaProject("P"); |
2607 |
Util.writeToFile("", externalJarPath); |
2615 |
org.eclipse.jdt.core.tests.util.Util.createEmptyJar( |
|
|
2616 |
externalJarPath, |
2617 |
JavaCore.VERSION_1_4); |
2608 |
ContainerInitializer.setInitializer(new DefaultContainerInitializer(new String[] {"P", "../../external.jar"})); |
2618 |
ContainerInitializer.setInitializer(new DefaultContainerInitializer(new String[] {"P", "../../external.jar"})); |
2609 |
setClasspath(p, new IClasspathEntry[] {JavaCore.newContainerEntry(new Path("org.eclipse.jdt.core.tests.model.TEST_CONTAINER"))}); |
2619 |
setClasspath(p, new IClasspathEntry[] {JavaCore.newContainerEntry(new Path("org.eclipse.jdt.core.tests.model.TEST_CONTAINER"))}); |
2610 |
assertElementDescendants( |
2620 |
assertElementDescendants( |
2611 |
"Unexpected project content", |
2621 |
"Unexpected project content", |
2612 |
"P\n" + |
2622 |
"P\n" + |
2613 |
" "+ getExternalPath() + "external.jar", |
2623 |
" "+ getExternalPath() + "external.jar\n" + |
|
|
2624 |
" <default> (...)", |
2614 |
p |
2625 |
p |
2615 |
); |
2626 |
); |
2616 |
} finally { |
2627 |
} finally { |
Lines 2645-2656
Link Here
|
2645 |
String externalJarPath = getWorkspaceRoot().getLocation().append("external.jar").toOSString(); |
2656 |
String externalJarPath = getWorkspaceRoot().getLocation().append("external.jar").toOSString(); |
2646 |
try { |
2657 |
try { |
2647 |
IJavaProject p = createJavaProject("P"); |
2658 |
IJavaProject p = createJavaProject("P"); |
2648 |
Util.writeToFile("", externalJarPath); |
2659 |
org.eclipse.jdt.core.tests.util.Util.createEmptyJar( |
|
|
2660 |
externalJarPath, |
2661 |
JavaCore.VERSION_1_4); |
2649 |
setClasspath(p, new IClasspathEntry[] {JavaCore.newLibraryEntry(new Path("../external.jar"), null, null)}); |
2662 |
setClasspath(p, new IClasspathEntry[] {JavaCore.newLibraryEntry(new Path("../external.jar"), null, null)}); |
2650 |
assertElementDescendants( |
2663 |
assertElementDescendants( |
2651 |
"Unexpected project content", |
2664 |
"Unexpected project content", |
2652 |
"P\n" + |
2665 |
"P\n" + |
2653 |
" "+ getWorkspacePath() + "external.jar", |
2666 |
" "+ getWorkspacePath() + "external.jar\n" + |
|
|
2667 |
" <default> (...)", |
2654 |
p |
2668 |
p |
2655 |
); |
2669 |
); |
2656 |
} finally { |
2670 |
} finally { |
Lines 2666-2677
Link Here
|
2666 |
String externalJarPath = getWorkspaceRoot().getLocation().removeLastSegments(1).append("external.jar").toOSString(); |
2680 |
String externalJarPath = getWorkspaceRoot().getLocation().removeLastSegments(1).append("external.jar").toOSString(); |
2667 |
try { |
2681 |
try { |
2668 |
IJavaProject p = createJavaProject("P"); |
2682 |
IJavaProject p = createJavaProject("P"); |
2669 |
Util.writeToFile("", externalJarPath); |
2683 |
org.eclipse.jdt.core.tests.util.Util.createEmptyJar( |
|
|
2684 |
externalJarPath, |
2685 |
JavaCore.VERSION_1_4); |
2670 |
setClasspath(p, new IClasspathEntry[] {JavaCore.newLibraryEntry(new Path("../../external.jar"), null, null)}); |
2686 |
setClasspath(p, new IClasspathEntry[] {JavaCore.newLibraryEntry(new Path("../../external.jar"), null, null)}); |
2671 |
assertElementDescendants( |
2687 |
assertElementDescendants( |
2672 |
"Unexpected project content", |
2688 |
"Unexpected project content", |
2673 |
"P\n" + |
2689 |
"P\n" + |
2674 |
" "+ getExternalPath() + "external.jar", |
2690 |
" "+ getExternalPath() + "external.jar\n" + |
|
|
2691 |
" <default> (...)", |
2675 |
p |
2692 |
p |
2676 |
); |
2693 |
); |
2677 |
} finally { |
2694 |
} finally { |
Lines 2687-2698
Link Here
|
2687 |
String externalJarPath = getWorkspaceRoot().getLocation().removeLastSegments(1).append("external.jar").toOSString(); |
2704 |
String externalJarPath = getWorkspaceRoot().getLocation().removeLastSegments(1).append("external.jar").toOSString(); |
2688 |
try { |
2705 |
try { |
2689 |
IJavaProject p = createJavaProject("P"); |
2706 |
IJavaProject p = createJavaProject("P"); |
2690 |
Util.writeToFile("", externalJarPath); |
2707 |
org.eclipse.jdt.core.tests.util.Util.createEmptyJar( |
|
|
2708 |
externalJarPath, |
2709 |
JavaCore.VERSION_1_4); |
2691 |
setClasspath(p, new IClasspathEntry[] {JavaCore.newLibraryEntry(new Path("src/../../../external.jar"), null, null)}); |
2710 |
setClasspath(p, new IClasspathEntry[] {JavaCore.newLibraryEntry(new Path("src/../../../external.jar"), null, null)}); |
2692 |
assertElementDescendants( |
2711 |
assertElementDescendants( |
2693 |
"Unexpected project content", |
2712 |
"Unexpected project content", |
2694 |
"P\n" + |
2713 |
"P\n" + |
2695 |
" "+ getExternalPath() + "external.jar", |
2714 |
" "+ getExternalPath() + "external.jar\n" + |
|
|
2715 |
" <default> (...)", |
2696 |
p |
2716 |
p |
2697 |
); |
2717 |
); |
2698 |
} finally { |
2718 |
} finally { |
Lines 2706-2720
Link Here
|
2706 |
*/ |
2726 |
*/ |
2707 |
public void testDotDotLibraryEntry4() throws Exception { |
2727 |
public void testDotDotLibraryEntry4() throws Exception { |
2708 |
try { |
2728 |
try { |
2709 |
createProject("P1"); |
2729 |
IJavaProject p1 = createJavaProject("P1"); |
2710 |
createFile("/P1/internal.jar", ""); |
2730 |
IJavaProject p2 = createJavaProject("P2"); |
2711 |
IJavaProject p = createJavaProject("P2"); |
2731 |
|
2712 |
setClasspath(p, new IClasspathEntry[] {JavaCore.newLibraryEntry(new Path("../P1/internal.jar"), null, null)}); |
2732 |
addLibrary(p1, "internal.jar", null, new String[0], |
|
|
2733 |
new String[]{"META-INF/MANIFEST.MF", |
2734 |
"Manifest-Version: 1.0\n"} , |
2735 |
JavaCore.VERSION_1_4); |
2736 |
setClasspath(p2, new IClasspathEntry[] {JavaCore.newLibraryEntry(new Path("../P1/internal.jar"), null, null)}); |
2713 |
assertElementDescendants( |
2737 |
assertElementDescendants( |
2714 |
"Unexpected project content", |
2738 |
"Unexpected project content", |
2715 |
"P2\n" + |
2739 |
"P2\n" + |
2716 |
" /P1/internal.jar", |
2740 |
" /P1/internal.jar\n" + |
2717 |
p |
2741 |
" <default> (...)", |
|
|
2742 |
p2 |
2718 |
); |
2743 |
); |
2719 |
} finally { |
2744 |
} finally { |
2720 |
deleteProject("P1"); |
2745 |
deleteProject("P1"); |
Lines 2729-2735
Link Here
|
2729 |
String externalJarPath = getWorkspaceRoot().getLocation().append("external.jar").toOSString(); |
2754 |
String externalJarPath = getWorkspaceRoot().getLocation().append("external.jar").toOSString(); |
2730 |
try { |
2755 |
try { |
2731 |
IJavaProject p = createJavaProject("P"); |
2756 |
IJavaProject p = createJavaProject("P"); |
2732 |
Util.writeToFile("", externalJarPath); |
2757 |
org.eclipse.jdt.core.tests.util.Util.createEmptyJar( |
|
|
2758 |
externalJarPath, |
2759 |
JavaCore.VERSION_1_4); |
2733 |
setClasspath(p, new IClasspathEntry[] {JavaCore.newLibraryEntry(new Path("../external.jar"), null, null)}); |
2760 |
setClasspath(p, new IClasspathEntry[] {JavaCore.newLibraryEntry(new Path("../external.jar"), null, null)}); |
2734 |
assertMarkers( |
2761 |
assertMarkers( |
2735 |
"Unexpected markers", |
2762 |
"Unexpected markers", |
Lines 2764-2770
Link Here
|
2764 |
String externalJarPath = getWorkspaceRoot().getLocation().append("external.jar").toOSString(); |
2791 |
String externalJarPath = getWorkspaceRoot().getLocation().append("external.jar").toOSString(); |
2765 |
try { |
2792 |
try { |
2766 |
IJavaProject p = createJavaProject("P"); |
2793 |
IJavaProject p = createJavaProject("P"); |
2767 |
Util.writeToFile("", externalJarPath); |
2794 |
org.eclipse.jdt.core.tests.util.Util.createEmptyJar( |
|
|
2795 |
externalJarPath, |
2796 |
JavaCore.VERSION_1_4); |
2768 |
editFile( |
2797 |
editFile( |
2769 |
"/P/.classpath", |
2798 |
"/P/.classpath", |
2770 |
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + |
2799 |
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + |
Lines 2778-2784
Link Here
|
2778 |
"P\n" + |
2807 |
"P\n" + |
2779 |
" <project root>\n" + |
2808 |
" <project root>\n" + |
2780 |
" <default> (...)\n" + |
2809 |
" <default> (...)\n" + |
2781 |
" "+ getWorkspacePath() + "external.jar", |
2810 |
" "+ getWorkspacePath() + "external.jar\n" + |
|
|
2811 |
" <default> (...)", |
2782 |
p |
2812 |
p |
2783 |
); |
2813 |
); |
2784 |
} finally { |
2814 |
} finally { |
Lines 2819-2830
Link Here
|
2819 |
try { |
2849 |
try { |
2820 |
JavaCore.setClasspathVariable("TWO_UP", new Path("../.."), null); |
2850 |
JavaCore.setClasspathVariable("TWO_UP", new Path("../.."), null); |
2821 |
IJavaProject p = createJavaProject("P"); |
2851 |
IJavaProject p = createJavaProject("P"); |
2822 |
Util.writeToFile("", externalJarPath); |
2852 |
org.eclipse.jdt.core.tests.util.Util.createEmptyJar( |
|
|
2853 |
externalJarPath, |
2854 |
JavaCore.VERSION_1_4); |
2823 |
setClasspath(p, new IClasspathEntry[] {JavaCore.newVariableEntry(new Path("TWO_UP/external.jar"), null, null)}); |
2855 |
setClasspath(p, new IClasspathEntry[] {JavaCore.newVariableEntry(new Path("TWO_UP/external.jar"), null, null)}); |
2824 |
assertElementDescendants( |
2856 |
assertElementDescendants( |
2825 |
"Unexpected project content", |
2857 |
"Unexpected project content", |
2826 |
"P\n" + |
2858 |
"P\n" + |
2827 |
" "+ getExternalPath() + "external.jar", |
2859 |
" "+ getExternalPath() + "external.jar\n" + |
|
|
2860 |
" <default> (...)", |
2828 |
p |
2861 |
p |
2829 |
); |
2862 |
); |
2830 |
} finally { |
2863 |
} finally { |
Lines 3122-3129
Link Here
|
3122 |
waitUntilIndexesReady(); |
3155 |
waitUntilIndexesReady(); |
3123 |
waitForAutoBuild(); |
3156 |
waitForAutoBuild(); |
3124 |
// at this point, a marker indicates that test185733.jar has been created: "Project 'P' is missing required library: '[...]\test185733.jar'" |
3157 |
// at this point, a marker indicates that test185733.jar has been created: "Project 'P' is missing required library: '[...]\test185733.jar'" |
3125 |
|
3158 |
org.eclipse.jdt.core.tests.util.Util.createEmptyJar( |
3126 |
createFile(new File(getExternalPath()), "test185733.jar", ""); |
3159 |
getExternalResourcePath("test185733.jar"), |
|
|
3160 |
JavaCore.VERSION_1_4); |
3127 |
refreshExternalArchives(p); |
3161 |
refreshExternalArchives(p); |
3128 |
assertMarkers( |
3162 |
assertMarkers( |
3129 |
"Unexpected markers", |
3163 |
"Unexpected markers", |
Lines 3749-3761
Link Here
|
3749 |
* Ensures that a marker is removed if adding an internal jar that is on the classpath in another project |
3783 |
* Ensures that a marker is removed if adding an internal jar that is on the classpath in another project |
3750 |
* (regression test for https://bugs.eclipse.org/bugs/show_bug.cgi?id=213723 ) |
3784 |
* (regression test for https://bugs.eclipse.org/bugs/show_bug.cgi?id=213723 ) |
3751 |
*/ |
3785 |
*/ |
3752 |
public void testFixClasspath1() throws CoreException { |
3786 |
public void testFixClasspath1() throws CoreException, IOException { |
3753 |
try { |
3787 |
try { |
3754 |
createProject("P1"); |
3788 |
createProject("P1"); |
3755 |
IJavaProject project = createJavaProject("P2", new String[0], new String[] {"/P1/lib.jar"}, "bin"); |
3789 |
IJavaProject project = createJavaProject("P2", new String[0], new String[0], "bin"); |
3756 |
waitForAutoBuild(); |
3790 |
waitForAutoBuild(); |
3757 |
|
3791 |
addLibrary(project, "lib.jar", null, new String[0], |
3758 |
createFile("/P1/lib.jar", ""); |
3792 |
new String[]{"META-INF/MANIFEST.MF", |
|
|
3793 |
"Manifest-Version: 1.0\n"} , |
3794 |
JavaCore.VERSION_1_4); |
3795 |
|
3759 |
assertMarkers( |
3796 |
assertMarkers( |
3760 |
"Unexpected markers", |
3797 |
"Unexpected markers", |
3761 |
"", |
3798 |
"", |
Lines 3769-3779
Link Here
|
3769 |
* Ensures that a marker is removed if adding an external jar, restarting and refreshing |
3806 |
* Ensures that a marker is removed if adding an external jar, restarting and refreshing |
3770 |
* (regression test for https://bugs.eclipse.org/bugs/show_bug.cgi?id=216446 ) |
3807 |
* (regression test for https://bugs.eclipse.org/bugs/show_bug.cgi?id=216446 ) |
3771 |
*/ |
3808 |
*/ |
3772 |
public void testFixClasspath2() throws CoreException { |
3809 |
public void testFixClasspath2() throws CoreException, IOException { |
3773 |
try { |
3810 |
try { |
3774 |
IJavaProject p = createJavaProject("P", new String[0], new String[] {getExternalResourcePath("externalLib.abc")}, ""); |
3811 |
IJavaProject p = createJavaProject("P", new String[0], new String[] {getExternalResourcePath("externalLib.abc")}, ""); |
3775 |
waitForAutoBuild(); // 1 marker |
3812 |
waitForAutoBuild(); // 1 marker |
3776 |
createExternalFile("externalLib.abc", ""); |
3813 |
org.eclipse.jdt.core.tests.util.Util.createEmptyJar( |
|
|
3814 |
getExternalResourcePath("externalLib.abc"), |
3815 |
JavaCore.VERSION_1_4); |
3777 |
|
3816 |
|
3778 |
simulateExitRestart(); |
3817 |
simulateExitRestart(); |
3779 |
refreshExternalArchives(p); |
3818 |
refreshExternalArchives(p); |
Lines 3939-3949
Link Here
|
3939 |
* Ensures that a file not ending with .jar or .zip can be put on the classpath. |
3978 |
* Ensures that a file not ending with .jar or .zip can be put on the classpath. |
3940 |
* (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=182360 ) |
3979 |
* (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=182360 ) |
3941 |
*/ |
3980 |
*/ |
3942 |
public void testInvalidInternalJar2() throws CoreException { |
3981 |
public void testInvalidInternalJar2() throws CoreException, IOException { |
3943 |
try { |
3982 |
try { |
3944 |
createProject("P1"); |
3983 |
IJavaProject proj = createJavaProject("P1", new String[] {}, new String[0], "bin"); |
3945 |
createFile("/P1/existing.txt", ""); |
3984 |
|
3946 |
IJavaProject proj = createJavaProject("P2", new String[] {}, new String[] {"/P1/existing.txt"}, "bin"); |
3985 |
addLibrary(proj, "existing.txt", null, new String[0], |
|
|
3986 |
new String[]{"META-INF/MANIFEST.MF", |
3987 |
"Manifest-Version: 1.0\n"} , |
3988 |
JavaCore.VERSION_1_4); |
3989 |
proj = createJavaProject("P2", new String[] {}, new String[] {"/P1/existing.txt"}, "bin"); |
3947 |
assertMarkers( |
3990 |
assertMarkers( |
3948 |
"Unexpected markers", |
3991 |
"Unexpected markers", |
3949 |
"", |
3992 |
"", |
Lines 4933-4944
Link Here
|
4933 |
* Ensures that duplicate entries due to resolution are not reported |
4976 |
* Ensures that duplicate entries due to resolution are not reported |
4934 |
* (regression test for https://bugs.eclipse.org/bugs/show_bug.cgi?id=175226 ) |
4977 |
* (regression test for https://bugs.eclipse.org/bugs/show_bug.cgi?id=175226 ) |
4935 |
*/ |
4978 |
*/ |
4936 |
public void testDuplicateEntries2() throws CoreException { |
4979 |
public void testDuplicateEntries2() throws CoreException, IOException { |
4937 |
try { |
4980 |
try { |
4938 |
IJavaProject project = createJavaProject("P"); |
4981 |
IJavaProject project = createJavaProject("P"); |
4939 |
VariablesInitializer.setInitializer(new DefaultVariableInitializer(new String[] {"TEST_LIB", "/P/lib.jar"})); |
4982 |
VariablesInitializer.setInitializer(new DefaultVariableInitializer(new String[] {"TEST_LIB", "/P/lib.jar"})); |
4940 |
ContainerInitializer.setInitializer(new DefaultContainerInitializer(new String[] {"P", "/P/lib.jar"})); |
4983 |
ContainerInitializer.setInitializer(new DefaultContainerInitializer(new String[] {"P", "/P/lib.jar"})); |
4941 |
createFile("/P/lib.jar", ""); |
4984 |
addLibrary(project, "lib.jar", null, new String[0], |
|
|
4985 |
new String[]{"META-INF/MANIFEST.MF", |
4986 |
"Manifest-Version: 1.0\n"} , |
4987 |
JavaCore.VERSION_1_4); |
4942 |
editFile( |
4988 |
editFile( |
4943 |
"/P/.classpath", |
4989 |
"/P/.classpath", |
4944 |
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + |
4990 |
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + |
Lines 4948-4953
Link Here
|
4948 |
" <classpathentry kind=\"output\" path=\"bin\"/>\n" + |
4994 |
" <classpathentry kind=\"output\" path=\"bin\"/>\n" + |
4949 |
"</classpath>" |
4995 |
"</classpath>" |
4950 |
); |
4996 |
); |
|
|
4997 |
waitForAutoBuild(); |
4951 |
assertMarkers( |
4998 |
assertMarkers( |
4952 |
"Unexpected markers", |
4999 |
"Unexpected markers", |
4953 |
"", |
5000 |
"", |
Lines 5497-5509
Link Here
|
5497 |
/* |
5544 |
/* |
5498 |
* Ensures that removing an internal ZIP archive referenced by a library entry creates a marker |
5545 |
* Ensures that removing an internal ZIP archive referenced by a library entry creates a marker |
5499 |
*/ |
5546 |
*/ |
5500 |
public void testRemoveZIPArchive6() throws CoreException { |
5547 |
public void testRemoveZIPArchive6() throws CoreException, IOException { |
5501 |
try { |
5548 |
try { |
5502 |
IJavaProject p = createJavaProject("P", new String[0], new String[] {"/P/internalLib.abc"}, ""); |
5549 |
IJavaProject p = createJavaProject("P", new String[0], new String[0], ""); |
5503 |
createFile("/P/internalLib.abc", ""); |
5550 |
|
|
|
5551 |
addLibrary(p, "internalLib.abc", null, new String[0], |
5552 |
new String[]{"META-INF/MANIFEST.MF", |
5553 |
"Manifest-Version: 1.0\n"} , |
5554 |
JavaCore.VERSION_1_4); |
5504 |
waitForAutoBuild(); |
5555 |
waitForAutoBuild(); |
5505 |
|
5556 |
|
5506 |
deleteFile("/P/internalLib.abc"); |
5557 |
deleteFile("/P/internalLib.abc"); |
|
|
5558 |
waitForAutoBuild(); |
5507 |
assertMarkers( |
5559 |
assertMarkers( |
5508 |
"Unexpected markers", |
5560 |
"Unexpected markers", |
5509 |
"Project \'P\' is missing required library: \'internalLib.abc\'", |
5561 |
"Project \'P\' is missing required library: \'internalLib.abc\'", |
Lines 5517-5528
Link Here
|
5517 |
* Ensures that renaming a .jar file and updating the classpath in a PRE_BUILD event doesn't leave markers |
5569 |
* Ensures that renaming a .jar file and updating the classpath in a PRE_BUILD event doesn't leave markers |
5518 |
* (regression test for bug 177922 FlexibleProjectContainer refresh logic sporadically leaves project with "missing library" error on rename/delete) |
5570 |
* (regression test for bug 177922 FlexibleProjectContainer refresh logic sporadically leaves project with "missing library" error on rename/delete) |
5519 |
*/ |
5571 |
*/ |
5520 |
public void testRenameJar() throws CoreException { |
5572 |
public void testRenameJar() throws CoreException, IOException { |
5521 |
IResourceChangeListener listener = null; |
5573 |
IResourceChangeListener listener = null; |
5522 |
try { |
5574 |
try { |
5523 |
final IJavaProject p = createJavaProject("P", new String[0], new String[] {"/P/lib/test1.jar"}, ""); |
5575 |
final IJavaProject p = createJavaProject("P", new String[0], new String[0], ""); |
5524 |
createFolder("/P/lib"); |
5576 |
createFolder("/P/lib"); |
5525 |
createFile("/P/lib/test1.jar", ""); |
5577 |
addLibrary(p, "lib/test1.jar", null, new String[0], |
|
|
5578 |
new String[]{"META-INF/MANIFEST.MF", |
5579 |
"Manifest-Version: 1.0\n"} , |
5580 |
JavaCore.VERSION_1_4); |
5526 |
// at this point no markers exist |
5581 |
// at this point no markers exist |
5527 |
|
5582 |
|
5528 |
// register a listener that updates the classpath in a PRE_BUILD event |
5583 |
// register a listener that updates the classpath in a PRE_BUILD event |
Lines 6813-6818
Link Here
|
6813 |
deleteProject("ReferencedProject"); |
6868 |
deleteProject("ReferencedProject"); |
6814 |
} |
6869 |
} |
6815 |
} |
6870 |
} |
6816 |
|
6871 |
/** |
|
|
6872 |
* @bug 229042: [buildpath] could create build path error in case of invalid external JAR format |
6873 |
* |
6874 |
* Test that an invalid archive (JAR) creates a buildpath error |
6875 |
* |
6876 |
* @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=229042" |
6877 |
* @throws Exception |
6878 |
*/ |
6879 |
public void testBug229042() throws Exception { |
6880 |
try { |
6881 |
IJavaProject p = createJavaProject("P"); |
6882 |
createFile("/P/library.jar", ""); |
6883 |
setClasspath(p, new IClasspathEntry[] { JavaCore.newLibraryEntry(new Path("/P/library.jar"), null,null)}); |
6884 |
assertMarkers("Expected marker", |
6885 |
"Illegal type of archive for required library: \'library.jar\' in project \'P\'", p); |
6886 |
setClasspath(p, new IClasspathEntry[0]); |
6887 |
addLibrary(p, "library.jar", null, new String[0], |
6888 |
new String[] { |
6889 |
"p/X.java", |
6890 |
"package p;\n" + |
6891 |
"public class X {}\n", |
6892 |
"META-INF/MANIFEST.MF", |
6893 |
"Manifest-Version: 1.0\n", |
6894 |
}, |
6895 |
JavaCore.VERSION_1_4); |
6896 |
IFile file = p.getProject().getFile("library.jar"); |
6897 |
assertNotNull(file); |
6898 |
file.touch(null); |
6899 |
waitForAutoBuild(); |
6900 |
assertMarkers("Unexpected marker", |
6901 |
"", p); |
6902 |
|
6903 |
} finally { |
6904 |
deleteProject("P"); |
6905 |
} |
6906 |
} |
6817 |
|
6907 |
|
6818 |
} |
6908 |
} |