1 package com.soebes.maven.extensions.incremental;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import static org.assertj.core.api.Assertions.assertThat;
23
24 import java.io.File;
25 import java.util.List;
26
27 import org.apache.maven.scm.ScmException;
28 import org.apache.maven.scm.ScmFile;
29 import org.apache.maven.scm.ScmFileSet;
30 import org.apache.maven.scm.command.status.StatusScmResult;
31 import org.apache.maven.scm.manager.NoSuchScmProviderException;
32 import org.apache.maven.scm.manager.ScmManager;
33 import org.apache.maven.scm.repository.ScmRepository;
34 import org.apache.maven.scm.repository.ScmRepositoryException;
35 import org.codehaus.plexus.PlexusTestCase;
36 import org.slf4j.Logger;
37 import org.slf4j.LoggerFactory;
38
39 public class SecondTest extends PlexusTestCase {
40 private final Logger LOGGER = LoggerFactory.getLogger(getClass());
41
42 protected void setUp() throws Exception {
43 super.setUp();
44 super.setupContainer();
45 }
46
47 protected void tearDown() throws Exception {
48 super.tearDown();
49 }
50
51 private List<ScmFile> getChangedFiles() throws Exception {
52 ScmManager scmManager = (ScmManager) lookup(ScmManager.ROLE);
53
54 assertThat(scmManager).isNotNull();
55
56 ScmRepository repository = null;
57 try {
58
59 repository = scmManager.makeScmRepository("scm:git:ssh://git@github.com:khmarbaise/supose.git");
60 } catch (ScmRepositoryException | NoSuchScmProviderException e) {
61 e.printStackTrace();
62 }
63
64 StatusScmResult result = null;
65 try {
66 result = scmManager.status(repository, new ScmFileSet(new File("/Users/kama/ws-git/supose")));
67 } catch (ScmException e) {
68 e.printStackTrace();
69 }
70
71 List<ScmFile> changedFiles = result.getChangedFiles();
72 for (ScmFile scmFile : changedFiles) {
73 LOGGER.info(" file:" + scmFile.getPath() + " " + scmFile.getStatus());
74 }
75 return changedFiles;
76
77 }
78
79 public void testShouldGetChangesFiles() throws Exception {
80 getChangedFiles();
81 }
82
83 }