use of org.locationtech.geogig.api.CommitBuilder in project GeoGig by boundlessgeo.
the class CommitBuilderTest method testNoAuthorTimeStamp.
@Test
public void testNoAuthorTimeStamp() throws Exception {
CommitBuilder b = new CommitBuilder();
b.setAuthor("groldan");
b.setAuthorEmail("groldan@boundlessgeo.com");
b.setCommitter("jdeolive");
b.setCommitterEmail("jdeolive@boundlessgeo.com");
b.setCommitterTimestamp(1000);
b.setMessage("cool this works");
assertEquals(1000, b.getAuthorTimestamp());
}
use of org.locationtech.geogig.api.CommitBuilder in project GeoGig by boundlessgeo.
the class CommitBuilderTest method testNoMessage.
@Test
public void testNoMessage() throws Exception {
CommitBuilder b = new CommitBuilder();
b.setAuthor("groldan");
b.setAuthorEmail("groldan@boundlessgeo.com");
b.setCommitter("jdeolive");
b.setCommitterEmail("jdeolive@boundlessgeo.com");
b.setMessage(null);
b.setAuthorTimestamp(1000);
ObjectId treeId = ObjectId.forString("fake tree content");
b.setTreeId(treeId);
ObjectId parentId1 = ObjectId.forString("fake parent content 1");
ObjectId parentId2 = ObjectId.forString("fake parent content 2");
List<ObjectId> parentIds = ImmutableList.of(parentId1, parentId2);
b.setParentIds(parentIds);
assertEquals(null, b.getMessage());
RevCommit commit2 = b.build();
assertEquals("", commit2.getMessage());
}
use of org.locationtech.geogig.api.CommitBuilder in project GeoGig by boundlessgeo.
the class CommitBuilderTest method testBuildEmpty.
public void testBuildEmpty() throws Exception {
CommitBuilder b = new CommitBuilder();
try {
b.build();
fail("expected IllegalStateException on null tree id");
} catch (IllegalStateException e) {
assertTrue(e.getMessage().contains("tree"));
}
}
use of org.locationtech.geogig.api.CommitBuilder in project GeoGig by boundlessgeo.
the class CommitBuilderTest method testPassingNullToSetParentIds.
@Test
public void testPassingNullToSetParentIds() throws Exception {
CommitBuilder b = new CommitBuilder();
b.setAuthor("groldan");
b.setAuthorEmail("groldan@boundlessgeo.com");
b.setCommitter("jdeolive");
b.setCommitterEmail("jdeolive@boundlessgeo.com");
b.setMessage("cool this works");
b.setAuthorTimestamp(1000);
ObjectId treeId = ObjectId.forString("fake tree content");
b.setTreeId(treeId);
b.setParentIds(null);
assertEquals(ImmutableList.of(), b.getParentIds());
}
use of org.locationtech.geogig.api.CommitBuilder in project GeoGig by boundlessgeo.
the class CommitBuilderTest method testCommitBuilder.
@Test
public void testCommitBuilder() throws Exception {
CommitBuilder b = new CommitBuilder();
b.setAuthor("groldan");
b.setAuthorEmail("groldan@boundlessgeo.com");
b.setCommitter("jdeolive");
b.setCommitterEmail("jdeolive@boundlessgeo.com");
b.setMessage("cool this works");
b.setAuthorTimestamp(1000);
ObjectId treeId = ObjectId.forString("fake tree content");
b.setTreeId(treeId);
ObjectId parentId1 = ObjectId.forString("fake parent content 1");
ObjectId parentId2 = ObjectId.forString("fake parent content 2");
List<ObjectId> parentIds = ImmutableList.of(parentId1, parentId2);
b.setParentIds(parentIds);
RevCommit commit1 = b.build();
CommitBuilder builder = new CommitBuilder(commit1);
assertEquals("groldan", builder.getAuthor());
assertEquals("jdeolive", builder.getCommitter());
assertEquals("groldan@boundlessgeo.com", builder.getAuthorEmail());
assertEquals("jdeolive@boundlessgeo.com", builder.getCommitterEmail());
assertEquals(commit1.getMessage(), builder.getMessage());
assertEquals(commit1.getParentIds(), builder.getParentIds());
assertEquals(commit1.getTreeId(), builder.getTreeId());
assertEquals(commit1.getAuthor().getTimestamp(), builder.getAuthorTimestamp());
RevCommit commit2 = builder.build();
assertEquals(commit1, commit2);
}
Aggregations