blob: b1f284948d658428b2b0198f7dc57d82cba9782d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
/*******************************************************************************
* Copyright (c) 2009, 2018 Red Hat, Inc.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Elliott Baron <ebaron@redhat.com> - initial API and implementation
*******************************************************************************/
package org.eclipse.linuxtools.internal.valgrind.memcheck.tests;
import static org.junit.Assert.assertEquals;
import java.net.URL;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.Path;
import org.junit.After;
import org.junit.Before;
public abstract class AbstractLinkedResourceMemcheckTest extends
AbstractMemcheckTest {
@Before
public void linkedResourceSetUp() throws Exception {
proj = createProject(getBundle(), "linkedTest"); //$NON-NLS-1$
// delete source folder and replace it with a link to its bundle
// location
final Exception[] ex = new Exception[1];
ResourcesPlugin.getWorkspace().run((IWorkspaceRunnable) monitor -> {
try {
URL location = FileLocator.find(getBundle(), new Path(
"resources/linkedTest/src"), null); //$NON-NLS-1$
IFolder srcFolder = proj.getProject().getFolder("src"); //$NON-NLS-1$
srcFolder.delete(true, null);
srcFolder.createLink(FileLocator.toFileURL(location)
.toURI(), IResource.REPLACE, null);
} catch (Exception e) {
ex[0] = e;
}
}, null);
if (ex[0] != null) {
throw ex[0];
}
assertEquals(0, proj.getBinaryContainer().getBinaries().length);
buildProject(proj);
}
@After
public void cleanupLinkedResource() throws CoreException {
deleteProject(proj);
}
}
|