~verterok/bzr-eclipse/pluginpath-fix

« back to all changes in this revision

Viewing changes to org.vcs.bazaar.eclipse.core.tests/src/org/vcs/bazaar/eclipse/core/commands/IgnoredCommandTest.java

  • Committer: Guillermo Gonzalez
  • Date: 2009-07-09 20:40:43 UTC
  • mfrom: (212.1.4 add-ignore)
  • Revision ID: guillo.gonzo@gmail.com-20090709204043-9l55py1bij7799s0
mergeĀ lp:~verterok/bzr-eclipse/add-ignore

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
package org.vcs.bazaar.eclipse.core.commands;
 
2
 
 
3
import static org.junit.Assert.assertEquals;
 
4
import static org.junit.Assert.assertNotNull;
 
5
 
 
6
import java.io.ByteArrayInputStream;
 
7
import java.io.InputStream;
 
8
import java.util.Map;
 
9
 
 
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;
 
17
 
 
18
/**
 
19
 * @author Guillermo Gonzalez <guillo.gonzo@gmail.com>
 
20
 *
 
21
 */
 
22
public class IgnoredCommandTest extends TestCaseWithProject {
 
23
 
 
24
        @Test
 
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);
 
31
                
 
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());
 
41
        }
 
42
}