1
package org.vcs.bazaar.eclipse.core.commands;
3
import static org.junit.Assert.assertEquals;
4
import static org.junit.Assert.assertNotNull;
6
import java.io.ByteArrayInputStream;
7
import java.io.InputStream;
10
import org.eclipse.core.resources.IFile;
11
import org.eclipse.core.resources.IResource;
12
import org.eclipse.core.runtime.NullProgressMonitor;
13
import org.junit.Test;
14
import org.vcs.bazaar.eclipse.BzrWorkspaceRoot;
15
import org.vcs.bazaar.eclipse.TestCaseWithProject;
16
import org.vcs.bazaar.eclipse.core.model.local.IBzrLocalResource;
19
* @author Guillermo Gonzalez <guillo.gonzo@gmail.com>
22
public class IgnoredCommandTest extends TestCaseWithProject {
25
public final void testSingleFile() throws Exception {
26
IFile ignoredfile = getProject().getFile("ignored_file");
27
InputStream is = new ByteArrayInputStream("foobar".getBytes());
28
ignoredfile.create(is, true, new NullProgressMonitor());
29
getProject().refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
30
IBzrLocalResource bzrRes = BzrWorkspaceRoot.getBzrFileFor(ignoredfile);
32
getClient().setWorkDir(getProject().getLocation().toFile());
33
getClient().ignore(getProject().getLocation().toFile(), bzrRes.getName());
34
IgnoredCommand cmd = new IgnoredCommand(getProject());
35
cmd.run(new NullProgressMonitor());
36
Map<IResource, String> ignored = cmd.getIgnored();
37
assertNotNull(ignored);
38
assertEquals(1, ignored.size());
39
assertNotNull(ignored.get(ignoredfile));
40
assertEquals(ignoredfile, ignored.keySet().iterator().next());