Lines 11-19
Link Here
|
11 |
package org.eclipse.core.tests.internal.localstore; |
11 |
package org.eclipse.core.tests.internal.localstore; |
12 |
|
12 |
|
13 |
import java.io.File; |
13 |
import java.io.File; |
|
|
14 |
import java.io.IOException; |
14 |
|
15 |
|
15 |
import junit.framework.Test; |
16 |
import junit.framework.Test; |
16 |
import junit.framework.TestSuite; |
17 |
import junit.framework.TestSuite; |
|
|
18 |
|
19 |
import org.eclipse.core.boot.BootLoader; |
17 |
import org.eclipse.core.internal.resources.*; |
20 |
import org.eclipse.core.internal.resources.*; |
18 |
import org.eclipse.core.resources.*; |
21 |
import org.eclipse.core.resources.*; |
19 |
import org.eclipse.core.runtime.*; |
22 |
import org.eclipse.core.runtime.*; |
Lines 222-228
Link Here
|
222 |
IFile file = project.getFile("file"); |
225 |
IFile file = project.getFile("file"); |
223 |
File target = file.getLocation().toFile(); |
226 |
File target = file.getLocation().toFile(); |
224 |
ensureExistsInWorkspace(file, true); |
227 |
ensureExistsInWorkspace(file, true); |
225 |
ensureDoesNotExistInFileSystem(file); |
228 |
ensureDoesNotExistInFileSystem(file); |
226 |
assertTrue("1.0", file.exists()); |
229 |
assertTrue("1.0", file.exists()); |
227 |
file.refreshLocal(IResource.DEPTH_INFINITE, null); |
230 |
file.refreshLocal(IResource.DEPTH_INFINITE, null); |
228 |
assertTrue("1.1", !file.exists()); |
231 |
assertTrue("1.1", !file.exists()); |
Lines 235-239
Link Here
|
235 |
folder.refreshLocal(IResource.DEPTH_INFINITE, null); |
238 |
folder.refreshLocal(IResource.DEPTH_INFINITE, null); |
236 |
assertTrue("2.1", folder.exists()); |
239 |
assertTrue("2.1", folder.exists()); |
237 |
assertTrue("2.2", ((Resource) folder).countResources(IResource.DEPTH_INFINITE, false) == (getTree(target).length + 1)); |
240 |
assertTrue("2.2", ((Resource) folder).countResources(IResource.DEPTH_INFINITE, false) == (getTree(target).length + 1)); |
|
|
241 |
} |
242 |
/** |
243 |
* Tests if files with names that are invalid segments are properly rejected - does not run on Windows. |
244 |
*/ |
245 |
public void testDiscoverFileWithInvalidName() { |
246 |
|
247 |
if (BootLoader.getOS().equals(BootLoader.OS_WIN32)) |
248 |
return; |
249 |
|
250 |
/* initialize common objects */ |
251 |
IProject project = projects[0]; |
252 |
|
253 |
/* test root deletion */ |
254 |
IFile file = project.getFile("file.txt"); |
255 |
File target = file.getLocation().toFile(); |
256 |
ensureExistsInFileSystem(file); |
257 |
|
258 |
File fileWithInvalidName = new File(project.getLocation().toFile(), "a\\b"); |
259 |
try { |
260 |
assertTrue("0.1", fileWithInvalidName.createNewFile()); |
261 |
} catch (IOException e) { |
262 |
fail("0.2", e); |
263 |
} |
264 |
assertTrue("1.0", !file.exists()); |
265 |
try { |
266 |
project.refreshLocal(IResource.DEPTH_INFINITE, getMonitor()); |
267 |
fail("2.0 - should have failed"); |
268 |
} catch (CoreException ce) { |
269 |
IStatus status = ce.getStatus(); |
270 |
assertTrue("2.1", status.isMultiStatus()); |
271 |
IStatus[] children = status.getChildren(); |
272 |
assertEquals("2.2", 1, children.length); |
273 |
assertTrue("2.3", children[0] instanceof ResourceStatus); |
274 |
assertEquals("2.4", IResourceStatus.INVALID_RESOURCE_NAME, children[0].getCode()); |
275 |
} |
276 |
assertTrue("3.0", file.exists()); |
238 |
} |
277 |
} |
239 |
} |
278 |
} |