Lines 1-5
Link Here
|
1 |
/******************************************************************************* |
1 |
/******************************************************************************* |
2 |
* Copyright (c) 2000, 2009 IBM Corporation and others. |
2 |
* Copyright (c) 2000, 2010 IBM Corporation and others. |
3 |
* All rights reserved. This program and the accompanying materials |
3 |
* All rights reserved. This program and the accompanying materials |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
5 |
* which accompanies this distribution, and is available at |
5 |
* which accompanies this distribution, and is available at |
Lines 5971-5975
Link Here
|
5971 |
this.deleteProject("P"); |
5971 |
this.deleteProject("P"); |
5972 |
} |
5972 |
} |
5973 |
} |
5973 |
} |
|
|
5974 |
/** |
5975 |
* @bug 300136:classpathentry OPTIONAL attribute not honored for var entries |
5976 |
* |
5977 |
* Test that classpath entries (CPE_LIB, CPE_CONTAINER and CPE_VARIABLE) that are marked as optional |
5978 |
* in the .classpath file are not reported for errors. |
5979 |
* |
5980 |
* @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=300136" |
5981 |
*/ |
5982 |
public void testBug300136() throws Exception { |
5983 |
boolean autoBuild = getWorkspace().isAutoBuilding(); |
5984 |
IWorkspaceDescription preferences = getWorkspace().getDescription(); |
5985 |
try { |
5986 |
preferences.setAutoBuilding(false); |
5987 |
IJavaProject project = createJavaProject("P"); |
5988 |
StringBuffer buffer = new StringBuffer( |
5989 |
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + |
5990 |
"<classpath>\n" + |
5991 |
" <classpathentry kind=\"var\" path=\"TEST_LIB\">\n" + |
5992 |
" <attributes>\n" + |
5993 |
" <attribute name=\"optional\" value=\"true\"/>" + |
5994 |
" </attributes>\n" + |
5995 |
" </classpathentry>\n" + |
5996 |
" <classpathentry kind=\"var\" path=\"UNBOUND_VAR\">\n" + |
5997 |
" <attributes>\n" + |
5998 |
" <attribute name=\"optional\" value=\"true\"/>" + |
5999 |
" </attributes>\n" + |
6000 |
" </classpathentry>\n" + |
6001 |
" <classpathentry kind=\"con\" path=\"org.eclipse.jdt.core.tests.model.TEST_CONTAINER\">\n" + |
6002 |
" <attributes>\n" + |
6003 |
" <attribute name=\"optional\" value=\"true\"/>" + |
6004 |
" </attributes>\n" + |
6005 |
" </classpathentry>\n" + |
6006 |
" <classpathentry kind=\"output\" path=\"bin\"/>\n" + |
6007 |
"</classpath>" |
6008 |
); |
6009 |
editFile( |
6010 |
"/P/.classpath", |
6011 |
buffer.toString() |
6012 |
); |
6013 |
assertMarkers( |
6014 |
"Unexpected markers", |
6015 |
"", |
6016 |
project); |
6017 |
} finally { |
6018 |
preferences.setAutoBuilding(autoBuild); |
6019 |
deleteProject("P"); |
6020 |
} |
6021 |
} |
6022 |
/** |
6023 |
* Additional test for bug 300136 - Test that the the errors are reported when the |
6024 |
* optional attribute is not used. |
6025 |
* |
6026 |
* @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=300136" |
6027 |
*/ |
6028 |
public void testBug300136a() throws Exception { |
6029 |
boolean autoBuild = getWorkspace().isAutoBuilding(); |
6030 |
IWorkspaceDescription preferences = getWorkspace().getDescription(); |
6031 |
try { |
6032 |
preferences.setAutoBuilding(false); |
6033 |
IJavaProject project = createJavaProject("P"); |
6034 |
StringBuffer buffer = new StringBuffer( |
6035 |
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + |
6036 |
"<classpath>\n" + |
6037 |
" <classpathentry kind=\"var\" path=\"TEST_LIB\" />\n" + |
6038 |
" <classpathentry kind=\"var\" path=\"UNBOUND_VAR\" />\n" + |
6039 |
" <classpathentry kind=\"con\" path=\"org.eclipse.jdt.core.tests.model.TEST_CONTAINER\">\n" + |
6040 |
" </classpathentry>\n" + |
6041 |
" <classpathentry kind=\"output\" path=\"bin\"/>\n" + |
6042 |
"</classpath>" |
6043 |
); |
6044 |
editFile( |
6045 |
"/P/.classpath", |
6046 |
buffer.toString() |
6047 |
); |
6048 |
assertMarkers( |
6049 |
"Unexpected markers", |
6050 |
"Project \'P\' is missing required library: \'\\lib\\tmp.jar\'\n" + |
6051 |
"Unbound classpath container: \'org.eclipse.jdt.core.tests.model.TEST_CONTAINER\' in project \'P\'\n" + |
6052 |
"Unbound classpath variable: \'UNBOUND_VAR\' in project \'P\'", |
6053 |
project); |
6054 |
} finally { |
6055 |
preferences.setAutoBuilding(autoBuild); |
6056 |
deleteProject("P"); |
6057 |
} |
6058 |
} |
5974 |
|
6059 |
|
5975 |
} |
6060 |
} |