1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.maven.scm.tck.command.info;
20
21 import java.io.File;
22 import java.time.OffsetDateTime;
23 import java.time.ZoneOffset;
24
25 import org.apache.maven.scm.ScmFileSet;
26 import org.apache.maven.scm.ScmTckTestCase;
27 import org.apache.maven.scm.command.info.InfoItem;
28 import org.apache.maven.scm.command.info.InfoScmResult;
29 import org.apache.maven.scm.provider.ScmProvider;
30 import org.junit.Test;
31
32 import static org.junit.Assert.assertEquals;
33
34
35
36
37
38 public abstract class InfoCommandTckTest extends ScmTckTestCase {
39
40 @Test
41 public void testInfoCommandWithJustBasedir() throws Exception {
42 ScmProvider scmProvider = getScmManager().getProviderByUrl(getScmUrl());
43 InfoScmResult result = scmProvider.info(getScmRepository().getProviderRepository(), getScmFileSet(), null);
44 assertResultIsSuccess(result);
45 assertEquals(1, result.getInfoItems().size());
46 InfoItem item = result.getInfoItems().get(0);
47 assertEquals("Mark Struberg <struberg@yahoo.de>", item.getLastChangedAuthor());
48 assertEquals("92f139dfec4d1dfb79c3cd2f94e83bf13129668b", item.getRevision());
49 assertEquals(
50 OffsetDateTime.of(2009, 03, 15, 19, 14, 02, 0, ZoneOffset.ofHours(1)), item.getLastChangedDateTime());
51 }
52
53 @Test
54 public void testInfoCommandFromBasedirDifferentFromWorkingCopyDirectory() throws Exception {
55 ScmProvider scmProvider = getScmManager().getProviderByUrl(getScmUrl());
56 ScmFileSet fileSet = new ScmFileSet(new File(getWorkingCopy(), "src/main"), new File("java/Application.java"));
57 InfoScmResult result = scmProvider.info(getScmRepository().getProviderRepository(), fileSet, null);
58 assertResultIsSuccess(result);
59 assertEquals(1, result.getInfoItems().size());
60 InfoItem item = result.getInfoItems().get(0);
61 assertEquals("Mark Struberg <struberg@yahoo.de>", item.getLastChangedAuthor());
62 assertEquals("92f139dfec4d1dfb79c3cd2f94e83bf13129668b", item.getRevision());
63 assertEquals(
64 OffsetDateTime.of(2009, 03, 15, 19, 14, 02, 0, ZoneOffset.ofHours(1)), item.getLastChangedDateTime());
65 }
66 }